From 2e9bf520f67642375e5d0c476c4d0ebdf5d1186a Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Mon, 19 Jun 2023 15:35:21 +0200 Subject: [PATCH 001/202] Add docker configs and rebuild the .dist files to reflect the new docker based development environment --- config/legacy/parameters.yaml.dist | 38 +++--- .../samlstepupproviders_parameters.yaml.dist | 122 +++++++----------- docker/Dockerfile.prod | 18 +++ docker/conf/apache2.conf | 34 +++++ 4 files changed, 120 insertions(+), 92 deletions(-) create mode 100644 docker/Dockerfile.prod create mode 100644 docker/conf/apache2.conf diff --git a/config/legacy/parameters.yaml.dist b/config/legacy/parameters.yaml.dist index 638f0068..dce12917 100644 --- a/config/legacy/parameters.yaml.dist +++ b/config/legacy/parameters.yaml.dist @@ -15,41 +15,39 @@ parameters: debug_redirects: false use_assetic_controller: true - gateway_api_url: https://gateway.tld/ + gateway_api_url: https://gateway.dev.openconext.local/ gateway_api_username: ra - gateway_api_password: ra + gateway_api_password: ra_secret middleware_credentials_username: ra - middleware_credentials_password: ra - middleware_url_command_api: https://middleware.tld/command - middleware_url_api: https://middleware.tld/ + middleware_credentials_password: ra_secret + middleware_url_command_api: https://middleware.dev.openconext.local/command + middleware_url_api: https://middleware.dev.openconext.local/ sms_originator: SURFStepup sms_otp_expiry_interval: 900 # 15 minutes sms_maximum_otp_requests: 10 - saml_sp_publickey: - saml_sp_privatekey: - saml_metadata_publickey: - saml_metadata_privatekey: - saml_remote_idp_entity_id: - saml_remote_idp_sso_url: - saml_remote_idp_certificate: 'FOR CI ONLY, REPLACE WITH ACTUAL VALUE' - loa_required_for_login: 'https://gateway.tld/authentication/loa3' + saml_sp_publickey: /config/ra/ra_saml_sp.crt + saml_sp_privatekey: /config/ra/ra_saml_sp.key + saml_metadata_publickey: /config/ra/ra_saml_sp.crt + saml_metadata_privatekey: /config/ra/ra_saml_sp.key + saml_remote_idp_entity_id: https://gateway.dev.openconext.local/authentication/metadata + saml_remote_idp_sso_url: https://gateway.dev.openconext.local/authentication/single-sign-on + saml_remote_idp_certificate: 'MIIDwTCCAqmgAwIBAgIUYuSUugwc4J4NyW9WGqYJ/liwM4owDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCTkwxEDAOBgNVBAgMB1V0cmVjaHQxEDAOBgNVBAcMB1V0cmVjaHQxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDEUMBIGA1UEAwwLR2F0ZXdheSBJRFAwHhcNMjMwNTE3MTIxNTEyWhcNMzMwNTE0MTIxNTEyWjBwMQswCQYDVQQGEwJOTDEQMA4GA1UECAwHVXRyZWNodDEQMA4GA1UEBwwHVXRyZWNodDEnMCUGA1UECgweRGV2ZWxvcG1lbnQgRG9ja2VyIGVudmlyb25tZW50MRQwEgYDVQQDDAtHYXRld2F5IElEUDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM2ulQVs5WpbJOAf7Cv/VPDTJqbWHVdUxAmdwZJlcNTRKNFVp4aJzQ3dpiyiGghI5odnzU0/BWBoHZFNYPU/OFr/gzn6iJGxL63L9+mFgE8PR9HpkV5TaRnr21+nZ0EXWjDZk9Px0enERicCItTeQzAUJeA0A9miIcK5IKIz/zSBSR3c802SGD/VelUqY7Z2/UJM97cT92L+4Fz+4zhxxoThbPbrR0CweiROIt82grdwg7zf0+b62MOuVtqFh0yPLRAFfLc4LjHuxFUdUvOHVta7x74dwdmHikqfujM10XN+sNns3LDJde2yPWchU6ktq7cjgbYfIW/vzVzafP1Jk40CAwEAAaNTMFEwHQYDVR0OBBYEFGYn6LWRDZa7+YryUncIlwJB2VorMB8GA1UdIwQYMBaAFGYn6LWRDZa7+YryUncIlwJB2VorMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJ57lcOF6PWWW56mS2s5gKFImtfRFzlfiyHsF14L7+nQ5NjfOhpU0wRpnTjK91KP0wCwlxzGFXR8yfqfBFJryIV7aDdYPH/RIkwVaNBI0fsD/ozlYb18seieDEGLvQtTlrmc0UNHtWz6FW3L2geM3ENaqpOATl1Ywp4EPML7Dh0CbhhyM8PnPCEsdclouIeP5/B9Swfk3omXehof6bkFbntqA03msFBiW50twkfKeKULcJGXo667hto27KNxZUauqtPbnAGpUQmge8nxSQlN8RPwlvygVM4LVMF9qP9YxloTH0xVNwN4noZUhfMNsKoJ7Hg5Xulaok8oCqmzEiSroEg=' + loa_required_for_login: 'https://dev.openconext.local/authentication/loa3' enabled_second_factors: - sms - yubikey enabled_generic_second_factors: - biometric: - loa: 3 tiqr: loa: 3 asset_version: 1 - stepup_loa_loa1: https://gateway.tld/authentication/loa1 - stepup_loa_loa2: https://gateway.tld/authentication/loa2 - stepup_loa_loa3: https://gateway.tld/authentication/loa3 - stepup_loa_self_asserted: 'http://stepup.example.com/assurance/loa-self-asserted' + stepup_loa_loa1: https://dev.openconext.local/authentication/loa1 + stepup_loa_loa2: https://dev.openconext.local/authentication/loa2 + stepup_loa_loa3: https://dev.openconext.local/authentication/loa3 + stepup_loa_self_asserted: 'https://dev.openconext.local/assurance/loa-self-asserted' logout_redirect_url: nl_NL: https://www.surf.nl/over-surf/werkmaatschappijen/surfnet @@ -57,7 +55,7 @@ parameters: session_max_absolute_lifetime: 28800 # 8 hours * 60 minutes * 60 seconds session_max_relative_lifetime: 1800 # 30 minutes * 60 seconds - self_service_url: 'https://selfservice.tld/' + self_service_url: 'https://selfservice.dev.openconext.local/' # Date format defaults for Twig date functions date_format: 'Y-m-d H:i P' diff --git a/config/legacy/samlstepupproviders_parameters.yaml.dist b/config/legacy/samlstepupproviders_parameters.yaml.dist index b2684956..829fb434 100644 --- a/config/legacy/samlstepupproviders_parameters.yaml.dist +++ b/config/legacy/samlstepupproviders_parameters.yaml.dist @@ -1,11 +1,11 @@ parameters: - gssp_tiqr_sp_publickey: '/full/path/to/the/gateway-as-sp/public-key-file.cer' - gssp_tiqr_sp_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_tiqr_metadata_publickey: '/full/path/to/the/gateway-metadata/public-key-file.cer' - gssp_tiqr_metadata_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_tiqr_remote_entity_id: 'https://actual-gssp.entity-id.tld' - gssp_tiqr_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' - gssp_tiqr_remote_certificate: 'The contents of the certificate published by the gssp' + gssp_tiqr_sp_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_tiqr_sp_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_tiqr_metadata_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_tiqr_metadata_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_tiqr_remote_entity_id: 'https://gateway.dev.openconext.local/gssp/tiqr/metadata' + gssp_tiqr_remote_sso_url: 'https://gateway.dev.openconext.local/gssp/tiqr/single-sign-on' + gssp_tiqr_remote_certificate: 'MIIEDzCCAncCFCr9IG/lVOUCCSyMnD2Y+p1fqXEpMA0GCSqGSIb3DQEBCwUAMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDAeFw0yMzA1MjUwOTMzMTlaFw0yODA1MjMwOTMzMTlaMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKH20RosgtFT3WpCUnVSvdudJDzkSdAv8g16DPIU83g396SjxY7rrJHjLmf/RUChkUpCpV/7iCFhxuOi51sVRWZqdVYOjtAkK2it9CrSPdxx5u8XoDscX26DqC8Ii1RdO66GB0ErdtFcAxDdtzrUdLEJXF8vumEqNFBMmfJ9qZwJeOS9rnpYXHztRBtBANOYyJI5Qexr5I1Tmh8Jdg1h+VCosXBzk+iSAeQNzodnklIyJrlpJWh+FqR+LPK7cltkslX2eut/21uNBuKT5tcI+Uu9badWZWOHBxiaDI1B1eGHfcvG251DV5TvxQhClOrCZUea+ifTa18SMnuCO+8Da3lz7Oh+aNGPBT+Q+ynEr3LR36D+e0ZkzEtQ0aneS/JwHH9mgTGWVKxwbV81fVs6J7RQJtyfmbqkjQYXAad3uBQswMnHnQvHlFsh1Jd80BOM9ptNtNqIkXBcO9BzxAE2KXvSCglLISEj3o3L5N9XSYrnv3cPwxK1CddRR8CSm3S/PwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBgQAciF351BTUE/1XbjXLAZXVUeC6Ss6X5RptK0J9XBqIdYhcHRDws5CjHVkFS11PGtFK8OW+bYWzyygi8d3uGZWq3S7LkK5Eck0O8KHNUf3fnJNN0G3WSZkG95ch/2cy76WVCwYdVZhwGx2sB08N9M2QectrW1rU1VnqkAlzpicBgBtNLwDvvWUj0/h/mG8ExL44ecesPkzhPsBT6en/C8v5zbgYlJmJekBwWJzRDZenhLQZSxiOKxy0VOVpeypeCRleJdrF/m37TevtXfZu5efYl4a4E4qEO03eSU0YJVz/1HIRJ0ojOiKc6pB0aDUbcdbwi5rs5VRAOrTorBwqQAAgsvYSMGC2KVA9YLGDwpwAUqGYn0lFTcDtZkE0NDqXkiExcXPVce1QrKC/sqP0T0z30x71k3cYY4gNRLr8yA1Zu0o3IhvRsw3QiqAS4w5+wb668a+nPqAND1vgljn3L7SE9V7GTHbjwkfYAW6EJwVIA4gGsarZBHiDHloDrvv9QtY=' gssp_tiqr_title: en_GB: 'Tiqr' nl_NL: 'Tiqr' @@ -21,13 +21,13 @@ parameters: gssp_tiqr_gssf_id_mismatch: en_GB: "The Tiqr server responded with an ID that doesn't match the requested ID the registrant registered with using the Self-Service application." nl_NL: 'De Tiqr-server heeft een ID teruggegeven dat niet overeenkomt met het gevraagde ID, dat de registrant heeft geregistreerd in de Self-Service-applicatie.' - gssp_azuremfa_sp_publickey: '/full/path/to/the/gateway-as-sp/public-key-file.cer' - gssp_azuremfa_sp_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_azuremfa_metadata_publickey: '/full/path/to/the/gateway-metadata/public-key-file.cer' - gssp_azuremfa_metadata_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_azuremfa_remote_entity_id: 'https://actual-gssp.entity-id.tld' - gssp_azuremfa_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' - gssp_azuremfa_remote_certificate: 'The contents of the certificate published by the gssp' + gssp_azuremfa_sp_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_azuremfa_sp_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_azuremfa_metadata_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_azuremfa_metadata_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_azuremfa_remote_entity_id: 'https://gateway.dev.openconext.local/gssp/azuremfa/metadata' + gssp_azuremfa_remote_sso_url: 'https://gateway.dev.openconext.local/gssp/azuremfa/single-sign-on' + gssp_azuremfa_remote_certificate: 'MIIEDzCCAncCFCr9IG/lVOUCCSyMnD2Y+p1fqXEpMA0GCSqGSIb3DQEBCwUAMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDAeFw0yMzA1MjUwOTMzMTlaFw0yODA1MjMwOTMzMTlaMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKH20RosgtFT3WpCUnVSvdudJDzkSdAv8g16DPIU83g396SjxY7rrJHjLmf/RUChkUpCpV/7iCFhxuOi51sVRWZqdVYOjtAkK2it9CrSPdxx5u8XoDscX26DqC8Ii1RdO66GB0ErdtFcAxDdtzrUdLEJXF8vumEqNFBMmfJ9qZwJeOS9rnpYXHztRBtBANOYyJI5Qexr5I1Tmh8Jdg1h+VCosXBzk+iSAeQNzodnklIyJrlpJWh+FqR+LPK7cltkslX2eut/21uNBuKT5tcI+Uu9badWZWOHBxiaDI1B1eGHfcvG251DV5TvxQhClOrCZUea+ifTa18SMnuCO+8Da3lz7Oh+aNGPBT+Q+ynEr3LR36D+e0ZkzEtQ0aneS/JwHH9mgTGWVKxwbV81fVs6J7RQJtyfmbqkjQYXAad3uBQswMnHnQvHlFsh1Jd80BOM9ptNtNqIkXBcO9BzxAE2KXvSCglLISEj3o3L5N9XSYrnv3cPwxK1CddRR8CSm3S/PwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBgQAciF351BTUE/1XbjXLAZXVUeC6Ss6X5RptK0J9XBqIdYhcHRDws5CjHVkFS11PGtFK8OW+bYWzyygi8d3uGZWq3S7LkK5Eck0O8KHNUf3fnJNN0G3WSZkG95ch/2cy76WVCwYdVZhwGx2sB08N9M2QectrW1rU1VnqkAlzpicBgBtNLwDvvWUj0/h/mG8ExL44ecesPkzhPsBT6en/C8v5zbgYlJmJekBwWJzRDZenhLQZSxiOKxy0VOVpeypeCRleJdrF/m37TevtXfZu5efYl4a4E4qEO03eSU0YJVz/1HIRJ0ojOiKc6pB0aDUbcdbwi5rs5VRAOrTorBwqQAAgsvYSMGC2KVA9YLGDwpwAUqGYn0lFTcDtZkE0NDqXkiExcXPVce1QrKC/sqP0T0z30x71k3cYY4gNRLr8yA1Zu0o3IhvRsw3QiqAS4w5+wb668a+nPqAND1vgljn3L7SE9V7GTHbjwkfYAW6EJwVIA4gGsarZBHiDHloDrvv9QtY=' gssp_azuremfa_title: en_GB: 'AzureMFA' nl_NL: 'AzureMFA' @@ -43,13 +43,13 @@ parameters: gssp_azuremfa_gssf_id_mismatch: en_GB: "The institutions ADFS responded with an ID that doesn't match the requested ID the registrant registered with using the Self-Service application." nl_NL: 'De ADFS van de instelling heeft een ID teruggegeven dat niet overeenkomt met het gevraagde ID, dat de registrant heeft geregistreerd in de Self-Service-applicatie.' - gssp_webauthn_sp_publickey: '/full/path/to/the/gateway-as-sp/public-key-file.cer' - gssp_webauthn_sp_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_webauthn_metadata_publickey: '/full/path/to/the/gateway-metadata/public-key-file.cer' - gssp_webauthn_metadata_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_webauthn_remote_entity_id: 'https://actual-gssp.entity-id.tld' - gssp_webauthn_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' - gssp_webauthn_remote_certificate: 'The contents of the certificate published by the gssp' + gssp_webauthn_sp_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_webauthn_sp_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_webauthn_metadata_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_webauthn_metadata_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_webauthn_remote_entity_id: 'https://gateway.dev.openconext.local/gssp/webauthn/metadata' + gssp_webauthn_remote_sso_url: 'https://gateway.dev.openconext.local/gssp/webauthn/single-sign-on' + gssp_webauthn_remote_certificate: 'MIIEDzCCAncCFCr9IG/lVOUCCSyMnD2Y+p1fqXEpMA0GCSqGSIb3DQEBCwUAMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDAeFw0yMzA1MjUwOTMzMTlaFw0yODA1MjMwOTMzMTlaMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKH20RosgtFT3WpCUnVSvdudJDzkSdAv8g16DPIU83g396SjxY7rrJHjLmf/RUChkUpCpV/7iCFhxuOi51sVRWZqdVYOjtAkK2it9CrSPdxx5u8XoDscX26DqC8Ii1RdO66GB0ErdtFcAxDdtzrUdLEJXF8vumEqNFBMmfJ9qZwJeOS9rnpYXHztRBtBANOYyJI5Qexr5I1Tmh8Jdg1h+VCosXBzk+iSAeQNzodnklIyJrlpJWh+FqR+LPK7cltkslX2eut/21uNBuKT5tcI+Uu9badWZWOHBxiaDI1B1eGHfcvG251DV5TvxQhClOrCZUea+ifTa18SMnuCO+8Da3lz7Oh+aNGPBT+Q+ynEr3LR36D+e0ZkzEtQ0aneS/JwHH9mgTGWVKxwbV81fVs6J7RQJtyfmbqkjQYXAad3uBQswMnHnQvHlFsh1Jd80BOM9ptNtNqIkXBcO9BzxAE2KXvSCglLISEj3o3L5N9XSYrnv3cPwxK1CddRR8CSm3S/PwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBgQAciF351BTUE/1XbjXLAZXVUeC6Ss6X5RptK0J9XBqIdYhcHRDws5CjHVkFS11PGtFK8OW+bYWzyygi8d3uGZWq3S7LkK5Eck0O8KHNUf3fnJNN0G3WSZkG95ch/2cy76WVCwYdVZhwGx2sB08N9M2QectrW1rU1VnqkAlzpicBgBtNLwDvvWUj0/h/mG8ExL44ecesPkzhPsBT6en/C8v5zbgYlJmJekBwWJzRDZenhLQZSxiOKxy0VOVpeypeCRleJdrF/m37TevtXfZu5efYl4a4E4qEO03eSU0YJVz/1HIRJ0ojOiKc6pB0aDUbcdbwi5rs5VRAOrTorBwqQAAgsvYSMGC2KVA9YLGDwpwAUqGYn0lFTcDtZkE0NDqXkiExcXPVce1QrKC/sqP0T0z30x71k3cYY4gNRLr8yA1Zu0o3IhvRsw3QiqAS4w5+wb668a+nPqAND1vgljn3L7SE9V7GTHbjwkfYAW6EJwVIA4gGsarZBHiDHloDrvv9QtY=' gssp_webauthn_title: en_GB: 'Webauthn' nl_NL: 'Webauthn' @@ -65,57 +65,13 @@ parameters: gssp_webauthn_gssf_id_mismatch: en_GB: "The Webauthn server responded with an ID that doesn't match the requested ID the registrant registered with using the Self-Service application." nl_NL: 'De Webauthn-server heeft een ID teruggegeven dat niet overeenkomt met het gevraagde ID, dat de registrant heeft geregistreerd in de Self-Service-applicatie.' - gssp_biometric_sp_publickey: '/full/path/to/the/gateway-as-sp/public-key-file.cer' - gssp_biometric_sp_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_biometric_metadata_publickey: '/full/path/to/the/gateway-metadata/public-key-file.cer' - gssp_biometric_metadata_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_biometric_remote_entity_id: 'https://actual-gssp.entity-id.tld' - gssp_biometric_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' - gssp_biometric_remote_certificate: 'The contents of the certificate published by the gssp' - gssp_biometric_title: - en_GB: 'Biometric' - nl_NL: 'Biometrisch' - gssp_biometric_page_title: - en_GB: 'EN ra.vetting.gssf.initiate.biometric.title.page' - nl_NL: 'NL ra.vetting.gssf.initiate.biometric.title.page' - gssp_biometric_explanation: - en_GB: 'EN ra.vetting.gssf.initiate.biometric.text.explanation' - nl_NL: 'NL ra.vetting.gssf.initiate.biometric.text.explanation' - gssp_biometric_initiate: - en_GB: 'EN ra.vetting.gssf.initiate.biometric.button.initiate' - nl_NL: 'NL ra.vetting.gssf.initiate.biometric.button.initiate' - gssp_biometric_gssf_id_mismatch: - en_GB: 'EN ra.vetting.gssf.initiate.biometric.error.gssf_id_mismatch' - nl_NL: 'NL ra.vetting.gssf.initiate.biometric.error.gssf_id_mismatch' - gssp_demo_gssp_2_sp_publickey: '/full/path/to/the/gateway-as-sp/public-key-file.cer' - gssp_demo_gssp_2_sp_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_demo_gssp_2_metadata_publickey: '/full/path/to/the/gateway-metadata/public-key-file.cer' - gssp_demo_gssp_2_metadata_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_demo_gssp_2_remote_entity_id: 'https://actual-gssp.entity-id.tld' - gssp_demo_gssp_2_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' - gssp_demo_gssp_2_remote_certificate: 'The contents of the certificate published by the gssp' - gssp_demo_gssp_2_title: - en_GB: 'demo_gssp_2' - nl_NL: 'demo_gssp_2' - gssp_demo_gssp_2_page_title: - en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.title.page' - nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.title.page' - gssp_demo_gssp_2_explanation: - en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.text.explanation' - nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.text.explanation' - gssp_demo_gssp_2_initiate: - en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.button.initiate' - nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.button.initiate' - gssp_demo_gssp_2_gssf_id_mismatch: - en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.error.gssf_id_mismatch' - nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.error.gssf_id_mismatch' - gssp_demo_gssp_sp_publickey: '/full/path/to/the/gateway-as-sp/public-key-file.cer' - gssp_demo_gssp_sp_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_demo_gssp_metadata_publickey: '/full/path/to/the/gateway-metadata/public-key-file.cer' - gssp_demo_gssp_metadata_privatekey: '/full/path/to/the/gateway-as-sp/private-key-file.pem' - gssp_demo_gssp_remote_entity_id: 'https://actual-gssp.entity-id.tld' - gssp_demo_gssp_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' - gssp_demo_gssp_remote_certificate: 'The contents of the certificate published by the gssp' + gssp_demo_gssp_sp_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_demo_gssp_sp_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_demo_gssp_metadata_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_demo_gssp_metadata_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_demo_gssp_remote_entity_id: 'https://gateway.dev.openconext.local/gssp/demo_gssp/metadata' + gssp_demo_gssp_remote_sso_url: 'https://gateway.dev.openconext.local/gssp/demo_gssp/single-sign-on' + gssp_demo_gssp_remote_certificate: 'MIIEDzCCAncCFCr9IG/lVOUCCSyMnD2Y+p1fqXEpMA0GCSqGSIb3DQEBCwUAMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDAeFw0yMzA1MjUwOTMzMTlaFw0yODA1MjMwOTMzMTlaMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKH20RosgtFT3WpCUnVSvdudJDzkSdAv8g16DPIU83g396SjxY7rrJHjLmf/RUChkUpCpV/7iCFhxuOi51sVRWZqdVYOjtAkK2it9CrSPdxx5u8XoDscX26DqC8Ii1RdO66GB0ErdtFcAxDdtzrUdLEJXF8vumEqNFBMmfJ9qZwJeOS9rnpYXHztRBtBANOYyJI5Qexr5I1Tmh8Jdg1h+VCosXBzk+iSAeQNzodnklIyJrlpJWh+FqR+LPK7cltkslX2eut/21uNBuKT5tcI+Uu9badWZWOHBxiaDI1B1eGHfcvG251DV5TvxQhClOrCZUea+ifTa18SMnuCO+8Da3lz7Oh+aNGPBT+Q+ynEr3LR36D+e0ZkzEtQ0aneS/JwHH9mgTGWVKxwbV81fVs6J7RQJtyfmbqkjQYXAad3uBQswMnHnQvHlFsh1Jd80BOM9ptNtNqIkXBcO9BzxAE2KXvSCglLISEj3o3L5N9XSYrnv3cPwxK1CddRR8CSm3S/PwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBgQAciF351BTUE/1XbjXLAZXVUeC6Ss6X5RptK0J9XBqIdYhcHRDws5CjHVkFS11PGtFK8OW+bYWzyygi8d3uGZWq3S7LkK5Eck0O8KHNUf3fnJNN0G3WSZkG95ch/2cy76WVCwYdVZhwGx2sB08N9M2QectrW1rU1VnqkAlzpicBgBtNLwDvvWUj0/h/mG8ExL44ecesPkzhPsBT6en/C8v5zbgYlJmJekBwWJzRDZenhLQZSxiOKxy0VOVpeypeCRleJdrF/m37TevtXfZu5efYl4a4E4qEO03eSU0YJVz/1HIRJ0ojOiKc6pB0aDUbcdbwi5rs5VRAOrTorBwqQAAgsvYSMGC2KVA9YLGDwpwAUqGYn0lFTcDtZkE0NDqXkiExcXPVce1QrKC/sqP0T0z30x71k3cYY4gNRLr8yA1Zu0o3IhvRsw3QiqAS4w5+wb668a+nPqAND1vgljn3L7SE9V7GTHbjwkfYAW6EJwVIA4gGsarZBHiDHloDrvv9QtY=' gssp_demo_gssp_title: en_GB: 'demo_gssp' nl_NL: 'demo_gssp' @@ -131,3 +87,25 @@ parameters: gssp_demo_gssp_gssf_id_mismatch: en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp.error.gssf_id_mismatch' nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp.error.gssf_id_mismatch' + gssp_demo_gssp_2_sp_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_demo_gssp_2_sp_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_demo_gssp_2_metadata_publickey: '/config/ra/ra_gssp_sp.crt' + gssp_demo_gssp_2_metadata_privatekey: '/config/ra/ra_gssp_sp.key' + gssp_demo_gssp_2_remote_entity_id: 'https://gateway.dev.openconext.local/gssp/demo_gssp_2/metadata' + gssp_demo_gssp_2_remote_sso_url: 'https://gateway.dev.openconext.local/gssp/demo_gssp_2/single-sign-on' + gssp_demo_gssp_2_remote_certificate: 'MIIEDzCCAncCFCr9IG/lVOUCCSyMnD2Y+p1fqXEpMA0GCSqGSIb3DQEBCwUAMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDAeFw0yMzA1MjUwOTMzMTlaFw0yODA1MjMwOTMzMTlaMEQxGTAXBgNVBAMMEEdhdGV3YXkgVGlxciBJZFAxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAKH20RosgtFT3WpCUnVSvdudJDzkSdAv8g16DPIU83g396SjxY7rrJHjLmf/RUChkUpCpV/7iCFhxuOi51sVRWZqdVYOjtAkK2it9CrSPdxx5u8XoDscX26DqC8Ii1RdO66GB0ErdtFcAxDdtzrUdLEJXF8vumEqNFBMmfJ9qZwJeOS9rnpYXHztRBtBANOYyJI5Qexr5I1Tmh8Jdg1h+VCosXBzk+iSAeQNzodnklIyJrlpJWh+FqR+LPK7cltkslX2eut/21uNBuKT5tcI+Uu9badWZWOHBxiaDI1B1eGHfcvG251DV5TvxQhClOrCZUea+ifTa18SMnuCO+8Da3lz7Oh+aNGPBT+Q+ynEr3LR36D+e0ZkzEtQ0aneS/JwHH9mgTGWVKxwbV81fVs6J7RQJtyfmbqkjQYXAad3uBQswMnHnQvHlFsh1Jd80BOM9ptNtNqIkXBcO9BzxAE2KXvSCglLISEj3o3L5N9XSYrnv3cPwxK1CddRR8CSm3S/PwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBgQAciF351BTUE/1XbjXLAZXVUeC6Ss6X5RptK0J9XBqIdYhcHRDws5CjHVkFS11PGtFK8OW+bYWzyygi8d3uGZWq3S7LkK5Eck0O8KHNUf3fnJNN0G3WSZkG95ch/2cy76WVCwYdVZhwGx2sB08N9M2QectrW1rU1VnqkAlzpicBgBtNLwDvvWUj0/h/mG8ExL44ecesPkzhPsBT6en/C8v5zbgYlJmJekBwWJzRDZenhLQZSxiOKxy0VOVpeypeCRleJdrF/m37TevtXfZu5efYl4a4E4qEO03eSU0YJVz/1HIRJ0ojOiKc6pB0aDUbcdbwi5rs5VRAOrTorBwqQAAgsvYSMGC2KVA9YLGDwpwAUqGYn0lFTcDtZkE0NDqXkiExcXPVce1QrKC/sqP0T0z30x71k3cYY4gNRLr8yA1Zu0o3IhvRsw3QiqAS4w5+wb668a+nPqAND1vgljn3L7SE9V7GTHbjwkfYAW6EJwVIA4gGsarZBHiDHloDrvv9QtY=' + gssp_demo_gssp_2_title: + en_GB: 'demo_gssp_2' + nl_NL: 'demo_gssp_2' + gssp_demo_gssp_2_page_title: + en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.title.page' + nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.title.page' + gssp_demo_gssp_2_explanation: + en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.text.explanation' + nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.text.explanation' + gssp_demo_gssp_2_initiate: + en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.button.initiate' + nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.button.initiate' + gssp_demo_gssp_2_gssf_id_mismatch: + en_GB: 'EN ra.vetting.gssf.initiate.demo_gssp_2.error.gssf_id_mismatch' + nl_NL: 'NL ra.vetting.gssf.initiate.demo_gssp_2.error.gssf_id_mismatch' diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod new file mode 100644 index 00000000..5bd24a31 --- /dev/null +++ b/docker/Dockerfile.prod @@ -0,0 +1,18 @@ +FROM ghcr.io/openconext/openconext-basecontainers/php72-apache2:latest AS php-build +COPY *.tar.bz2 /tmp/ +RUN tar -xvjf /tmp/*.tar.bz2 -C /var/www/html/ && \ + rm -rf /tmp/*.tar.bz2 + +# Add the application configuration files +COPY config/legacy/parameters.yaml.dist config/legacy/parameters.yaml +COPY config/legacy/samlstepupproviders_parameters.yaml.dist config/legacy/samlstepupproviders_parameters.yaml + +# Add the config files for Apache2 +RUN rm -rf /etc/apache2/sites-enabled/* +COPY ./docker/conf/apache2.conf /etc/apache2/sites-enabled/apache2.conf +RUN rm -rf /var/www/html/var/cache/prod && chown -R www-data /var/www/html/var + +# Set the default workdir +WORKDIR /var/www/html + +CMD ["apache2-foreground"] diff --git a/docker/conf/apache2.conf b/docker/conf/apache2.conf new file mode 100644 index 00000000..6aeb625b --- /dev/null +++ b/docker/conf/apache2.conf @@ -0,0 +1,34 @@ + + ServerName ra + ServerAdmin admin@dev.openconext.local + + DocumentRoot /var/www/html/public + + SetEnv HTTPS on + SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 + + + Require all granted + + Options -MultiViews + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php [QSA,L] + + + Require all granted + + + Header always set X-Content-Type-Options "nosniff" + + # Set the php application handler so mod_php interpets the files + + SetHandler application/x-httpd-php + + + ExpiresActive on + ExpiresByType font/* "access plus 1 year" + ExpiresByType image/* "access plus 6 months" + ExpiresByType text/css "access plus 1 year" + ExpiresByType text/js "access plus 1 year" + From 4b46699ef8045bd5aec337ded4e7226a44fd0846 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 20 Jun 2023 15:35:06 +0300 Subject: [PATCH 002/202] Configuring the github actions pipelines for this app --- .github/workflows/build-push-docker-image.yml | 58 +++++++++++++++++++ .github/workflows/tag-release.yml | 8 +++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/build-push-docker-image.yml diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml new file mode 100644 index 00000000..08b89aeb --- /dev/null +++ b/.github/workflows/build-push-docker-image.yml @@ -0,0 +1,58 @@ +name: build-push-docker-image + +#on: workflow_dispatch +on: + push: + branches: feature/docker_configs + workflow_dispatch: + +jobs: + build-push-docker-image: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get the latest release + id: release + uses: robinraju/release-downloader@v1.7 + with: + latest: true + fileName: "*.tar.bz2" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push the Production image + uses: docker/build-push-action@v4 + with: + context: . + file: docker/Dockerfile.prod + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/openconext/stepup-ra/stepup-ra:prod + ghcr.io/openconext/stepup-ra/stepup-ra:${{ github.sha }} + ghcr.io/openconext/stepup-ra/stepup-ra:${{ steps.release.outputs.tag_name }} + + - name: Build and push the Development image + uses: docker/build-push-action@v4 + with: + context: . + file: docker/Dockerfile.dev + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/openconext/stepup-ra/stepup-ra:dev diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index db32f2b5..5bf83626 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -62,3 +62,11 @@ jobs: with: release_id: ${{ steps.create_release.outputs.id }} + after_build: + needs: build + runs-on: ubuntu-latest + steps: + - name: Trigger Docker container build + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: build-push-docker-image.yml From cd646f4fcf8225511ed5420dfd858a8add525d15 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 20 Jun 2023 15:37:26 +0300 Subject: [PATCH 003/202] Adding the dev image and fixing up some naming conventions --- docker/Dockerfile.dev | 10 ++++++++++ docker/Dockerfile.prod | 2 +- docker/conf/{apache2.conf => ra-apache2.conf} | 0 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile.dev rename docker/conf/{apache2.conf => ra-apache2.conf} (100%) diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev new file mode 100644 index 00000000..48dcb2dd --- /dev/null +++ b/docker/Dockerfile.dev @@ -0,0 +1,10 @@ +FROM ghcr.io/openconext/openconext-basecontainers/php72-apache2-node14-composer2:latest + +RUN rm -rf /etc/apache2/sites-enabled/* +COPY ./docker/conf/ra-apache2.conf /etc/apache2/sites-enabled/ra.conf +EXPOSE 80 + +# Set the default workdir +WORKDIR /var/www/html + +CMD ["apache2-foreground"] diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index 5bd24a31..baf3ec6a 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -9,7 +9,7 @@ COPY config/legacy/samlstepupproviders_parameters.yaml.dist config/legacy/samlst # Add the config files for Apache2 RUN rm -rf /etc/apache2/sites-enabled/* -COPY ./docker/conf/apache2.conf /etc/apache2/sites-enabled/apache2.conf +COPY ./docker/conf/ra-apache2.conf /etc/apache2/sites-enabled/ra.conf RUN rm -rf /var/www/html/var/cache/prod && chown -R www-data /var/www/html/var # Set the default workdir diff --git a/docker/conf/apache2.conf b/docker/conf/ra-apache2.conf similarity index 100% rename from docker/conf/apache2.conf rename to docker/conf/ra-apache2.conf From 8c2eeb4c2cf7831bf3a9c6e3bad84ea716287a1e Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Fri, 14 Jul 2023 10:32:13 +0200 Subject: [PATCH 004/202] Default docker config: Add mailcatcher host --- config/legacy/parameters.yaml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/legacy/parameters.yaml.dist b/config/legacy/parameters.yaml.dist index dce12917..fcaa83f7 100644 --- a/config/legacy/parameters.yaml.dist +++ b/config/legacy/parameters.yaml.dist @@ -2,7 +2,7 @@ parameters: trusted_proxies: ~ mailer_transport: smtp - mailer_host: 127.0.0.1 + mailer_host: mailcatcher mailer_user: ~ mailer_password: ~ From 9e6ae713959c9ebec1d86f1261935d23f9549093 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Fri, 14 Jul 2023 13:45:20 +0200 Subject: [PATCH 005/202] Docker config: Make sure all second factors are the same --- config/legacy/parameters.yaml.dist | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/config/legacy/parameters.yaml.dist b/config/legacy/parameters.yaml.dist index fcaa83f7..2a26a7e8 100644 --- a/config/legacy/parameters.yaml.dist +++ b/config/legacy/parameters.yaml.dist @@ -39,9 +39,20 @@ parameters: enabled_second_factors: - sms - yubikey + - tiqr + - demo_gssp + - webauthn + - azuremfa enabled_generic_second_factors: - tiqr: - loa: 3 + azuremfa: + loa: 2 + tiqr: + loa: 2 + webauthn: + loa: 3 + demo_gssp: + loa: 3 + asset_version: 1 stepup_loa_loa1: https://dev.openconext.local/authentication/loa1 From fed2a943276de9a96abc31943c377a7dff9252ae Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Fri, 14 Jul 2023 14:56:01 +0200 Subject: [PATCH 006/202] Docker config: Add correct loa1.5 --- config/legacy/parameters.yaml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/legacy/parameters.yaml.dist b/config/legacy/parameters.yaml.dist index 2a26a7e8..d1be76e1 100644 --- a/config/legacy/parameters.yaml.dist +++ b/config/legacy/parameters.yaml.dist @@ -58,7 +58,7 @@ parameters: stepup_loa_loa1: https://dev.openconext.local/authentication/loa1 stepup_loa_loa2: https://dev.openconext.local/authentication/loa2 stepup_loa_loa3: https://dev.openconext.local/authentication/loa3 - stepup_loa_self_asserted: 'https://dev.openconext.local/assurance/loa-self-asserted' + stepup_loa_self_asserted: 'https://dev.openconext.local/assurance/loa1.5' logout_redirect_url: nl_NL: https://www.surf.nl/over-surf/werkmaatschappijen/surfnet From d8081431d59cf3ae334cdcb6a1de15fdf15e3713 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Mon, 21 Aug 2023 15:54:29 +0200 Subject: [PATCH 007/202] Docker: Add monolog configuration when running as a container This will let the logs go to stdout when running as a container, which is the Docker way to send logs --- config/packages/prod/monolog.yaml.docker | 13 +++++++++++++ docker/Dockerfile.prod | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 config/packages/prod/monolog.yaml.docker diff --git a/config/packages/prod/monolog.yaml.docker b/config/packages/prod/monolog.yaml.docker new file mode 100644 index 00000000..3928853e --- /dev/null +++ b/config/packages/prod/monolog.yaml.docker @@ -0,0 +1,13 @@ +monolog: + handlers: + prod-signaler: + type: fingers_crossed + action_level: ERROR + passthru_level: NOTICE # this means that all message of level NOTICE or higher are always logged + handler: main_syslog + bubble: false # if we handle it, nothing else should + main_syslog: + type: stream + path: "php://stderr" + formatter: surfnet_stepup.monolog.json_formatter + diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index baf3ec6a..d0283ced 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -6,6 +6,8 @@ RUN tar -xvjf /tmp/*.tar.bz2 -C /var/www/html/ && \ # Add the application configuration files COPY config/legacy/parameters.yaml.dist config/legacy/parameters.yaml COPY config/legacy/samlstepupproviders_parameters.yaml.dist config/legacy/samlstepupproviders_parameters.yaml +COPY config/packages/prod/monolog.yaml.docker config/packages/prod/monolog.yaml + # Add the config files for Apache2 RUN rm -rf /etc/apache2/sites-enabled/* From 66298e0644d847a0684c7c8eeed0404f4d31354b Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Wed, 6 Sep 2023 13:41:23 +0200 Subject: [PATCH 008/202] Rename loa's to a more standard name --- config/legacy/parameters.yaml.dist | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/legacy/parameters.yaml.dist b/config/legacy/parameters.yaml.dist index d1be76e1..36419875 100644 --- a/config/legacy/parameters.yaml.dist +++ b/config/legacy/parameters.yaml.dist @@ -35,7 +35,7 @@ parameters: saml_remote_idp_entity_id: https://gateway.dev.openconext.local/authentication/metadata saml_remote_idp_sso_url: https://gateway.dev.openconext.local/authentication/single-sign-on saml_remote_idp_certificate: 'MIIDwTCCAqmgAwIBAgIUYuSUugwc4J4NyW9WGqYJ/liwM4owDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCTkwxEDAOBgNVBAgMB1V0cmVjaHQxEDAOBgNVBAcMB1V0cmVjaHQxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDEUMBIGA1UEAwwLR2F0ZXdheSBJRFAwHhcNMjMwNTE3MTIxNTEyWhcNMzMwNTE0MTIxNTEyWjBwMQswCQYDVQQGEwJOTDEQMA4GA1UECAwHVXRyZWNodDEQMA4GA1UEBwwHVXRyZWNodDEnMCUGA1UECgweRGV2ZWxvcG1lbnQgRG9ja2VyIGVudmlyb25tZW50MRQwEgYDVQQDDAtHYXRld2F5IElEUDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM2ulQVs5WpbJOAf7Cv/VPDTJqbWHVdUxAmdwZJlcNTRKNFVp4aJzQ3dpiyiGghI5odnzU0/BWBoHZFNYPU/OFr/gzn6iJGxL63L9+mFgE8PR9HpkV5TaRnr21+nZ0EXWjDZk9Px0enERicCItTeQzAUJeA0A9miIcK5IKIz/zSBSR3c802SGD/VelUqY7Z2/UJM97cT92L+4Fz+4zhxxoThbPbrR0CweiROIt82grdwg7zf0+b62MOuVtqFh0yPLRAFfLc4LjHuxFUdUvOHVta7x74dwdmHikqfujM10XN+sNns3LDJde2yPWchU6ktq7cjgbYfIW/vzVzafP1Jk40CAwEAAaNTMFEwHQYDVR0OBBYEFGYn6LWRDZa7+YryUncIlwJB2VorMB8GA1UdIwQYMBaAFGYn6LWRDZa7+YryUncIlwJB2VorMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJ57lcOF6PWWW56mS2s5gKFImtfRFzlfiyHsF14L7+nQ5NjfOhpU0wRpnTjK91KP0wCwlxzGFXR8yfqfBFJryIV7aDdYPH/RIkwVaNBI0fsD/ozlYb18seieDEGLvQtTlrmc0UNHtWz6FW3L2geM3ENaqpOATl1Ywp4EPML7Dh0CbhhyM8PnPCEsdclouIeP5/B9Swfk3omXehof6bkFbntqA03msFBiW50twkfKeKULcJGXo667hto27KNxZUauqtPbnAGpUQmge8nxSQlN8RPwlvygVM4LVMF9qP9YxloTH0xVNwN4noZUhfMNsKoJ7Hg5Xulaok8oCqmzEiSroEg=' - loa_required_for_login: 'https://dev.openconext.local/authentication/loa3' + loa_required_for_login: 'http://dev.openconext.local/assurance/loa3' enabled_second_factors: - sms - yubikey @@ -55,10 +55,10 @@ parameters: asset_version: 1 - stepup_loa_loa1: https://dev.openconext.local/authentication/loa1 - stepup_loa_loa2: https://dev.openconext.local/authentication/loa2 - stepup_loa_loa3: https://dev.openconext.local/authentication/loa3 - stepup_loa_self_asserted: 'https://dev.openconext.local/assurance/loa1.5' + stepup_loa_loa1: http://dev.openconext.local/assurance/loa1 + stepup_loa_loa2: http://dev.openconext.local/assurance/loa2 + stepup_loa_loa3: http://dev.openconext.local/assurance/loa3 + stepup_loa_self_asserted: 'http://dev.openconext.local/assurance/loa1.5' logout_redirect_url: nl_NL: https://www.surf.nl/over-surf/werkmaatschappijen/surfnet From 8c3958a0a7ebfa06edd70609ecd6464770c8afbb Mon Sep 17 00:00:00 2001 From: Peter Havekes Date: Fri, 27 Oct 2023 09:48:48 +0200 Subject: [PATCH 009/202] Add repo name to slack notification --- .github/workflows/daily-security-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily-security-check.yml b/.github/workflows/daily-security-check.yml index 36b2deb8..51d7d58b 100644 --- a/.github/workflows/daily-security-check.yml +++ b/.github/workflows/daily-security-check.yml @@ -97,6 +97,6 @@ jobs: SLACK_COLOR: ${{ job.status }} SLACK_ICON: https://static.surfconext.nl/logos/idp/surfnet.png SLACK_MESSAGE: 'Dependency check failed :crying_cat_face:' - SLACK_TITLE: Dependency check wants attention + SLACK_TITLE: ${{ github.repository }} wants attention SLACK_USERNAME: NightlySecurityCheck SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file From 71ccc3c7b8dee697a6fa390d9c733bf77f279ef3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 12 Nov 2023 16:17:46 +0000 Subject: [PATCH 010/202] Bump symfony/twig-bridge from 4.4.49 to 4.4.51 Bumps [symfony/twig-bridge](https://github.com/symfony/twig-bridge) from 4.4.49 to 4.4.51. - [Release notes](https://github.com/symfony/twig-bridge/releases) - [Changelog](https://github.com/symfony/twig-bridge/blob/6.3/CHANGELOG.md) - [Commits](https://github.com/symfony/twig-bridge/compare/v4.4.49...v4.4.51) --- updated-dependencies: - dependency-name: symfony/twig-bridge dependency-type: indirect ... Signed-off-by: dependabot[bot] --- composer.lock | 82 +++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/composer.lock b/composer.lock index 11bd1f89..4f19ab7c 100644 --- a/composer.lock +++ b/composer.lock @@ -4479,16 +4479,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -4503,7 +4503,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4541,7 +4541,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -4557,7 +4557,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-icu", @@ -4819,16 +4819,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -4843,7 +4843,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4882,7 +4882,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -4898,20 +4898,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", "shasum": "" }, "require": { @@ -4920,7 +4920,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4958,7 +4958,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" }, "funding": [ { @@ -4974,7 +4974,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php73", @@ -5057,16 +5057,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -5075,7 +5075,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5120,7 +5120,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -5136,7 +5136,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php81", @@ -6106,16 +6106,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v4.4.49", + "version": "v4.4.51", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113" + "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113", - "reference": "d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/83b021cd395053ed30327b9ee5d3fd60631f73f5", + "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5", "shasum": "" }, "require": { @@ -6203,7 +6203,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v4.4.49" + "source": "https://github.com/symfony/twig-bridge/tree/v4.4.51" }, "funding": [ { @@ -6219,7 +6219,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T09:41:56+00:00" + "time": "2023-11-09T21:17:38+00:00" }, { "name": "symfony/twig-bundle", @@ -6917,16 +6917,16 @@ }, { "name": "twig/twig", - "version": "v2.15.3", + "version": "v2.15.5", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "ab402673db8746cb3a4c46f3869d6253699f614a" + "reference": "fc02a6af3eeb97c4bf5650debc76c2eda85ac22e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ab402673db8746cb3a4c46f3869d6253699f614a", - "reference": "ab402673db8746cb3a4c46f3869d6253699f614a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/fc02a6af3eeb97c4bf5650debc76c2eda85ac22e", + "reference": "fc02a6af3eeb97c4bf5650debc76c2eda85ac22e", "shasum": "" }, "require": { @@ -6981,7 +6981,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.15.3" + "source": "https://github.com/twigphp/Twig/tree/v2.15.5" }, "funding": [ { @@ -6993,7 +6993,7 @@ "type": "tidelift" } ], - "time": "2022-09-28T08:40:08+00:00" + "time": "2023-05-03T17:49:41+00:00" }, { "name": "ua-parser/uap-php", @@ -9923,5 +9923,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 6a93a99554075fc5a5253651cfe689bd553c2969 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 23 Oct 2023 20:35:38 +0200 Subject: [PATCH 011/202] Fix unit tests Tests started failing since yesterday: ``` yarn install v1.22.19 info No lockfile found. [1/4] Resolving packages... warning @symfony/webpack-encore > webpack-dev-server > webpack-dev-middleware > memfs@3.6.0: this will be v4 [2/4] Fetching packages... error @symfony/webpack-encore@4.5.0: The engine "node" is incompatible with this module. Expected version ">=16.0.0". Got "14.21.2" ``` I was able to trace to issue back to a new release of webpack-encore: https://github.com/symfony/webpack-encore/releases/tag/v4.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d4f2a87..aaba548b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "devDependencies": { "@babel/core": "^7.20.5", "@babel/preset-env": "^7.20.2", - "@symfony/webpack-encore": "^4", + "@symfony/webpack-encore": "^4 <4.5", "bootstrap-less": "^3.3.8", "core-js": "^3.0.0", "font-awesome": "^4.7.0", From 399245bc162a5a1d73d5949389970ab34a2495f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:20:01 +0000 Subject: [PATCH 012/202] Bump phpseclib/phpseclib from 3.0.19 to 3.0.34 Bumps [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) from 3.0.19 to 3.0.34. - [Release notes](https://github.com/phpseclib/phpseclib/releases) - [Changelog](https://github.com/phpseclib/phpseclib/blob/master/CHANGELOG.md) - [Commits](https://github.com/phpseclib/phpseclib/compare/3.0.19...3.0.34) --- updated-dependencies: - dependency-name: phpseclib/phpseclib dependency-type: indirect ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4f19ab7c..60d836f5 100644 --- a/composer.lock +++ b/composer.lock @@ -1440,16 +1440,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.19", + "version": "3.0.34", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "cc181005cf548bfd8a4896383bb825d859259f95" + "reference": "56c79f16a6ae17e42089c06a2144467acc35348a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cc181005cf548bfd8a4896383bb825d859259f95", - "reference": "cc181005cf548bfd8a4896383bb825d859259f95", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/56c79f16a6ae17e42089c06a2144467acc35348a", + "reference": "56c79f16a6ae17e42089c06a2144467acc35348a", "shasum": "" }, "require": { @@ -1530,7 +1530,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.19" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.34" }, "funding": [ { @@ -1546,7 +1546,7 @@ "type": "tidelift" } ], - "time": "2023-03-05T17:13:09+00:00" + "time": "2023-11-27T11:13:31+00:00" }, { "name": "psr/cache", From 580f29e7b990dcf01955f979fd65b5186c8439b1 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 5 Dec 2023 17:42:05 +0200 Subject: [PATCH 013/202] Moving from CMD to ENTRYPOINT --- docker/Dockerfile.dev | 2 +- docker/Dockerfile.prod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 48dcb2dd..fc9c6ee6 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -7,4 +7,4 @@ EXPOSE 80 # Set the default workdir WORKDIR /var/www/html -CMD ["apache2-foreground"] +ENTRYPOINT ["apache2-foreground"] diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index d0283ced..a00b9d4b 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -17,4 +17,4 @@ RUN rm -rf /var/www/html/var/cache/prod && chown -R www-data /var/www/html/var # Set the default workdir WORKDIR /var/www/html -CMD ["apache2-foreground"] +ENTRYPOINT ["apache2-foreground"] From fa6a780e78d548616e949ae9d710ad02633f2ebe Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 6 Dec 2023 18:18:46 +0200 Subject: [PATCH 014/202] Moving back to CMD --- docker/Dockerfile.dev | 2 +- docker/Dockerfile.prod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index fc9c6ee6..48dcb2dd 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -7,4 +7,4 @@ EXPOSE 80 # Set the default workdir WORKDIR /var/www/html -ENTRYPOINT ["apache2-foreground"] +CMD ["apache2-foreground"] diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index a00b9d4b..d0283ced 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -17,4 +17,4 @@ RUN rm -rf /var/www/html/var/cache/prod && chown -R www-data /var/www/html/var # Set the default workdir WORKDIR /var/www/html -ENTRYPOINT ["apache2-foreground"] +CMD ["apache2-foreground"] From c0ddfa028e7e3c4806366020130aaef535586991 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 14 Dec 2023 17:01:12 +0200 Subject: [PATCH 015/202] Removing the dev image --- .github/workflows/build-push-docker-image.yml | 10 ---------- docker/Dockerfile.dev | 10 ---------- 2 files changed, 20 deletions(-) delete mode 100644 docker/Dockerfile.dev diff --git a/.github/workflows/build-push-docker-image.yml b/.github/workflows/build-push-docker-image.yml index 08b89aeb..0a6bf5c7 100644 --- a/.github/workflows/build-push-docker-image.yml +++ b/.github/workflows/build-push-docker-image.yml @@ -46,13 +46,3 @@ jobs: ghcr.io/openconext/stepup-ra/stepup-ra:prod ghcr.io/openconext/stepup-ra/stepup-ra:${{ github.sha }} ghcr.io/openconext/stepup-ra/stepup-ra:${{ steps.release.outputs.tag_name }} - - - name: Build and push the Development image - uses: docker/build-push-action@v4 - with: - context: . - file: docker/Dockerfile.dev - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/openconext/stepup-ra/stepup-ra:dev diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev deleted file mode 100644 index 48dcb2dd..00000000 --- a/docker/Dockerfile.dev +++ /dev/null @@ -1,10 +0,0 @@ -FROM ghcr.io/openconext/openconext-basecontainers/php72-apache2-node14-composer2:latest - -RUN rm -rf /etc/apache2/sites-enabled/* -COPY ./docker/conf/ra-apache2.conf /etc/apache2/sites-enabled/ra.conf -EXPOSE 80 - -# Set the default workdir -WORKDIR /var/www/html - -CMD ["apache2-foreground"] From 778516b0a9cecdaaaa3ba0bcf681f07eebb7f8ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 21:19:36 +0000 Subject: [PATCH 016/202] Bump phpseclib/phpseclib from 3.0.34 to 3.0.37 Bumps [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) from 3.0.34 to 3.0.37. - [Release notes](https://github.com/phpseclib/phpseclib/releases) - [Changelog](https://github.com/phpseclib/phpseclib/blob/master/CHANGELOG.md) - [Commits](https://github.com/phpseclib/phpseclib/compare/3.0.34...3.0.37) --- updated-dependencies: - dependency-name: phpseclib/phpseclib dependency-type: indirect ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 60d836f5..1e706c49 100644 --- a/composer.lock +++ b/composer.lock @@ -1440,16 +1440,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.34", + "version": "3.0.37", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "56c79f16a6ae17e42089c06a2144467acc35348a" + "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/56c79f16a6ae17e42089c06a2144467acc35348a", - "reference": "56c79f16a6ae17e42089c06a2144467acc35348a", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8", + "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8", "shasum": "" }, "require": { @@ -1530,7 +1530,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.34" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.37" }, "funding": [ { @@ -1546,7 +1546,7 @@ "type": "tidelift" } ], - "time": "2023-11-27T11:13:31+00:00" + "time": "2024-03-03T02:14:58+00:00" }, { "name": "psr/cache", From 157cbbc08d5a4839e15df84e38b5662f6a0720cf Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 30 Jan 2024 15:05:03 +0100 Subject: [PATCH 017/202] Update and install - rector - sf/flex 2+ --- composer.json | 5 +- composer.lock | 240 ++- symfony.lock | 12 + yarn.lock | 5006 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 5200 insertions(+), 63 deletions(-) create mode 100644 yarn.lock diff --git a/composer.json b/composer.json index 8a6a0732..8b33e46d 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ }, "minimum-stability": "stable", "require": { - "php": "^7.2", + "php": "^8.2", "fortawesome/font-awesome": "~4.2.0", "guzzlehttp/guzzle": "^6", "incenteev/composer-parameter-handler": "~2.0", @@ -28,7 +28,7 @@ "surfnet/stepup-saml-bundle": "^4.3.2", "symfony/asset": "4.4.*", "symfony/expression-language": "4.4.*", - "symfony/flex": "^1.8", + "symfony/flex": "^v2.4.3", "symfony/form": "4.4.*", "symfony/http-foundation": "^5.0", "symfony/monolog-bundle": "^3.5", @@ -48,6 +48,7 @@ "overtrue/phplint": "^2.3", "phpmd/phpmd": "^2.6", "phpunit/phpunit": "8.5.*", + "rector/rector": "^0.19.5", "sebastian/exporter": "3.1.*", "squizlabs/php_codesniffer": "^3.4", "symfony/dotenv": "4.4.*", diff --git a/composer.lock b/composer.lock index 1e706c49..fd23bacf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fb75cd9d4b7eb5ce84a949820005bd6d", + "content-hash": "229358c4d66e01b03457a809470f1ea5", "packages": [ { "name": "beberlei/assert", @@ -1440,16 +1440,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.37", + "version": "3.0.19", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8" + "reference": "cc181005cf548bfd8a4896383bb825d859259f95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8", - "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cc181005cf548bfd8a4896383bb825d859259f95", + "reference": "cc181005cf548bfd8a4896383bb825d859259f95", "shasum": "" }, "require": { @@ -1530,7 +1530,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.37" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.19" }, "funding": [ { @@ -1546,7 +1546,7 @@ "type": "tidelift" } ], - "time": "2024-03-03T02:14:58+00:00" + "time": "2023-03-05T17:13:09+00:00" }, { "name": "psr/cache", @@ -3367,28 +3367,28 @@ }, { "name": "symfony/flex", - "version": "v1.19.5", + "version": "v2.4.3", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "51077ed0f6dc2c94cd0b670167eee3747c31b2c1" + "reference": "6b44ac75c7f07f48159ec36c2d21ef8cf48a21b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/51077ed0f6dc2c94cd0b670167eee3747c31b2c1", - "reference": "51077ed0f6dc2c94cd0b670167eee3747c31b2c1", + "url": "https://api.github.com/repos/symfony/flex/zipball/6b44ac75c7f07f48159ec36c2d21ef8cf48a21b1", + "reference": "6b44ac75c7f07f48159ec36c2d21ef8cf48a21b1", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0|^2.0", - "php": ">=7.1" + "composer-plugin-api": "^2.1", + "php": ">=8.0" }, "require-dev": { - "composer/composer": "^1.0.2|^2.0", - "symfony/dotenv": "^4.4|^5.0|^6.0", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/phpunit-bridge": "^4.4.12|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0" + "composer/composer": "^2.1", + "symfony/dotenv": "^5.4|^6.0", + "symfony/filesystem": "^5.4|^6.0", + "symfony/phpunit-bridge": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0" }, "type": "composer-plugin", "extra": { @@ -3412,7 +3412,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v1.19.5" + "source": "https://github.com/symfony/flex/tree/v2.4.3" }, "funding": [ { @@ -3428,7 +3428,7 @@ "type": "tidelift" } ], - "time": "2023-01-30T17:02:31+00:00" + "time": "2024-01-02T11:08:32+00:00" }, { "name": "symfony/form", @@ -4479,16 +4479,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -4503,7 +4503,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4541,7 +4541,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -4557,7 +4557,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-icu", @@ -4819,16 +4819,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -4843,7 +4843,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4882,7 +4882,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -4898,20 +4898,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", "shasum": "" }, "require": { @@ -4920,7 +4920,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4958,7 +4958,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" }, "funding": [ { @@ -4974,7 +4974,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", @@ -5057,16 +5057,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -5075,7 +5075,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.28-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5120,7 +5120,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -5136,7 +5136,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php81", @@ -6106,16 +6106,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v4.4.51", + "version": "v4.4.49", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5" + "reference": "d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/83b021cd395053ed30327b9ee5d3fd60631f73f5", - "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113", + "reference": "d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113", "shasum": "" }, "require": { @@ -6203,7 +6203,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v4.4.51" + "source": "https://github.com/symfony/twig-bridge/tree/v4.4.49" }, "funding": [ { @@ -6219,7 +6219,7 @@ "type": "tidelift" } ], - "time": "2023-11-09T21:17:38+00:00" + "time": "2022-11-03T09:41:56+00:00" }, { "name": "symfony/twig-bundle", @@ -6917,16 +6917,16 @@ }, { "name": "twig/twig", - "version": "v2.15.5", + "version": "v2.15.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "fc02a6af3eeb97c4bf5650debc76c2eda85ac22e" + "reference": "ab402673db8746cb3a4c46f3869d6253699f614a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/fc02a6af3eeb97c4bf5650debc76c2eda85ac22e", - "reference": "fc02a6af3eeb97c4bf5650debc76c2eda85ac22e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/ab402673db8746cb3a4c46f3869d6253699f614a", + "reference": "ab402673db8746cb3a4c46f3869d6253699f614a", "shasum": "" }, "require": { @@ -6981,7 +6981,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.15.5" + "source": "https://github.com/twigphp/Twig/tree/v2.15.3" }, "funding": [ { @@ -6993,7 +6993,7 @@ "type": "tidelift" } ], - "time": "2023-05-03T17:49:41+00:00" + "time": "2022-09-28T08:40:08+00:00" }, { "name": "ua-parser/uap-php", @@ -8242,6 +8242,68 @@ }, "time": "2021-12-08T12:19:24+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.57", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2024-01-24T11:51:34+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "7.0.15", @@ -8633,6 +8695,62 @@ ], "time": "2022-06-19T12:11:16+00:00" }, + { + "name": "rector/rector", + "version": "0.19.5", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "89c895d127b9d248d2af007068a824b5348ef81f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", + "reference": "89c895d127b9d248d2af007068a824b5348ef81f", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.56" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.19.5" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2024-01-29T23:53:47+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.2", @@ -9917,7 +10035,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.2" + "php": "^8.2" }, "platform-dev": [], "platform-overrides": { diff --git a/symfony.lock b/symfony.lock index ffc9d8cd..310adfa1 100644 --- a/symfony.lock +++ b/symfony.lock @@ -161,6 +161,18 @@ "phpspec/prophecy": { "version": "v1.10.3" }, + "phpstan/phpstan": { + "version": "1.10", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.0", + "ref": "5e490cc197fb6bb1ae22e5abbc531ddc633b6767" + }, + "files": [ + "phpstan.dist.neon" + ] + }, "phpunit/php-code-coverage": { "version": "7.0.10" }, diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000..6eb05c9c --- /dev/null +++ b/yarn.lock @@ -0,0 +1,5006 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ampproject/remapping@^2.2.0": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" + integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@babel/code-frame@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" + integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== + dependencies: + "@babel/highlight" "^7.23.4" + chalk "^2.4.2" + +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.23.3", "@babel/compat-data@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" + integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== + +"@babel/core@^7.20.5": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.9.tgz#b028820718000f267870822fec434820e9b1e4d1" + integrity sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-compilation-targets" "^7.23.6" + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helpers" "^7.23.9" + "@babel/parser" "^7.23.9" + "@babel/template" "^7.23.9" + "@babel/traverse" "^7.23.9" + "@babel/types" "^7.23.9" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" + integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== + dependencies: + "@babel/types" "^7.23.6" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + +"@babel/helper-annotate-as-pure@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz#e7f06737b197d580a01edf75d97e2c8be99d3882" + integrity sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz#5426b109cf3ad47b91120f8328d8ab1be8b0b956" + integrity sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw== + dependencies: + "@babel/types" "^7.22.15" + +"@babel/helper-compilation-targets@^7.22.15", "@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" + integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== + dependencies: + "@babel/compat-data" "^7.23.5" + "@babel/helper-validator-option" "^7.23.5" + browserslist "^4.22.2" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-create-class-features-plugin@^7.22.15": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.9.tgz#fddfdf51fca28f23d16b9e3935a4732690acfad6" + integrity sha512-B2L9neXTIyPQoXDm+NtovPvG6VOLWnaXu3BIeVDWwdKFgG30oNa6CqVGiJPDWQwIAK49t9gnQI9c6K6RzabiKw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-member-expression-to-functions" "^7.23.0" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + semver "^6.3.1" + +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.22.15", "@babel/helper-create-regexp-features-plugin@^7.22.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz#5ee90093914ea09639b01c711db0d6775e558be1" + integrity sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + regexpu-core "^5.3.1" + semver "^6.3.1" + +"@babel/helper-define-polyfill-provider@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.5.0.tgz#465805b7361f461e86c680f1de21eaf88c25901b" + integrity sha512-NovQquuQLAQ5HuyjCz7WQP9MjRj7dx++yspwiyUiGl9ZyadHRSql1HZh5ogRd8W8w6YM6EQ/NTB8rgjLt5W65Q== + dependencies: + "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-plugin-utils" "^7.22.5" + debug "^4.1.1" + lodash.debounce "^4.0.8" + resolve "^1.14.2" + +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + +"@babel/helper-function-name@^7.22.5", "@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-member-expression-to-functions@^7.22.15", "@babel/helper-member-expression-to-functions@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz#9263e88cc5e41d39ec18c9a3e0eced59a3e7d366" + integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== + dependencies: + "@babel/types" "^7.23.0" + +"@babel/helper-module-imports@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" + integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== + dependencies: + "@babel/types" "^7.22.15" + +"@babel/helper-module-transforms@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" + integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== + dependencies: + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-module-imports" "^7.22.15" + "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/helper-validator-identifier" "^7.22.20" + +"@babel/helper-optimise-call-expression@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz#f21531a9ccbff644fdd156b4077c16ff0c3f609e" + integrity sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" + integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== + +"@babel/helper-remap-async-to-generator@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.20.tgz#7b68e1cb4fa964d2996fd063723fb48eca8498e0" + integrity sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-wrap-function" "^7.22.20" + +"@babel/helper-replace-supers@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz#e37d367123ca98fe455a9887734ed2e16eb7a793" + integrity sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw== + dependencies: + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-member-expression-to-functions" "^7.22.15" + "@babel/helper-optimise-call-expression" "^7.22.5" + +"@babel/helper-simple-access@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" + integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-skip-transparent-expression-wrappers@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz#007f15240b5751c537c40e77abb4e89eeaaa8847" + integrity sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-string-parser@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" + integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== + +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + +"@babel/helper-validator-option@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" + integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== + +"@babel/helper-wrap-function@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.20.tgz#15352b0b9bfb10fc9c76f79f6342c00e3411a569" + integrity sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw== + dependencies: + "@babel/helper-function-name" "^7.22.5" + "@babel/template" "^7.22.15" + "@babel/types" "^7.22.19" + +"@babel/helpers@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.9.tgz#c3e20bbe7f7a7e10cb9b178384b4affdf5995c7d" + integrity sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ== + dependencies: + "@babel/template" "^7.23.9" + "@babel/traverse" "^7.23.9" + "@babel/types" "^7.23.9" + +"@babel/highlight@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" + integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.23.9", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.9.tgz#7b903b6149b0f8fa7ad564af646c4c38a77fc44b" + integrity sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA== + +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.23.3.tgz#5cd1c87ba9380d0afb78469292c954fee5d2411a" + integrity sha512-iRkKcCqb7iGnq9+3G6rZ+Ciz5VywC4XNRHe57lKM+jOeYAoR0lVqdeeDRfh0tQcTfw/+vBhHn926FmQhLtlFLQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.23.3.tgz#f6652bb16b94f8f9c20c50941e16e9756898dc5d" + integrity sha512-WwlxbfMNdVEpQjZmK5mhm7oSwD3dS6eU+Iwsi4Knl9wAletWem7kaRsGOG+8UEbRyqxY4SS5zvtfXwX+jMxUwQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/plugin-transform-optional-chaining" "^7.23.3" + +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.23.7": + version "7.23.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.23.7.tgz#516462a95d10a9618f197d39ad291a9b47ae1d7b" + integrity sha512-LlRT7HgaifEpQA1ZgLVOIJZZFVPWN5iReq/7/JixwBtwcoeVGDBD53ZV28rrsLYOZs1Y/EHhA8N/Z6aazHR8cw== + dependencies: + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": + version "7.21.0-placeholder-for-preset-env.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703" + integrity sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w== + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-class-static-block@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" + integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-dynamic-import@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" + integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-export-namespace-from@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz#028964a9ba80dbc094c915c487ad7c4e7a66465a" + integrity sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-syntax-import-assertions@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.23.3.tgz#9c05a7f592982aff1a2768260ad84bcd3f0c77fc" + integrity sha512-lPgDSU+SJLK3xmFDTV2ZRQAiM7UuUjGidwBywFavObCiZc1BeAAcMtHJKUya92hPHO+at63JJPLygilZard8jw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-syntax-import-attributes@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.23.3.tgz#992aee922cf04512461d7dae3ff6951b90a2dc06" + integrity sha512-pawnE0P9g10xgoP7yKr6CK63K2FMsTE+FZidZO/1PwRdzmAPVs+HS1mAURUsgaoxammTJvULUdIkEK0gOcU2tA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-syntax-import-meta@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-private-property-in-object@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" + integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-top-level-await@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-unicode-sets-regex@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz#d49a3b3e6b52e5be6740022317580234a6a47357" + integrity sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + +"@babel/plugin-transform-arrow-functions@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.23.3.tgz#94c6dcfd731af90f27a79509f9ab7fb2120fc38b" + integrity sha512-NzQcQrzaQPkaEwoTm4Mhyl8jI1huEL/WWIEvudjTCMJ9aBZNpsJbMASx7EQECtQQPS/DcnFpo0FIh3LvEO9cxQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-async-generator-functions@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.23.9.tgz#9adaeb66fc9634a586c5df139c6240d41ed801ce" + integrity sha512-8Q3veQEDGe14dTYuwagbRtwxQDnytyg1JFu4/HwEMETeofocrB0U0ejBJIXoeG/t2oXZ8kzCyI0ZZfbT80VFNQ== + dependencies: + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-remap-async-to-generator" "^7.22.20" + "@babel/plugin-syntax-async-generators" "^7.8.4" + +"@babel/plugin-transform-async-to-generator@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.23.3.tgz#d1f513c7a8a506d43f47df2bf25f9254b0b051fa" + integrity sha512-A7LFsKi4U4fomjqXJlZg/u0ft/n8/7n7lpffUP/ZULx/DtV9SGlNKZolHH6PE8Xl1ngCc0M11OaeZptXVkfKSw== + dependencies: + "@babel/helper-module-imports" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-remap-async-to-generator" "^7.22.20" + +"@babel/plugin-transform-block-scoped-functions@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.23.3.tgz#fe1177d715fb569663095e04f3598525d98e8c77" + integrity sha512-vI+0sIaPIO6CNuM9Kk5VmXcMVRiOpDh7w2zZt9GXzmE/9KD70CUEVhvPR/etAeNK/FAEkhxQtXOzVF3EuRL41A== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-block-scoping@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.23.4.tgz#b2d38589531c6c80fbe25e6b58e763622d2d3cf5" + integrity sha512-0QqbP6B6HOh7/8iNR4CQU2Th/bbRtBp4KS9vcaZd1fZ0wSh5Fyssg0UCIHwxh+ka+pNDREbVLQnHCMHKZfPwfw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-class-properties@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.23.3.tgz#35c377db11ca92a785a718b6aa4e3ed1eb65dc48" + integrity sha512-uM+AN8yCIjDPccsKGlw271xjJtGii+xQIF/uMPS8H15L12jZTsLfF4o5vNO7d/oUguOyfdikHGc/yi9ge4SGIg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-class-static-block@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.23.4.tgz#2a202c8787a8964dd11dfcedf994d36bfc844ab5" + integrity sha512-nsWu/1M+ggti1SOALj3hfx5FXzAY06fwPJsUZD4/A5e1bWi46VUIWtD+kOX6/IdhXGsXBWllLFDSnqSCdUNydQ== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + +"@babel/plugin-transform-classes@^7.23.8": + version "7.23.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.8.tgz#d08ae096c240347badd68cdf1b6d1624a6435d92" + integrity sha512-yAYslGsY1bX6Knmg46RjiCiNSwJKv2IUC8qOdYKqMMr0491SXFhcHqOdRDeCRohOOIzwN/90C6mQ9qAKgrP7dg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-compilation-targets" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + "@babel/helper-split-export-declaration" "^7.22.6" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.23.3.tgz#652e69561fcc9d2b50ba4f7ac7f60dcf65e86474" + integrity sha512-dTj83UVTLw/+nbiHqQSFdwO9CbTtwq1DsDqm3CUEtDrZNET5rT5E6bIdTlOftDTDLMYxvxHNEYO4B9SLl8SLZw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/template" "^7.22.15" + +"@babel/plugin-transform-destructuring@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.23.3.tgz#8c9ee68228b12ae3dff986e56ed1ba4f3c446311" + integrity sha512-n225npDqjDIr967cMScVKHXJs7rout1q+tt50inyBCPkyZ8KxeI6d+GIbSBTT/w/9WdlWDOej3V9HE5Lgk57gw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-dotall-regex@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.23.3.tgz#3f7af6054882ede89c378d0cf889b854a993da50" + integrity sha512-vgnFYDHAKzFaTVp+mneDsIEbnJ2Np/9ng9iviHw3P/KVcgONxpNULEW/51Z/BaFojG2GI2GwwXck5uV1+1NOYQ== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-duplicate-keys@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.23.3.tgz#664706ca0a5dfe8d066537f99032fc1dc8b720ce" + integrity sha512-RrqQ+BQmU3Oyav3J+7/myfvRCq7Tbz+kKLLshUmMwNlDHExbGL7ARhajvoBJEvc+fCguPPu887N+3RRXBVKZUA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-dynamic-import@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.23.4.tgz#c7629e7254011ac3630d47d7f34ddd40ca535143" + integrity sha512-V6jIbLhdJK86MaLh4Jpghi8ho5fGzt3imHOBu/x0jlBaPYqDoWz4RDXjmMOfnh+JWNaQleEAByZLV0QzBT4YQQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-dynamic-import" "^7.8.3" + +"@babel/plugin-transform-exponentiation-operator@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.23.3.tgz#ea0d978f6b9232ba4722f3dbecdd18f450babd18" + integrity sha512-5fhCsl1odX96u7ILKHBj4/Y8vipoqwsJMh4csSA8qFfxrZDEA4Ssku2DyNvMJSmZNOEBT750LfFPbtrnTP90BQ== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-export-namespace-from@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.23.4.tgz#084c7b25e9a5c8271e987a08cf85807b80283191" + integrity sha512-GzuSBcKkx62dGzZI1WVgTWvkkz84FZO5TC5T8dl/Tht/rAla6Dg/Mz9Yhypg+ezVACf/rgDuQt3kbWEv7LdUDQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-export-namespace-from" "^7.8.3" + +"@babel/plugin-transform-for-of@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.23.6.tgz#81c37e24171b37b370ba6aaffa7ac86bcb46f94e" + integrity sha512-aYH4ytZ0qSuBbpfhuofbg/e96oQ7U2w1Aw/UQmKT+1l39uEhUPoFS3fHevDc1G0OvewyDudfMKY1OulczHzWIw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + +"@babel/plugin-transform-function-name@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.23.3.tgz#8f424fcd862bf84cb9a1a6b42bc2f47ed630f8dc" + integrity sha512-I1QXp1LxIvt8yLaib49dRW5Okt7Q4oaxao6tFVKS/anCdEOMtYwWVKoiOA1p34GOWIZjUK0E+zCp7+l1pfQyiw== + dependencies: + "@babel/helper-compilation-targets" "^7.22.15" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-json-strings@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.23.4.tgz#a871d9b6bd171976efad2e43e694c961ffa3714d" + integrity sha512-81nTOqM1dMwZ/aRXQ59zVubN9wHGqk6UtqRK+/q+ciXmRy8fSolhGVvG09HHRGo4l6fr/c4ZhXUQH0uFW7PZbg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-json-strings" "^7.8.3" + +"@babel/plugin-transform-literals@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.23.3.tgz#8214665f00506ead73de157eba233e7381f3beb4" + integrity sha512-wZ0PIXRxnwZvl9AYpqNUxpZ5BiTGrYt7kueGQ+N5FiQ7RCOD4cm8iShd6S6ggfVIWaJf2EMk8eRzAh52RfP4rQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-logical-assignment-operators@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.23.4.tgz#e599f82c51d55fac725f62ce55d3a0886279ecb5" + integrity sha512-Mc/ALf1rmZTP4JKKEhUwiORU+vcfarFVLfcFiolKUo6sewoxSEgl36ak5t+4WamRsNr6nzjZXQjM35WsU+9vbg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + +"@babel/plugin-transform-member-expression-literals@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.23.3.tgz#e37b3f0502289f477ac0e776b05a833d853cabcc" + integrity sha512-sC3LdDBDi5x96LA+Ytekz2ZPk8i/Ck+DEuDbRAll5rknJ5XRTSaPKEYwomLcs1AA8wg9b3KjIQRsnApj+q51Ag== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-modules-amd@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.23.3.tgz#e19b55436a1416829df0a1afc495deedfae17f7d" + integrity sha512-vJYQGxeKM4t8hYCKVBlZX/gtIY2I7mRGFNcm85sgXGMTBcoV3QdVtdpbcWEbzbfUIUZKwvgFT82mRvaQIebZzw== + dependencies: + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-modules-commonjs@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.3.tgz#661ae831b9577e52be57dd8356b734f9700b53b4" + integrity sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA== + dependencies: + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-simple-access" "^7.22.5" + +"@babel/plugin-transform-modules-systemjs@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.23.9.tgz#105d3ed46e4a21d257f83a2f9e2ee4203ceda6be" + integrity sha512-KDlPRM6sLo4o1FkiSlXoAa8edLXFsKKIda779fbLrvmeuc3itnjCtaO6RrtoaANsIJANj+Vk1zqbZIMhkCAHVw== + dependencies: + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + +"@babel/plugin-transform-modules-umd@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.23.3.tgz#5d4395fccd071dfefe6585a4411aa7d6b7d769e9" + integrity sha512-zHsy9iXX2nIsCBFPud3jKn1IRPWg3Ing1qOZgeKV39m1ZgIdpJqvlWVeiHBZC6ITRG0MfskhYe9cLgntfSFPIg== + dependencies: + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.22.5.tgz#67fe18ee8ce02d57c855185e27e3dc959b2e991f" + integrity sha512-YgLLKmS3aUBhHaxp5hi1WJTgOUb/NCuDHzGT9z9WTt3YG+CPRhJs6nprbStx6DnWM4dh6gt7SU3sZodbZ08adQ== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.22.5" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-new-target@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.23.3.tgz#5491bb78ed6ac87e990957cea367eab781c4d980" + integrity sha512-YJ3xKqtJMAT5/TIZnpAR3I+K+WaDowYbN3xyxI8zxx/Gsypwf9B9h0VB+1Nh6ACAAPRS5NSRje0uVv5i79HYGQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-nullish-coalescing-operator@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.23.4.tgz#45556aad123fc6e52189ea749e33ce090637346e" + integrity sha512-jHE9EVVqHKAQx+VePv5LLGHjmHSJR76vawFPTdlxR/LVJPfOEGxREQwQfjuZEOPTwG92X3LINSh3M40Rv4zpVA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + +"@babel/plugin-transform-numeric-separator@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.23.4.tgz#03d08e3691e405804ecdd19dd278a40cca531f29" + integrity sha512-mps6auzgwjRrwKEZA05cOwuDc9FAzoyFS4ZsG/8F43bTLf/TgkJg7QXOrPO1JO599iA3qgK9MXdMGOEC8O1h6Q== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + +"@babel/plugin-transform-object-rest-spread@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz#2b9c2d26bf62710460bdc0d1730d4f1048361b83" + integrity sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g== + dependencies: + "@babel/compat-data" "^7.23.3" + "@babel/helper-compilation-targets" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.23.3" + +"@babel/plugin-transform-object-super@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.23.3.tgz#81fdb636dcb306dd2e4e8fd80db5b2362ed2ebcd" + integrity sha512-BwQ8q0x2JG+3lxCVFohg+KbQM7plfpBwThdW9A6TMtWwLsbDA01Ek2Zb/AgDN39BiZsExm4qrXxjk+P1/fzGrA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + +"@babel/plugin-transform-optional-catch-binding@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.23.4.tgz#318066de6dacce7d92fa244ae475aa8d91778017" + integrity sha512-XIq8t0rJPHf6Wvmbn9nFxU6ao4c7WhghTR5WyV8SrJfUFzyxhCm4nhC+iAp3HFhbAKLfYpgzhJ6t4XCtVwqO5A== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + +"@babel/plugin-transform-optional-chaining@^7.23.3", "@babel/plugin-transform-optional-chaining@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.23.4.tgz#6acf61203bdfc4de9d4e52e64490aeb3e52bd017" + integrity sha512-ZU8y5zWOfjM5vZ+asjgAPwDaBjJzgufjES89Rs4Lpq63O300R/kOz30WCLo6BxxX6QVEilwSlpClnG5cZaikTA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + +"@babel/plugin-transform-parameters@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.23.3.tgz#83ef5d1baf4b1072fa6e54b2b0999a7b2527e2af" + integrity sha512-09lMt6UsUb3/34BbECKVbVwrT9bO6lILWln237z7sLaWnMsTi7Yc9fhX5DLpkJzAGfaReXI22wP41SZmnAA3Vw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-private-methods@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.23.3.tgz#b2d7a3c97e278bfe59137a978d53b2c2e038c0e4" + integrity sha512-UzqRcRtWsDMTLrRWFvUBDwmw06tCQH9Rl1uAjfh6ijMSmGYQ+fpdB+cnqRC8EMh5tuuxSv0/TejGL+7vyj+50g== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-private-property-in-object@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.23.4.tgz#3ec711d05d6608fd173d9b8de39872d8dbf68bf5" + integrity sha512-9G3K1YqTq3F4Vt88Djx1UZ79PDyj+yKRnUy7cZGSMe+a7jkwD259uKKuUzQlPkGam7R+8RJwh5z4xO27fA1o2A== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-create-class-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + +"@babel/plugin-transform-property-literals@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.23.3.tgz#54518f14ac4755d22b92162e4a852d308a560875" + integrity sha512-jR3Jn3y7cZp4oEWPFAlRsSWjxKe4PZILGBSd4nis1TsC5qeSpb+nrtihJuDhNI7QHiVbUaiXa0X2RZY3/TI6Nw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-regenerator@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.23.3.tgz#141afd4a2057298602069fce7f2dc5173e6c561c" + integrity sha512-KP+75h0KghBMcVpuKisx3XTu9Ncut8Q8TuvGO4IhY+9D5DFEckQefOuIsB/gQ2tG71lCke4NMrtIPS8pOj18BQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + regenerator-transform "^0.15.2" + +"@babel/plugin-transform-reserved-words@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.23.3.tgz#4130dcee12bd3dd5705c587947eb715da12efac8" + integrity sha512-QnNTazY54YqgGxwIexMZva9gqbPa15t/x9VS+0fsEFWplwVpXYZivtgl43Z1vMpc1bdPP2PP8siFeVcnFvA3Cg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-shorthand-properties@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.23.3.tgz#97d82a39b0e0c24f8a981568a8ed851745f59210" + integrity sha512-ED2fgqZLmexWiN+YNFX26fx4gh5qHDhn1O2gvEhreLW2iI63Sqm4llRLCXALKrCnbN4Jy0VcMQZl/SAzqug/jg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-spread@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.23.3.tgz#41d17aacb12bde55168403c6f2d6bdca563d362c" + integrity sha512-VvfVYlrlBVu+77xVTOAoxQ6mZbnIq5FM0aGBSFEcIh03qHf+zNqA4DC/3XMUozTg7bZV3e3mZQ0i13VB6v5yUg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + +"@babel/plugin-transform-sticky-regex@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.23.3.tgz#dec45588ab4a723cb579c609b294a3d1bd22ff04" + integrity sha512-HZOyN9g+rtvnOU3Yh7kSxXrKbzgrm5X4GncPY1QOquu7epga5MxKHVpYu2hvQnry/H+JjckSYRb93iNfsioAGg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-template-literals@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.23.3.tgz#5f0f028eb14e50b5d0f76be57f90045757539d07" + integrity sha512-Flok06AYNp7GV2oJPZZcP9vZdszev6vPBkHLwxwSpaIqx75wn6mUd3UFWsSsA0l8nXAKkyCmL/sR02m8RYGeHg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-typeof-symbol@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.23.3.tgz#9dfab97acc87495c0c449014eb9c547d8966bca4" + integrity sha512-4t15ViVnaFdrPC74be1gXBSMzXk3B4Us9lP7uLRQHTFpV5Dvt33pn+2MyyNxmN3VTTm3oTrZVMUmuw3oBnQ2oQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-unicode-escapes@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.23.3.tgz#1f66d16cab01fab98d784867d24f70c1ca65b925" + integrity sha512-OMCUx/bU6ChE3r4+ZdylEqAjaQgHAgipgW8nsCfu5pGqDcFytVd91AwRvUJSBZDz0exPGgnjoqhgRYLRjFZc9Q== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-unicode-property-regex@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.23.3.tgz#19e234129e5ffa7205010feec0d94c251083d7ad" + integrity sha512-KcLIm+pDZkWZQAFJ9pdfmh89EwVfmNovFBcXko8szpBeF8z68kWIPeKlmSOkT9BXJxs2C0uk+5LxoxIv62MROA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-unicode-regex@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.23.3.tgz#26897708d8f42654ca4ce1b73e96140fbad879dc" + integrity sha512-wMHpNA4x2cIA32b/ci3AfwNgheiva2W0WUKWTK7vBHBhDKfPsc5cFGNWm69WBqpwd86u1qwZ9PWevKqm1A3yAw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-unicode-sets-regex@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.23.3.tgz#4fb6f0a719c2c5859d11f6b55a050cc987f3799e" + integrity sha512-W7lliA/v9bNR83Qc3q1ip9CQMZ09CcHDbHfbLRDNuAhn1Mvkr1ZNF7hPmztMQvtTGVLJ9m8IZqWsTkXOml8dbw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/preset-env@^7.20.2": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.23.9.tgz#beace3b7994560ed6bf78e4ae2073dff45387669" + integrity sha512-3kBGTNBBk9DQiPoXYS0g0BYlwTQYUTifqgKTjxUwEUkduRT2QOa0FPGBJ+NROQhGyYO5BuTJwGvBnqKDykac6A== + dependencies: + "@babel/compat-data" "^7.23.5" + "@babel/helper-compilation-targets" "^7.23.6" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-validator-option" "^7.23.5" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.23.3" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.23.3" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.23.7" + "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-dynamic-import" "^7.8.3" + "@babel/plugin-syntax-export-namespace-from" "^7.8.3" + "@babel/plugin-syntax-import-assertions" "^7.23.3" + "@babel/plugin-syntax-import-attributes" "^7.23.3" + "@babel/plugin-syntax-import-meta" "^7.10.4" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" + "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" + "@babel/plugin-transform-arrow-functions" "^7.23.3" + "@babel/plugin-transform-async-generator-functions" "^7.23.9" + "@babel/plugin-transform-async-to-generator" "^7.23.3" + "@babel/plugin-transform-block-scoped-functions" "^7.23.3" + "@babel/plugin-transform-block-scoping" "^7.23.4" + "@babel/plugin-transform-class-properties" "^7.23.3" + "@babel/plugin-transform-class-static-block" "^7.23.4" + "@babel/plugin-transform-classes" "^7.23.8" + "@babel/plugin-transform-computed-properties" "^7.23.3" + "@babel/plugin-transform-destructuring" "^7.23.3" + "@babel/plugin-transform-dotall-regex" "^7.23.3" + "@babel/plugin-transform-duplicate-keys" "^7.23.3" + "@babel/plugin-transform-dynamic-import" "^7.23.4" + "@babel/plugin-transform-exponentiation-operator" "^7.23.3" + "@babel/plugin-transform-export-namespace-from" "^7.23.4" + "@babel/plugin-transform-for-of" "^7.23.6" + "@babel/plugin-transform-function-name" "^7.23.3" + "@babel/plugin-transform-json-strings" "^7.23.4" + "@babel/plugin-transform-literals" "^7.23.3" + "@babel/plugin-transform-logical-assignment-operators" "^7.23.4" + "@babel/plugin-transform-member-expression-literals" "^7.23.3" + "@babel/plugin-transform-modules-amd" "^7.23.3" + "@babel/plugin-transform-modules-commonjs" "^7.23.3" + "@babel/plugin-transform-modules-systemjs" "^7.23.9" + "@babel/plugin-transform-modules-umd" "^7.23.3" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.22.5" + "@babel/plugin-transform-new-target" "^7.23.3" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.23.4" + "@babel/plugin-transform-numeric-separator" "^7.23.4" + "@babel/plugin-transform-object-rest-spread" "^7.23.4" + "@babel/plugin-transform-object-super" "^7.23.3" + "@babel/plugin-transform-optional-catch-binding" "^7.23.4" + "@babel/plugin-transform-optional-chaining" "^7.23.4" + "@babel/plugin-transform-parameters" "^7.23.3" + "@babel/plugin-transform-private-methods" "^7.23.3" + "@babel/plugin-transform-private-property-in-object" "^7.23.4" + "@babel/plugin-transform-property-literals" "^7.23.3" + "@babel/plugin-transform-regenerator" "^7.23.3" + "@babel/plugin-transform-reserved-words" "^7.23.3" + "@babel/plugin-transform-shorthand-properties" "^7.23.3" + "@babel/plugin-transform-spread" "^7.23.3" + "@babel/plugin-transform-sticky-regex" "^7.23.3" + "@babel/plugin-transform-template-literals" "^7.23.3" + "@babel/plugin-transform-typeof-symbol" "^7.23.3" + "@babel/plugin-transform-unicode-escapes" "^7.23.3" + "@babel/plugin-transform-unicode-property-regex" "^7.23.3" + "@babel/plugin-transform-unicode-regex" "^7.23.3" + "@babel/plugin-transform-unicode-sets-regex" "^7.23.3" + "@babel/preset-modules" "0.1.6-no-external-plugins" + babel-plugin-polyfill-corejs2 "^0.4.8" + babel-plugin-polyfill-corejs3 "^0.9.0" + babel-plugin-polyfill-regenerator "^0.5.5" + core-js-compat "^3.31.0" + semver "^6.3.1" + +"@babel/preset-modules@0.1.6-no-external-plugins": + version "0.1.6-no-external-plugins" + resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz#ccb88a2c49c817236861fee7826080573b8a923a" + integrity sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/types" "^7.4.4" + esutils "^2.0.2" + +"@babel/regjsgen@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" + integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== + +"@babel/runtime@^7.8.4": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7" + integrity sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw== + dependencies: + regenerator-runtime "^0.14.0" + +"@babel/template@^7.22.15", "@babel/template@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.23.9.tgz#f881d0487cba2828d3259dcb9ef5005a9731011a" + integrity sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/parser" "^7.23.9" + "@babel/types" "^7.23.9" + +"@babel/traverse@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.9.tgz#2f9d6aead6b564669394c5ce0f9302bb65b9d950" + integrity sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.9" + "@babel/types" "^7.23.9" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.22.15", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.6", "@babel/types@^7.23.9", "@babel/types@^7.4.4", "@babel/types@^7.6.1", "@babel/types@^7.9.6": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.9.tgz#1dd7b59a9a2b5c87f8b41e52770b5ecbf492e002" + integrity sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + +"@colors/colors@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" + integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== + +"@discoveryjs/json-ext@^0.5.0": + version "0.5.7" + resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" + integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/source-map@^0.3.3": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.5.tgz#a3bb4d5c6825aab0d281268f47f6ad5853431e91" + integrity sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.9": + version "0.3.22" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz#72a621e5de59f5f1ef792d0793a82ee20f645e4c" + integrity sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@jscpd/core@^3.5.4": + version "3.5.4" + resolved "https://registry.yarnpkg.com/@jscpd/core/-/core-3.5.4.tgz#0dff08af5e071d22ba35dcb5701fb008338d2b32" + integrity sha512-jf37O5C8/Pe4/FbSvgW+IDBwWkRfBCDzJGx4c+zrbq52CIY4ZvREfi1kw6BaE6C6Xz84FgfpKYOuSW/8gTk83A== + dependencies: + eventemitter3 "^4.0.4" + +"@jscpd/finder@^3.5.10": + version "3.5.10" + resolved "https://registry.yarnpkg.com/@jscpd/finder/-/finder-3.5.10.tgz#5fee68f51e23157b6323743e3f2b8357921cd8b2" + integrity sha512-zyafUsTB2xDySho3wKMSoZuiMw2XvkdYW72kI7bLdz9M+ERyTMRfUnX1RgoGldXyylyZPF1FSflmfsppkV4Wuw== + dependencies: + "@jscpd/core" "^3.5.4" + "@jscpd/tokenizer" "^3.5.4" + blamer "^1.0.4" + bytes "^3.1.0" + cli-table3 "^0.6.0" + colors "1.4.0" + fast-glob "^3.2.2" + fs-extra "^9.0.0" + markdown-table "^2.0.0" + pug "^3.0.1" + +"@jscpd/html-reporter@^3.5.10": + version "3.5.10" + resolved "https://registry.yarnpkg.com/@jscpd/html-reporter/-/html-reporter-3.5.10.tgz#caadce105eb1d0943707c2f8b05285d6b1f96a43" + integrity sha512-EPee/YSy/12UboUOoOD+vFvU8/Bi/CAKnjTDnAdPnJlSh68jog/BNhHKrXiiJKZS2CLn1WzjUaefJrn8VcWo+A== + dependencies: + "@jscpd/finder" "^3.5.10" + colors "1.4.0" + fs-extra "^9.0.1" + pug "^3.0.2" + +"@jscpd/tokenizer@^3.5.4": + version "3.5.4" + resolved "https://registry.yarnpkg.com/@jscpd/tokenizer/-/tokenizer-3.5.4.tgz#23a54d359f0848f418bd01c77129384e24acc12d" + integrity sha512-qvGbHNFaGXqMqgw0cujRqSM2cuPBAR9EOtZNUx4eGQ6IeuJhsS+aI0ijEUOE1OdVBStdu5xYdyytuLkkmtJzHA== + dependencies: + "@jscpd/core" "^3.5.4" + reprism "^0.0.11" + spark-md5 "^3.0.1" + +"@leichtgewicht/ip-codec@^2.0.1": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" + integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@nuxt/friendly-errors-webpack-plugin@^2.5.1": + version "2.6.0" + resolved "https://registry.yarnpkg.com/@nuxt/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-2.6.0.tgz#bd0cf6cd73b6e1d3e7c7f1c0de43333e69cc660c" + integrity sha512-3IZj6MXbzlvUxDncAxgBMLQwGPY/JlNhy2i+AGyOHCAReR5HcBxYjVRBvyaKM9R3s5k4OODYKeHAbrToZH/47w== + dependencies: + chalk "^2.4.2" + consola "^3.2.3" + error-stack-parser "^2.1.4" + string-width "^4.2.3" + +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + +"@symfony/webpack-encore@^4": + version "4.6.1" + resolved "https://registry.yarnpkg.com/@symfony/webpack-encore/-/webpack-encore-4.6.1.tgz#a3ced0baf1b02feb6d1a564906aff0e479b07259" + integrity sha512-JbOjy0P6P9pcbgVE3nceFnCCneRO+tbcLUkQh9rpPj/sHtFl12foSjHz6uY93ZGZGAvTyqEslie+4MlD/rUtnQ== + dependencies: + "@nuxt/friendly-errors-webpack-plugin" "^2.5.1" + assets-webpack-plugin "7.0.*" + babel-loader "^9.1.3" + chalk "^4.0.0" + clean-webpack-plugin "^4.0.0" + css-loader "^6.7.0" + css-minimizer-webpack-plugin "^5.0.0" + fast-levenshtein "^3.0.0" + mini-css-extract-plugin "^2.6.0" + pkg-up "^3.1.0" + pretty-error "^4.0.0" + resolve-url-loader "^5.0.0" + semver "^7.3.2" + style-loader "^3.3.0" + sync-rpc "^1.3.6" + tapable "^2.2.1" + terser-webpack-plugin "^5.3.0" + tmp "^0.2.1" + webpack-dev-server "^4.8.0" + yargs-parser "^21.0.0" + +"@trysound/sax@0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" + integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== + +"@types/body-parser@*": + version "1.19.5" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4" + integrity sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/bonjour@^3.5.9": + version "3.5.13" + resolved "https://registry.yarnpkg.com/@types/bonjour/-/bonjour-3.5.13.tgz#adf90ce1a105e81dd1f9c61fdc5afda1bfb92956" + integrity sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ== + dependencies: + "@types/node" "*" + +"@types/connect-history-api-fallback@^1.3.5": + version "1.5.4" + resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz#7de71645a103056b48ac3ce07b3520b819c1d5b3" + integrity sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw== + dependencies: + "@types/express-serve-static-core" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.38" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" + integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== + dependencies: + "@types/node" "*" + +"@types/eslint-scope@^3.7.3": + version "3.7.7" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" + integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== + dependencies: + "@types/eslint" "*" + "@types/estree" "*" + +"@types/eslint@*": + version "8.56.2" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.56.2.tgz#1c72a9b794aa26a8b94ad26d5b9aa51c8a6384bb" + integrity sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*", "@types/estree@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" + integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== + +"@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.33": + version "4.17.42" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.42.tgz#2a276952acc73d1b8dc63fd4210647abbc553a71" + integrity sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ== + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + "@types/send" "*" + +"@types/express@*", "@types/express@^4.17.13": + version "4.17.21" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.21.tgz#c26d4a151e60efe0084b23dc3369ebc631ed192d" + integrity sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^4.17.33" + "@types/qs" "*" + "@types/serve-static" "*" + +"@types/glob@^7.1.1": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" + integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + +"@types/http-errors@*": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f" + integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA== + +"@types/http-proxy@^1.17.8": + version "1.17.14" + resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.14.tgz#57f8ccaa1c1c3780644f8a94f9c6b5000b5e2eec" + integrity sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w== + dependencies: + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + +"@types/mime@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.4.tgz#2198ac274de6017b44d941e00261d5bc6a0e0a45" + integrity sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw== + +"@types/mime@^1": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" + integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== + +"@types/minimatch@*": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + +"@types/node-forge@^1.3.0": + version "1.3.11" + resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da" + integrity sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ== + dependencies: + "@types/node" "*" + +"@types/node@*": + version "20.11.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.10.tgz#6c3de8974d65c362f82ee29db6b5adf4205462f9" + integrity sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg== + dependencies: + undici-types "~5.26.4" + +"@types/qs@*": + version "6.9.11" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.11.tgz#208d8a30bc507bd82e03ada29e4732ea46a6bbda" + integrity sha512-oGk0gmhnEJK4Yyk+oI7EfXsLayXatCWPHary1MtcmbAifkobT9cM9yutG/hZKIseOU0MqbIwQ/u2nn/Gb+ltuQ== + +"@types/range-parser@*": + version "1.2.7" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" + integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== + +"@types/retry@0.12.0": + version "0.12.0" + resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d" + integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA== + +"@types/send@*": + version "0.17.4" + resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a" + integrity sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA== + dependencies: + "@types/mime" "^1" + "@types/node" "*" + +"@types/serve-index@^1.9.1": + version "1.9.4" + resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.4.tgz#e6ae13d5053cb06ed36392110b4f9a49ac4ec898" + integrity sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug== + dependencies: + "@types/express" "*" + +"@types/serve-static@*", "@types/serve-static@^1.13.10": + version "1.15.5" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.5.tgz#15e67500ec40789a1e8c9defc2d32a896f05b033" + integrity sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ== + dependencies: + "@types/http-errors" "*" + "@types/mime" "*" + "@types/node" "*" + +"@types/sockjs@^0.3.33": + version "0.3.36" + resolved "https://registry.yarnpkg.com/@types/sockjs/-/sockjs-0.3.36.tgz#ce322cf07bcc119d4cbf7f88954f3a3bd0f67535" + integrity sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q== + dependencies: + "@types/node" "*" + +"@types/ws@^8.5.5": + version "8.5.10" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" + integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A== + dependencies: + "@types/node" "*" + +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.8": + version "17.0.32" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" + integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== + dependencies: + "@types/yargs-parser" "*" + +"@webassemblyjs/ast@1.11.6", "@webassemblyjs/ast@^1.11.5": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.6.tgz#db046555d3c413f8966ca50a95176a0e2c642e24" + integrity sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q== + dependencies: + "@webassemblyjs/helper-numbers" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + +"@webassemblyjs/floating-point-hex-parser@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz#dacbcb95aff135c8260f77fa3b4c5fea600a6431" + integrity sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw== + +"@webassemblyjs/helper-api-error@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz#6132f68c4acd59dcd141c44b18cbebbd9f2fa768" + integrity sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q== + +"@webassemblyjs/helper-buffer@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz#b66d73c43e296fd5e88006f18524feb0f2c7c093" + integrity sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA== + +"@webassemblyjs/helper-numbers@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz#cbce5e7e0c1bd32cf4905ae444ef64cea919f1b5" + integrity sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.11.6" + "@webassemblyjs/helper-api-error" "1.11.6" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/helper-wasm-bytecode@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz#bb2ebdb3b83aa26d9baad4c46d4315283acd51e9" + integrity sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA== + +"@webassemblyjs/helper-wasm-section@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz#ff97f3863c55ee7f580fd5c41a381e9def4aa577" + integrity sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g== + dependencies: + "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/helper-buffer" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/wasm-gen" "1.11.6" + +"@webassemblyjs/ieee754@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz#bb665c91d0b14fffceb0e38298c329af043c6e3a" + integrity sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg== + dependencies: + "@xtuc/ieee754" "^1.2.0" + +"@webassemblyjs/leb128@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.6.tgz#70e60e5e82f9ac81118bc25381a0b283893240d7" + integrity sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.6.tgz#90f8bc34c561595fe156603be7253cdbcd0fab5a" + integrity sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA== + +"@webassemblyjs/wasm-edit@^1.11.5": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz#c72fa8220524c9b416249f3d94c2958dfe70ceab" + integrity sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw== + dependencies: + "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/helper-buffer" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/helper-wasm-section" "1.11.6" + "@webassemblyjs/wasm-gen" "1.11.6" + "@webassemblyjs/wasm-opt" "1.11.6" + "@webassemblyjs/wasm-parser" "1.11.6" + "@webassemblyjs/wast-printer" "1.11.6" + +"@webassemblyjs/wasm-gen@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz#fb5283e0e8b4551cc4e9c3c0d7184a65faf7c268" + integrity sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA== + dependencies: + "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/ieee754" "1.11.6" + "@webassemblyjs/leb128" "1.11.6" + "@webassemblyjs/utf8" "1.11.6" + +"@webassemblyjs/wasm-opt@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz#d9a22d651248422ca498b09aa3232a81041487c2" + integrity sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g== + dependencies: + "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/helper-buffer" "1.11.6" + "@webassemblyjs/wasm-gen" "1.11.6" + "@webassemblyjs/wasm-parser" "1.11.6" + +"@webassemblyjs/wasm-parser@1.11.6", "@webassemblyjs/wasm-parser@^1.11.5": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz#bb85378c527df824004812bbdb784eea539174a1" + integrity sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ== + dependencies: + "@webassemblyjs/ast" "1.11.6" + "@webassemblyjs/helper-api-error" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/ieee754" "1.11.6" + "@webassemblyjs/leb128" "1.11.6" + "@webassemblyjs/utf8" "1.11.6" + +"@webassemblyjs/wast-printer@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz#a7bf8dd7e362aeb1668ff43f35cb849f188eff20" + integrity sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A== + dependencies: + "@webassemblyjs/ast" "1.11.6" + "@xtuc/long" "4.2.2" + +"@webpack-cli/configtest@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-2.1.1.tgz#3b2f852e91dac6e3b85fb2a314fb8bef46d94646" + integrity sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw== + +"@webpack-cli/info@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-2.0.2.tgz#cc3fbf22efeb88ff62310cf885c5b09f44ae0fdd" + integrity sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A== + +"@webpack-cli/serve@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" + integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== + +"@xtuc/ieee754@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" + integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== + +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== + +accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: + version "1.3.8" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" + integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== + dependencies: + mime-types "~2.1.34" + negotiator "0.6.3" + +acorn-import-assertions@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz#507276249d684797c84e0734ef84860334cfb1ac" + integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA== + +acorn@^7.1.1: + version "7.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + +acorn@^8.7.1, acorn@^8.8.2: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + +adjust-sourcemap-loader@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/adjust-sourcemap-loader/-/adjust-sourcemap-loader-4.0.0.tgz#fc4a0fd080f7d10471f30a7320f25560ade28c99" + integrity sha512-OXwN5b9pCUXNQHJpwwD2qP40byEmSgzj8B4ydSN0uMNYWiFmJ6x6KwUllMmfk8Rwu/HJDFR7U8ubsWBoN0Xp0A== + dependencies: + loader-utils "^2.0.0" + regex-parser "^2.2.11" + +ajv-formats@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" + integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== + dependencies: + ajv "^8.0.0" + +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + +ajv-keywords@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" + integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== + dependencies: + fast-deep-equal "^3.1.3" + +ajv@^6.12.5: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ajv@^8.0.0, ajv@^8.9.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" + integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + +ansi-html-community@^0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" + integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + integrity sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng== + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + integrity sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q== + +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== + +assert-never@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/assert-never/-/assert-never-1.2.1.tgz#11f0e363bf146205fb08193b5c7b90f4d1cf44fe" + integrity sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw== + +assets-webpack-plugin@7.0.*: + version "7.0.0" + resolved "https://registry.yarnpkg.com/assets-webpack-plugin/-/assets-webpack-plugin-7.0.0.tgz#c61ed7466f35ff7a4d90d7070948736f471b8804" + integrity sha512-DMZ9r6HFxynWeONRMhSOFTvTrmit5dovdoUKdJgCG03M6CC7XiwNImPH+Ad1jaVrQ2n59e05lBhte52xPt4MSA== + dependencies: + camelcase "^6.0.0" + escape-string-regexp "^4.0.0" + lodash "^4.17.20" + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +babel-loader@^9.1.3: + version "9.1.3" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-9.1.3.tgz#3d0e01b4e69760cc694ee306fe16d358aa1c6f9a" + integrity sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw== + dependencies: + find-cache-dir "^4.0.0" + schema-utils "^4.0.0" + +babel-plugin-polyfill-corejs2@^0.4.8: + version "0.4.8" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.8.tgz#dbcc3c8ca758a290d47c3c6a490d59429b0d2269" + integrity sha512-OtIuQfafSzpo/LhnJaykc0R/MMnuLSSVjVYy9mHArIZ9qTCSZ6TpWCuEKZYVoN//t8HqBNScHrOtCrIK5IaGLg== + dependencies: + "@babel/compat-data" "^7.22.6" + "@babel/helper-define-polyfill-provider" "^0.5.0" + semver "^6.3.1" + +babel-plugin-polyfill-corejs3@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.9.0.tgz#9eea32349d94556c2ad3ab9b82ebb27d4bf04a81" + integrity sha512-7nZPG1uzK2Ymhy/NbaOWTg3uibM2BmGASS4vHS4szRZAIR8R6GwA/xAujpdrXU5iyklrimWnLWU+BLF9suPTqg== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.5.0" + core-js-compat "^3.34.0" + +babel-plugin-polyfill-regenerator@^0.5.5: + version "0.5.5" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.5.tgz#8b0c8fc6434239e5d7b8a9d1f832bb2b0310f06a" + integrity sha512-OJGYZlhLqBh2DDHeqAxWB1XIvr49CxiJ2gIt61/PU55CQK4Z58OzMqjDe1zwQdQk+rBYsRc+1rJmdajM3gimHg== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.5.0" + +babel-walk@3.0.0-canary-5: + version "3.0.0-canary-5" + resolved "https://registry.yarnpkg.com/babel-walk/-/babel-walk-3.0.0-canary-5.tgz#f66ecd7298357aee44955f235a6ef54219104b11" + integrity sha512-GAwkz0AihzY5bkwIY5QDR+LvsRQgB/B+1foMPvi0FZPMl5fjD7ICiznUiBdLYMH1QYe6vqu4gWYytZOccLouFw== + dependencies: + "@babel/types" "^7.9.6" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +batch@0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" + integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== + +big.js@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" + integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +blamer@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/blamer/-/blamer-1.0.6.tgz#653fd72ab396efe180bae65d24919a8eda841944" + integrity sha512-fv7QToPS87oD1m1bDDTf29zC/bVKJxj2Nqh1r/v4NhMtbnzDIbWOHBYIfxCjlmkVGu3FGOjKgdNG3SFm7TkvBQ== + dependencies: + execa "^4.0.0" + which "^2.0.2" + +body-parser@1.20.1: + version "1.20.1" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" + integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== + dependencies: + bytes "3.1.2" + content-type "~1.0.4" + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" + iconv-lite "0.4.24" + on-finished "2.4.1" + qs "6.11.0" + raw-body "2.5.1" + type-is "~1.6.18" + unpipe "1.0.0" + +bonjour-service@^1.0.11: + version "1.2.1" + resolved "https://registry.yarnpkg.com/bonjour-service/-/bonjour-service-1.2.1.tgz#eb41b3085183df3321da1264719fbada12478d02" + integrity sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw== + dependencies: + fast-deep-equal "^3.1.3" + multicast-dns "^7.2.5" + +boolbase@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww== + +bootstrap-less@^3.3.8: + version "3.3.8" + resolved "https://registry.yarnpkg.com/bootstrap-less/-/bootstrap-less-3.3.8.tgz#71f29dd5a7fffedfe89f1605bbadfe0a338dae53" + integrity sha512-OooZ0uabOUyktvjgXpoJaGZfyZ0tQ2zij449tIZ2gQ6+TEDrnRxVlOXq+O8NwCRwI9/RA39VQfcelWQ8qPMhUw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^3.0.2, braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +browserslist@^4.0.0, browserslist@^4.21.10, browserslist@^4.22.2: + version "4.22.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.3.tgz#299d11b7e947a6b843981392721169e27d60c5a6" + integrity sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A== + dependencies: + caniuse-lite "^1.0.30001580" + electron-to-chromium "^1.4.648" + node-releases "^2.0.14" + update-browserslist-db "^1.0.13" + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +bytes@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw== + +bytes@3.1.2, bytes@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== + dependencies: + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" + +camelcase@^6.0.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-api@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" + integrity sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw== + dependencies: + browserslist "^4.0.0" + caniuse-lite "^1.0.0" + lodash.memoize "^4.1.2" + lodash.uniq "^4.5.0" + +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001580: + version "1.0.30001581" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001581.tgz#0dfd4db9e94edbdca67d57348ebc070dece279f4" + integrity sha512-whlTkwhqV2tUmP3oYhtNfaWGYHDdS3JYFQBKXxcUR9qqPWsRhFHhoISO2Xnl/g0xyKzht9mI1LZpiNWfMzHixQ== + +chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +character-parser@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-2.2.0.tgz#c7ce28f36d4bcd9744e5ffc2c5fcde1c73261fc0" + integrity sha512-+UqJQjFEFaTAs3bNsF2j2kEN1baG/zghZbdqoYEDxGZtJo9LBzl1A+m0D4n3qKx8N2FNv8/Xp6yV9mQmBuptaw== + dependencies: + is-regex "^1.0.3" + +chokidar@^3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +chrome-trace-event@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" + integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== + +ci-info@^3.2.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== + +clean-webpack-plugin@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-4.0.0.tgz#72947d4403d452f38ed61a9ff0ada8122aacd729" + integrity sha512-WuWE1nyTNAyW5T7oNyys2EN0cfP2fdRxhxnIQWiAp0bMabPdHhoGxM8A6YL2GhqwgrPnnaemVE7nv5XJ2Fhh2w== + dependencies: + del "^4.1.1" + +cli-table3@^0.6.0: + version "0.6.3" + resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.3.tgz#61ab765aac156b52f222954ffc607a6f01dbeeb2" + integrity sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg== + dependencies: + string-width "^4.2.0" + optionalDependencies: + "@colors/colors" "1.5.0" + +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +colord@^2.9.1: + version "2.9.3" + resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43" + integrity sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw== + +colorette@^2.0.10, colorette@^2.0.14: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + +colors@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +commander@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commander@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" + integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== + +commander@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + +common-path-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" + integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== + +compressible@~2.0.16: + version "2.0.18" + resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" + integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg== + dependencies: + mime-db ">= 1.43.0 < 2" + +compression@^1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" + integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== + dependencies: + accepts "~1.3.5" + bytes "3.0.0" + compressible "~2.0.16" + debug "2.6.9" + on-headers "~1.0.2" + safe-buffer "5.1.2" + vary "~1.1.2" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +connect-history-api-fallback@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8" + integrity sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA== + +consola@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/consola/-/consola-3.2.3.tgz#0741857aa88cfa0d6fd53f1cff0375136e98502f" + integrity sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ== + +constantinople@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/constantinople/-/constantinople-4.0.1.tgz#0def113fa0e4dc8de83331a5cf79c8b325213151" + integrity sha512-vCrqcSIq4//Gx74TXXCGnHpulY1dskqLTFGDmhrGxzeXL8lF8kvXv6mpNWlJj1uD4DW23D4ljAqbY4RRaaUZIw== + dependencies: + "@babel/parser" "^7.6.0" + "@babel/types" "^7.6.1" + +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +content-type@~1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" + integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== + +convert-source-map@^1.7.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" + integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== + +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== + +cookie@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" + integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== + +copy-anything@^2.0.1: + version "2.0.6" + resolved "https://registry.yarnpkg.com/copy-anything/-/copy-anything-2.0.6.tgz#092454ea9584a7b7ad5573062b2a87f5900fc480" + integrity sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw== + dependencies: + is-what "^3.14.1" + +core-js-compat@^3.31.0, core-js-compat@^3.34.0: + version "3.35.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.35.1.tgz#215247d7edb9e830efa4218ff719beb2803555e2" + integrity sha512-sftHa5qUJY3rs9Zht1WEnmkvXputCyDBczPnr7QDgL8n3qrF3CMXY4VPSYtOLLiOUJcah2WNXREd48iOl6mQIw== + dependencies: + browserslist "^4.22.2" + +core-js@^3.0.0: + version "3.35.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.35.1.tgz#9c28f8b7ccee482796f8590cc8d15739eaaf980c" + integrity sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw== + +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +cross-spawn@^7.0.0, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +css-declaration-sorter@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-7.1.1.tgz#9796bcc257b4647c39993bda8d431ce32b666f80" + integrity sha512-dZ3bVTEEc1vxr3Bek9vGwfB5Z6ESPULhcRvO472mfjVnj8jRcTnKO8/JTczlvxM10Myb+wBM++1MtdO76eWcaQ== + +css-loader@^6.7.0: + version "6.9.1" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.9.1.tgz#9ec9a434368f2bdfeffbf8f6901a1ce773586c6b" + integrity sha512-OzABOh0+26JKFdMzlK6PY1u5Zx8+Ck7CVRlcGNZoY9qwJjdfu2VWFuprTIpPW+Av5TZTVViYWcFQaEEQURLknQ== + dependencies: + icss-utils "^5.1.0" + postcss "^8.4.33" + postcss-modules-extract-imports "^3.0.0" + postcss-modules-local-by-default "^4.0.4" + postcss-modules-scope "^3.1.1" + postcss-modules-values "^4.0.0" + postcss-value-parser "^4.2.0" + semver "^7.5.4" + +css-minimizer-webpack-plugin@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-5.0.1.tgz#33effe662edb1a0bf08ad633c32fa75d0f7ec565" + integrity sha512-3caImjKFQkS+ws1TGcFn0V1HyDJFq1Euy589JlD6/3rV2kj+w7r5G9WDMgSHvpvXHNZ2calVypZWuEDQd9wfLg== + dependencies: + "@jridgewell/trace-mapping" "^0.3.18" + cssnano "^6.0.1" + jest-worker "^29.4.3" + postcss "^8.4.24" + schema-utils "^4.0.1" + serialize-javascript "^6.0.1" + +css-select@^4.1.3: + version "4.3.0" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-4.3.0.tgz#db7129b2846662fd8628cfc496abb2b59e41529b" + integrity sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ== + dependencies: + boolbase "^1.0.0" + css-what "^6.0.1" + domhandler "^4.3.1" + domutils "^2.8.0" + nth-check "^2.0.1" + +css-select@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-5.1.0.tgz#b8ebd6554c3637ccc76688804ad3f6a6fdaea8a6" + integrity sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg== + dependencies: + boolbase "^1.0.0" + css-what "^6.1.0" + domhandler "^5.0.2" + domutils "^3.0.1" + nth-check "^2.0.1" + +css-tree@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-2.3.1.tgz#10264ce1e5442e8572fc82fbe490644ff54b5c20" + integrity sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw== + dependencies: + mdn-data "2.0.30" + source-map-js "^1.0.1" + +css-tree@~2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-2.2.1.tgz#36115d382d60afd271e377f9c5f67d02bd48c032" + integrity sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA== + dependencies: + mdn-data "2.0.28" + source-map-js "^1.0.1" + +css-what@^6.0.1, css-what@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4" + integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== + +cssesc@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" + integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== + +cssnano-preset-default@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-6.0.3.tgz#b4ce755974f4dc8d3d09ac13bb6281cce3ced45e" + integrity sha512-4y3H370aZCkT9Ev8P4SO4bZbt+AExeKhh8wTbms/X7OLDo5E7AYUUy6YPxa/uF5Grf+AJwNcCnxKhZynJ6luBA== + dependencies: + css-declaration-sorter "^7.1.1" + cssnano-utils "^4.0.1" + postcss-calc "^9.0.1" + postcss-colormin "^6.0.2" + postcss-convert-values "^6.0.2" + postcss-discard-comments "^6.0.1" + postcss-discard-duplicates "^6.0.1" + postcss-discard-empty "^6.0.1" + postcss-discard-overridden "^6.0.1" + postcss-merge-longhand "^6.0.2" + postcss-merge-rules "^6.0.3" + postcss-minify-font-values "^6.0.1" + postcss-minify-gradients "^6.0.1" + postcss-minify-params "^6.0.2" + postcss-minify-selectors "^6.0.2" + postcss-normalize-charset "^6.0.1" + postcss-normalize-display-values "^6.0.1" + postcss-normalize-positions "^6.0.1" + postcss-normalize-repeat-style "^6.0.1" + postcss-normalize-string "^6.0.1" + postcss-normalize-timing-functions "^6.0.1" + postcss-normalize-unicode "^6.0.2" + postcss-normalize-url "^6.0.1" + postcss-normalize-whitespace "^6.0.1" + postcss-ordered-values "^6.0.1" + postcss-reduce-initial "^6.0.2" + postcss-reduce-transforms "^6.0.1" + postcss-svgo "^6.0.2" + postcss-unique-selectors "^6.0.2" + +cssnano-utils@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/cssnano-utils/-/cssnano-utils-4.0.1.tgz#fd18b42f95938bf55ab47967705355d6047bf1da" + integrity sha512-6qQuYDqsGoiXssZ3zct6dcMxiqfT6epy7x4R0TQJadd4LWO3sPR6JH6ZByOvVLoZ6EdwPGgd7+DR1EmX3tiXQQ== + +cssnano@^6.0.1: + version "6.0.3" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-6.0.3.tgz#46db972da71aa159437287fb4c6bc9c5d3cc5d93" + integrity sha512-MRq4CIj8pnyZpcI2qs6wswoYoDD1t0aL28n+41c1Ukcpm56m1h6mCexIHBGjfZfnTqtGSSCP4/fB1ovxgjBOiw== + dependencies: + cssnano-preset-default "^6.0.3" + lilconfig "^3.0.0" + +csso@^5.0.5: + version "5.0.5" + resolved "https://registry.yarnpkg.com/csso/-/csso-5.0.5.tgz#f9b7fe6cc6ac0b7d90781bb16d5e9874303e2ca6" + integrity sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ== + dependencies: + css-tree "~2.2.0" + +debug@2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +default-gateway@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-6.0.3.tgz#819494c888053bdb743edbf343d6cdf7f2943a71" + integrity sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg== + dependencies: + execa "^5.0.0" + +define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + +define-lazy-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" + integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== + +del@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" + integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ== + dependencies: + "@types/glob" "^7.1.1" + globby "^6.1.0" + is-path-cwd "^2.0.0" + is-path-in-cwd "^2.0.0" + p-map "^2.0.0" + pify "^4.0.1" + rimraf "^2.6.3" + +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== + +detect-node@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" + integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== + +dns-packet@^5.2.2: + version "5.6.1" + resolved "https://registry.yarnpkg.com/dns-packet/-/dns-packet-5.6.1.tgz#ae888ad425a9d1478a0674256ab866de1012cf2f" + integrity sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw== + dependencies: + "@leichtgewicht/ip-codec" "^2.0.1" + +doctypes@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" + integrity sha512-LLBi6pEqS6Do3EKQ3J0NqHWV5hhb78Pi8vvESYwyOy2c31ZEZVdtitdzsQsKb7878PEERhzUk0ftqGhG6Mz+pQ== + +dom-converter@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" + integrity sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA== + dependencies: + utila "~0.4" + +dom-serializer@^1.0.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.4.1.tgz#de5d41b1aea290215dc45a6dae8adcf1d32e2d30" + integrity sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag== + dependencies: + domelementtype "^2.0.1" + domhandler "^4.2.0" + entities "^2.0.0" + +dom-serializer@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-2.0.0.tgz#e41b802e1eedf9f6cae183ce5e622d789d7d8e53" + integrity sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg== + dependencies: + domelementtype "^2.3.0" + domhandler "^5.0.2" + entities "^4.2.0" + +domelementtype@^2.0.1, domelementtype@^2.2.0, domelementtype@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" + integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== + +domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" + integrity sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ== + dependencies: + domelementtype "^2.2.0" + +domhandler@^5.0.2, domhandler@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-5.0.3.tgz#cc385f7f751f1d1fc650c21374804254538c7d31" + integrity sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w== + dependencies: + domelementtype "^2.3.0" + +domutils@^2.5.2, domutils@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" + integrity sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A== + dependencies: + dom-serializer "^1.0.1" + domelementtype "^2.2.0" + domhandler "^4.2.0" + +domutils@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-3.1.0.tgz#c47f551278d3dc4b0b1ab8cbb42d751a6f0d824e" + integrity sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA== + dependencies: + dom-serializer "^2.0.0" + domelementtype "^2.3.0" + domhandler "^5.0.3" + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== + +electron-to-chromium@^1.4.648: + version "1.4.650" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.650.tgz#b38ef9de16991b9f7b924246770576ab91ab3d64" + integrity sha512-sYSQhJCJa4aGA1wYol5cMQgekDBlbVfTRavlGZVr3WZpDdOPcp6a6xUnFfrt8TqZhsBYYbDxJZCjGfHuGupCRQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emojis-list@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" + integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q== + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +enhanced-resolve@^5.15.0: + version "5.15.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" + integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + +entities@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" + integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A== + +entities@^4.2.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" + integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== + +envinfo@^7.7.3: + version "7.11.0" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.11.0.tgz#c3793f44284a55ff8c82faf1ffd91bc6478ea01f" + integrity sha512-G9/6xF1FPbIw0TtalAMaVPpiq2aDEuKLXM314jPVAO9r2fo2a4BLqMNkmRS7O/xPPZ+COAhGIz3ETvHEV3eUcg== + +errno@^0.1.1: + version "0.1.8" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" + integrity sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A== + dependencies: + prr "~1.0.1" + +error-stack-parser@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.1.4.tgz#229cb01cdbfa84440bfa91876285b94680188286" + integrity sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ== + dependencies: + stackframe "^1.3.4" + +es-module-lexer@^1.2.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.4.1.tgz#41ea21b43908fe6a287ffcbe4300f790555331f5" + integrity sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w== + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-scope@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== + +eventemitter3@^4.0.0, eventemitter3@^4.0.4: + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +events@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + +execa@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +express@^4.17.3: + version "4.18.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" + integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== + dependencies: + accepts "~1.3.8" + array-flatten "1.1.1" + body-parser "1.20.1" + content-disposition "0.5.4" + content-type "~1.0.4" + cookie "0.5.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "2.0.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.2.0" + fresh "0.5.2" + http-errors "2.0.0" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "2.4.1" + parseurl "~1.3.3" + path-to-regexp "0.1.7" + proxy-addr "~2.0.7" + qs "6.11.0" + range-parser "~1.2.1" + safe-buffer "5.2.1" + send "0.18.0" + serve-static "1.15.0" + setprototypeof "1.2.0" + statuses "2.0.1" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.2.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz#37b899ae47e1090e40e3fd2318e4d5f0142ca912" + integrity sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ== + dependencies: + fastest-levenshtein "^1.0.7" + +fastest-levenshtein@^1.0.12, fastest-levenshtein@^1.0.7: + version "1.0.16" + resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" + integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg== + +fastq@^1.6.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.0.tgz#ca5e1a90b5e68f97fc8b61330d5819b82f5fab03" + integrity sha512-zGygtijUMT7jnk3h26kUms3BkSDp4IfIKjmnqI2tvx6nuBfiF1UqOxbnLfzdv+apBy+53oaImsKtMw/xYbW+1w== + dependencies: + reusify "^1.0.4" + +faye-websocket@^0.11.3: + version "0.11.4" + resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.4.tgz#7f0d9275cfdd86a1c963dc8b65fcc451edcbb1da" + integrity sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g== + dependencies: + websocket-driver ">=0.5.1" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +finalhandler@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" + integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "2.4.1" + parseurl "~1.3.3" + statuses "2.0.1" + unpipe "~1.0.0" + +find-cache-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-4.0.0.tgz#a30ee0448f81a3990708f6453633c733e2f6eec2" + integrity sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg== + dependencies: + common-path-prefix "^3.0.0" + pkg-dir "^7.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +find-up@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +find-up@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-6.3.0.tgz#2abab3d3280b2dc7ac10199ef324c4e002c8c790" + integrity sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw== + dependencies: + locate-path "^7.1.0" + path-exists "^5.0.0" + +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +follow-redirects@^1.0.0: + version "1.15.5" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020" + integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw== + +font-awesome@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133" + integrity sha512-U6kGnykA/6bFmg1M/oT9EkFeIYv7JlX3bozwQJWiiLz6L0w3F5vBVPxHlwyX/vtNq1ckcpRKOB9f2Qal/VtFpg== + +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== + +fs-extra@^9.0.0, fs-extra@^9.0.1, fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs-monkey@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.5.tgz#fe450175f0db0d7ea758102e1d84096acb925788" + integrity sha512-8uMbBjrhzW76TYgEV27Y5E//W2f/lTFmx78P2w19FZSxarhI/798APGQyuGCwmkNxgwGRhrLfvWyLBvNtuOmew== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== + dependencies: + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + +get-port@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" + integrity sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg== + +get-stream@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +gitignore-to-glob@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/gitignore-to-glob/-/gitignore-to-glob-0.3.0.tgz#59f32ab3d9b66ce50299c3ed24cb0ef42a094ceb" + integrity sha512-mk74BdnK7lIwDHnotHddx1wsjMOFIThpLY3cPNniJ/2fA/tlLzHnFxIdR+4sLOu5KGgQJdij4kjJ2RoUNnCNMA== + +glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + +glob@^7.0.3, glob@^7.1.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + integrity sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw== + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw== + +handle-thing@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" + integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== + dependencies: + get-intrinsic "^1.2.2" + +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + +has-symbols@^1.0.2, has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + +hasown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + +hpack.js@^2.1.6: + version "2.1.6" + resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" + integrity sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ== + dependencies: + inherits "^2.0.1" + obuf "^1.0.0" + readable-stream "^2.0.1" + wbuf "^1.1.0" + +html-entities@^2.3.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.4.0.tgz#edd0cee70402584c8c76cc2c0556db09d1f45061" + integrity sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ== + +htmlparser2@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.1.0.tgz#c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7" + integrity sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A== + dependencies: + domelementtype "^2.0.1" + domhandler "^4.0.0" + domutils "^2.5.2" + entities "^2.0.0" + +http-deceiver@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" + integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== + +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + +http-errors@~1.6.2: + version "1.6.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + +http-parser-js@>=0.5.1: + version "0.5.8" + resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.8.tgz#af23090d9ac4e24573de6f6aecc9d84a48bf20e3" + integrity sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q== + +http-proxy-middleware@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz#e1a4dd6979572c7ab5a4e4b55095d1f32a74963f" + integrity sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw== + dependencies: + "@types/http-proxy" "^1.17.8" + http-proxy "^1.18.1" + is-glob "^4.0.1" + is-plain-obj "^3.0.0" + micromatch "^4.0.2" + +http-proxy@^1.18.1: + version "1.18.1" + resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" + integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== + dependencies: + eventemitter3 "^4.0.0" + follow-redirects "^1.0.0" + requires-port "^1.0.0" + +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +icss-utils@^5.0.0, icss-utils@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" + integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== + +image-size@~0.5.0: + version "0.5.5" + resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" + integrity sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ== + +import-local@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== + +interpret@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" + integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== + +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + +ipaddr.js@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.1.0.tgz#2119bc447ff8c257753b196fc5f1ce08a4cdf39f" + integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-core-module@^2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + +is-docker@^2.0.0, is-docker@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== + +is-expression@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-expression/-/is-expression-4.0.0.tgz#c33155962abf21d0afd2552514d67d2ec16fd2ab" + integrity sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A== + dependencies: + acorn "^7.1.1" + object-assign "^4.1.1" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-path-cwd@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" + integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== + +is-path-in-cwd@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" + integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== + dependencies: + is-path-inside "^2.1.0" + +is-path-inside@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" + integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== + dependencies: + path-is-inside "^1.0.2" + +is-plain-obj@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7" + integrity sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA== + +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-promise@^2.0.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== + +is-regex@^1.0.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +is-what@^3.14.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/is-what/-/is-what-3.14.1.tgz#e1222f46ddda85dead0fd1c9df131760e77755c1" + integrity sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA== + +is-wsl@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== + dependencies: + is-docker "^2.0.0" + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== + +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest-worker@^29.4.3: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jquery@^3.5.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de" + integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg== + +js-stringify@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/js-stringify/-/js-stringify-1.0.2.tgz#1736fddfd9724f28a3682adc6230ae7e4e9679db" + integrity sha512-rtS5ATOo2Q5k1G+DADISilDA6lv79zIiwFd6CcjuIxGKLFm5C+RLImRscVap9k55i+MOZwgliw+NejvkLuGD5g== + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +jscpd@^3.4.5: + version "3.5.10" + resolved "https://registry.yarnpkg.com/jscpd/-/jscpd-3.5.10.tgz#d9d9a3089e4da6cf147938f250980e480cce298d" + integrity sha512-lsFBSqtmGocMtF8NuCh867VRhjeSvPlGit7FYA9a9bX3GFoV65djHnWMbIWfHLb/6wCCwllmXaHuMgeMuhqo3Q== + dependencies: + "@jscpd/core" "^3.5.4" + "@jscpd/finder" "^3.5.10" + "@jscpd/html-reporter" "^3.5.10" + "@jscpd/tokenizer" "^3.5.4" + colors "1.4.0" + commander "^5.0.0" + fs-extra "^9.1.0" + gitignore-to-glob "^0.3.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== + +json-parse-even-better-errors@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json5@^2.1.2, json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jstransformer@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/jstransformer/-/jstransformer-1.0.0.tgz#ed8bf0921e2f3f1ed4d5c1a44f68709ed24722c3" + integrity sha512-C9YK3Rf8q6VAPDCCU9fnqo3mAfOH6vUGnMcP4AQAYIEpWtfGLpwOTmZ+igtdK5y+VvI2n3CyYSzy4Qh34eq24A== + dependencies: + is-promise "^2.0.0" + promise "^7.0.1" + +kind-of@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +launch-editor@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.6.1.tgz#f259c9ef95cbc9425620bbbd14b468fcdb4ffe3c" + integrity sha512-eB/uXmFVpY4zezmGp5XtU21kwo7GBbKB+EQ+UZeWtGb9yAM5xt/Evk+lYH3eRNAtId+ej4u7TYPFZ07w4s7rRw== + dependencies: + picocolors "^1.0.0" + shell-quote "^1.8.1" + +less-loader@^11.1: + version "11.1.4" + resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-11.1.4.tgz#e8a070844efaefbe59b978acaf57b9d3e868cf08" + integrity sha512-6/GrYaB6QcW6Vj+/9ZPgKKs6G10YZai/l/eJ4SLwbzqNTBsAqt5hSLVF47TgsiBxV1P6eAU0GYRH3YRuQU9V3A== + +less@^3.12.2: + version "3.13.1" + resolved "https://registry.yarnpkg.com/less/-/less-3.13.1.tgz#0ebc91d2a0e9c0c6735b83d496b0ab0583077909" + integrity sha512-SwA1aQXGUvp+P5XdZslUOhhLnClSLIjWvJhmd+Vgib5BFIr9lMNlQwmwUNOjXThF/A0x+MCYYPeWEfeWiLRnTw== + dependencies: + copy-anything "^2.0.1" + tslib "^1.10.0" + optionalDependencies: + errno "^0.1.1" + graceful-fs "^4.1.2" + image-size "~0.5.0" + make-dir "^2.1.0" + mime "^1.4.1" + native-request "^1.0.5" + source-map "~0.6.0" + +lilconfig@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.0.0.tgz#f8067feb033b5b74dab4602a5f5029420be749bc" + integrity sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g== + +loader-runner@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== + +loader-utils@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c" + integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw== + dependencies: + big.js "^5.2.2" + emojis-list "^3.0.0" + json5 "^2.1.2" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +locate-path@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-7.2.0.tgz#69cb1779bd90b35ab1e771e1f2f89a202c2a8a8a" + integrity sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA== + dependencies: + p-locate "^6.0.0" + +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== + +lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lodash.uniq@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" + integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== + +lodash@^4.17.20, lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +markdown-table@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b" + integrity sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A== + dependencies: + repeat-string "^1.0.0" + +mdn-data@2.0.28: + version "2.0.28" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.28.tgz#5ec48e7bef120654539069e1ae4ddc81ca490eba" + integrity sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g== + +mdn-data@2.0.30: + version "2.0.30" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc" + integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA== + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== + +memfs@^3.4.3: + version "3.6.0" + resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6" + integrity sha512-EGowvkkgbMcIChjMTMkESFDbZeSh8xZ7kNSF0hAiAN4Jh6jgHCRS0Ga/+C8y6Au+oqpezRHCfPsmJ2+DwAgiwQ== + dependencies: + fs-monkey "^1.0.4" + +merge-descriptors@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== + +micromatch@^4.0.2, micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime@1.6.0, mime@^1.4.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mini-css-extract-plugin@^2.6.0: + version "2.7.7" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.7.7.tgz#4acf02f362c641c38fb913bfcb7ca2fc4a7cf339" + integrity sha512-+0n11YGyRavUR3IlaOzJ0/4Il1avMvJ1VJfhWfCn24ITQXhRr1gghbhhrda6tgtNcpZaWKdSuwKq20Jb7fnlyw== + dependencies: + schema-utils "^4.0.0" + +minimalistic-assert@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +moment@^2.29.2: + version "2.30.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" + integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +multicast-dns@^7.2.5: + version "7.2.5" + resolved "https://registry.yarnpkg.com/multicast-dns/-/multicast-dns-7.2.5.tgz#77eb46057f4d7adbd16d9290fa7299f6fa64cced" + integrity sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg== + dependencies: + dns-packet "^5.2.2" + thunky "^1.0.2" + +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + +native-request@^1.0.5: + version "1.1.0" + resolved "https://registry.yarnpkg.com/native-request/-/native-request-1.1.0.tgz#acdb30fe2eefa3e1bc8c54b3a6852e9c5c0d3cb0" + integrity sha512-uZ5rQaeRn15XmpgE0xoPL8YWqcX90VtCFglYwAgkvKM5e8fog+vePLAhHxuuv/gRkrQxIeh5U3q9sMNUrENqWw== + +negotiator@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== + +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + +node-forge@^1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" + integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== + +node-notifier@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-9.0.1.tgz#cea837f4c5e733936c7b9005e6545cea825d1af4" + integrity sha512-fPNFIp2hF/Dq7qLDzSg4vZ0J4e9v60gJR+Qx7RbjbWqzPDdEqeVpEx5CFeDAELIl+A/woaaNn1fQ5nEVerMxJg== + dependencies: + growly "^1.3.0" + is-wsl "^2.2.0" + semver "^7.3.2" + shellwords "^0.1.1" + uuid "^8.3.0" + which "^2.0.2" + +node-releases@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.0, npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +nth-check@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.1.1.tgz#c9eab428effce36cd6b92c924bdb000ef1f1ed1d" + integrity sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w== + dependencies: + boolbase "^1.0.0" + +object-assign@^4.0.1, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + +object-inspect@^1.9.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + +obuf@^1.0.0, obuf@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" + integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== + +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + dependencies: + ee-first "1.1.1" + +on-headers@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" + integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.0, onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +open@^8.0.9: + version "8.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" + integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== + dependencies: + define-lazy-prop "^2.0.0" + is-docker "^2.1.1" + is-wsl "^2.2.0" + +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" + integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== + dependencies: + yocto-queue "^1.0.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-locate@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" + integrity sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw== + dependencies: + p-limit "^4.0.0" + +p-map@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== + +p-retry@^4.5.0: + version "4.6.2" + resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-4.6.2.tgz#9baae7184057edd4e17231cee04264106e092a16" + integrity sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ== + dependencies: + "@types/retry" "0.12.0" + retry "^0.13.1" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parseurl@~1.3.2, parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-exists@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" + integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-to-regexp@0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw== + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +pkg-dir@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-7.0.0.tgz#8f0c08d6df4476756c5ff29b3282d0bab7517d11" + integrity sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA== + dependencies: + find-up "^6.3.0" + +pkg-up@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" + integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA== + dependencies: + find-up "^3.0.0" + +postcss-calc@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-9.0.1.tgz#a744fd592438a93d6de0f1434c572670361eb6c6" + integrity sha512-TipgjGyzP5QzEhsOZUaIkeO5mKeMFpebWzRogWG/ysonUlnHcq5aJe0jOjpfzUU8PeSaBQnrE8ehR0QA5vs8PQ== + dependencies: + postcss-selector-parser "^6.0.11" + postcss-value-parser "^4.2.0" + +postcss-colormin@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-6.0.2.tgz#2af9ce753937b08e058dbc6879e4aedfab42806b" + integrity sha512-TXKOxs9LWcdYo5cgmcSHPkyrLAh86hX1ijmyy6J8SbOhyv6ua053M3ZAM/0j44UsnQNIWdl8gb5L7xX2htKeLw== + dependencies: + browserslist "^4.22.2" + caniuse-api "^3.0.0" + colord "^2.9.1" + postcss-value-parser "^4.2.0" + +postcss-convert-values@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-6.0.2.tgz#c4a7509aeb1cc7ac3f6948fcbffc2bf8cac7c56a" + integrity sha512-aeBmaTnGQ+NUSVQT8aY0sKyAD/BaLJenEKZ03YK0JnDE1w1Rr8XShoxdal2V2H26xTJKr3v5haByOhJuyT4UYw== + dependencies: + browserslist "^4.22.2" + postcss-value-parser "^4.2.0" + +postcss-discard-comments@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-6.0.1.tgz#46176212bd9c3e5f48aa4b8b4868786726c41d36" + integrity sha512-f1KYNPtqYLUeZGCHQPKzzFtsHaRuECe6jLakf/RjSRqvF5XHLZnM2+fXLhb8Qh/HBFHs3M4cSLb1k3B899RYIg== + +postcss-discard-duplicates@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.1.tgz#112b1a95948e69b3484fdd43584dda6930977939" + integrity sha512-1hvUs76HLYR8zkScbwyJ8oJEugfPV+WchpnA+26fpJ7Smzs51CzGBHC32RS03psuX/2l0l0UKh2StzNxOrKCYg== + +postcss-discard-empty@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-6.0.1.tgz#b34cb45ec891246da4506b53e352390fdef126c4" + integrity sha512-yitcmKwmVWtNsrrRqGJ7/C0YRy53i0mjexBDQ9zYxDwTWVBgbU4+C9jIZLmQlTDT9zhml+u0OMFJh8+31krmOg== + +postcss-discard-overridden@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-6.0.1.tgz#c63c559237758d74bc505452393a64dda9b19ef4" + integrity sha512-qs0ehZMMZpSESbRkw1+inkf51kak6OOzNRaoLd/U7Fatp0aN2HQ1rxGOrJvYcRAN9VpX8kUF13R2ofn8OlvFVA== + +postcss-merge-longhand@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-6.0.2.tgz#cd4e83014851da59545e9a906b245615550f4064" + integrity sha512-+yfVB7gEM8SrCo9w2lCApKIEzrTKl5yS1F4yGhV3kSim6JzbfLGJyhR1B6X+6vOT0U33Mgx7iv4X9MVWuaSAfw== + dependencies: + postcss-value-parser "^4.2.0" + stylehacks "^6.0.2" + +postcss-merge-rules@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-6.0.3.tgz#08fcf714faaad75b1980ecd961b080ae2f8ddeb3" + integrity sha512-yfkDqSHGohy8sGYIJwBmIGDv4K4/WrJPX355XrxQb/CSsT4Kc/RxDi6akqn5s9bap85AWgv21ArcUWwWdGNSHA== + dependencies: + browserslist "^4.22.2" + caniuse-api "^3.0.0" + cssnano-utils "^4.0.1" + postcss-selector-parser "^6.0.15" + +postcss-minify-font-values@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-6.0.1.tgz#788eb930168be90225f3937f0b70aa19d8b532b2" + integrity sha512-tIwmF1zUPoN6xOtA/2FgVk1ZKrLcCvE0dpZLtzyyte0j9zUeB8RTbCqrHZGjJlxOvNWKMYtunLrrl7HPOiR46w== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-minify-gradients@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-6.0.1.tgz#4faf1880b483dc37016658aa186b42194ff9b5bc" + integrity sha512-M1RJWVjd6IOLPl1hYiOd5HQHgpp6cvJVLrieQYS9y07Yo8itAr6jaekzJphaJFR0tcg4kRewCk3kna9uHBxn/w== + dependencies: + colord "^2.9.1" + cssnano-utils "^4.0.1" + postcss-value-parser "^4.2.0" + +postcss-minify-params@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-6.0.2.tgz#bd64af642fa5610281b8a9461598bbb91f92ae05" + integrity sha512-zwQtbrPEBDj+ApELZ6QylLf2/c5zmASoOuA4DzolyVGdV38iR2I5QRMsZcHkcdkZzxpN8RS4cN7LPskOkTwTZw== + dependencies: + browserslist "^4.22.2" + cssnano-utils "^4.0.1" + postcss-value-parser "^4.2.0" + +postcss-minify-selectors@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-6.0.2.tgz#62065b38d3453ddc6627ba50e4f4a2154b031aa0" + integrity sha512-0b+m+w7OAvZejPQdN2GjsXLv5o0jqYHX3aoV0e7RBKPCsB7TYG5KKWBFhGnB/iP3213Ts8c5H4wLPLMm7z28Sg== + dependencies: + postcss-selector-parser "^6.0.15" + +postcss-modules-extract-imports@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz#cda1f047c0ae80c97dbe28c3e76a43b88025741d" + integrity sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw== + +postcss-modules-local-by-default@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.4.tgz#7cbed92abd312b94aaea85b68226d3dec39a14e6" + integrity sha512-L4QzMnOdVwRm1Qb8m4x8jsZzKAaPAgrUF1r/hjDR2Xj7R+8Zsf97jAlSQzWtKx5YNiNGN8QxmPFIc/sh+RQl+Q== + dependencies: + icss-utils "^5.0.0" + postcss-selector-parser "^6.0.2" + postcss-value-parser "^4.1.0" + +postcss-modules-scope@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-3.1.1.tgz#32cfab55e84887c079a19bbb215e721d683ef134" + integrity sha512-uZgqzdTleelWjzJY+Fhti6F3C9iF1JR/dODLs/JDefozYcKTBCdD8BIl6nNPbTbcLnGrk56hzwZC2DaGNvYjzA== + dependencies: + postcss-selector-parser "^6.0.4" + +postcss-modules-values@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz#d7c5e7e68c3bb3c9b27cbf48ca0bb3ffb4602c9c" + integrity sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ== + dependencies: + icss-utils "^5.0.0" + +postcss-normalize-charset@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-6.0.1.tgz#5f70e1eb8bbdbcfcbed060ef70f179e8fef57d0c" + integrity sha512-aW5LbMNRZ+oDV57PF9K+WI1Z8MPnF+A8qbajg/T8PP126YrGX1f9IQx21GI2OlGz7XFJi/fNi0GTbY948XJtXg== + +postcss-normalize-display-values@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.1.tgz#ff9aa30bbf1283294bfd9cc8b6fb81ff060a7f2d" + integrity sha512-mc3vxp2bEuCb4LgCcmG1y6lKJu1Co8T+rKHrcbShJwUmKJiEl761qb/QQCfFwlrvSeET3jksolCR/RZuMURudw== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-normalize-positions@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-6.0.1.tgz#41ffdc72994f024c6cd6e91dbfb40ab9abe6fe90" + integrity sha512-HRsq8u/0unKNvm0cvwxcOUEcakFXqZ41fv3FOdPn916XFUrympjr+03oaLkuZENz3HE9RrQE9yU0Xv43ThWjQg== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-normalize-repeat-style@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.1.tgz#55dc54b6f80305b280a379899a6626e0a07b04a8" + integrity sha512-Gbb2nmCy6tTiA7Sh2MBs3fj9W8swonk6lw+dFFeQT68B0Pzwp1kvisJQkdV6rbbMSd9brMlS8I8ts52tAGWmGQ== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-normalize-string@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-6.0.1.tgz#7605e0fb4ec7bf2709709991d13a949e4419db1d" + integrity sha512-5Fhx/+xzALJD9EI26Aq23hXwmv97Zfy2VFrt5PLT8lAhnBIZvmaT5pQk+NuJ/GWj/QWaKSKbnoKDGLbV6qnhXg== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-normalize-timing-functions@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.1.tgz#ef937b7ca2fd62ed0b46645ea5728b842a3600db" + integrity sha512-4zcczzHqmCU7L5dqTB9rzeqPWRMc0K2HoR+Bfl+FSMbqGBUcP5LRfgcH4BdRtLuzVQK1/FHdFoGT3F7rkEnY+g== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-normalize-unicode@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.2.tgz#361026744ff11baebaec771b60c2a5f36f274fd0" + integrity sha512-Ff2VdAYCTGyMUwpevTZPZ4w0+mPjbZzLLyoLh/RMpqUqeQKZ+xMm31hkxBavDcGKcxm6ACzGk0nBfZ8LZkStKA== + dependencies: + browserslist "^4.22.2" + postcss-value-parser "^4.2.0" + +postcss-normalize-url@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-6.0.1.tgz#eae58cb4f5f9a4fa5bbbf6d4222dff534ad46186" + integrity sha512-jEXL15tXSvbjm0yzUV7FBiEXwhIa9H88JOXDGQzmcWoB4mSjZIsmtto066s2iW9FYuIrIF4k04HA2BKAOpbsaQ== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-normalize-whitespace@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.1.tgz#b5933750b938814c028d3d2b2e5c0199e0037b53" + integrity sha512-76i3NpWf6bB8UHlVuLRxG4zW2YykF9CTEcq/9LGAiz2qBuX5cBStadkk0jSkg9a9TCIXbMQz7yzrygKoCW9JuA== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-ordered-values@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-ordered-values/-/postcss-ordered-values-6.0.1.tgz#553e735d009065b362da93340e57f43d5f2d0fbc" + integrity sha512-XXbb1O/MW9HdEhnBxitZpPFbIvDgbo9NK4c/5bOfiKpnIGZDoL2xd7/e6jW5DYLsWxBbs+1nZEnVgnjnlFViaA== + dependencies: + cssnano-utils "^4.0.1" + postcss-value-parser "^4.2.0" + +postcss-reduce-initial@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-6.0.2.tgz#763d25902406c872264041df69f182eb15a5d9be" + integrity sha512-YGKalhNlCLcjcLvjU5nF8FyeCTkCO5UtvJEt0hrPZVCTtRLSOH4z00T1UntQPj4dUmIYZgMj8qK77JbSX95hSw== + dependencies: + browserslist "^4.22.2" + caniuse-api "^3.0.0" + +postcss-reduce-transforms@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.1.tgz#7bf59d7c6e7066e3b18ef17237d2344bd3da6d75" + integrity sha512-fUbV81OkUe75JM+VYO1gr/IoA2b/dRiH6HvMwhrIBSUrxq3jNZQZitSnugcTLDi1KkQh1eR/zi+iyxviUNBkcQ== + dependencies: + postcss-value-parser "^4.2.0" + +postcss-selector-parser@^6.0.11, postcss-selector-parser@^6.0.15, postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4: + version "6.0.15" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz#11cc2b21eebc0b99ea374ffb9887174855a01535" + integrity sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw== + dependencies: + cssesc "^3.0.0" + util-deprecate "^1.0.2" + +postcss-svgo@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-6.0.2.tgz#dbc9d03e7f346bc0d82443078602a951e0214836" + integrity sha512-IH5R9SjkTkh0kfFOQDImyy1+mTCb+E830+9SV1O+AaDcoHTvfsvt6WwJeo7KwcHbFnevZVCsXhDmjFiGVuwqFQ== + dependencies: + postcss-value-parser "^4.2.0" + svgo "^3.2.0" + +postcss-unique-selectors@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-6.0.2.tgz#09a34a5a31a649d3e9bca5962af0616f39d071d2" + integrity sha512-8IZGQ94nechdG7Y9Sh9FlIY2b4uS8/k8kdKRX040XHsS3B6d1HrJAkXrBSsSu4SuARruSsUjW3nlSw8BHkaAYQ== + dependencies: + postcss-selector-parser "^6.0.15" + +postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" + integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== + +postcss@^8.2.14, postcss@^8.4.24, postcss@^8.4.33: + version "8.4.33" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.33.tgz#1378e859c9f69bf6f638b990a0212f43e2aaa742" + integrity sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg== + dependencies: + nanoid "^3.3.7" + picocolors "^1.0.0" + source-map-js "^1.0.2" + +pretty-error@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-4.0.0.tgz#90a703f46dd7234adb46d0f84823e9d1cb8f10d6" + integrity sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw== + dependencies: + lodash "^4.17.20" + renderkid "^3.0.0" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +promise@^7.0.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + +proxy-addr@~2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" + integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + +prr@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw== + +pug-attrs@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-3.0.0.tgz#b10451e0348165e31fad1cc23ebddd9dc7347c41" + integrity sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA== + dependencies: + constantinople "^4.0.1" + js-stringify "^1.0.2" + pug-runtime "^3.0.0" + +pug-code-gen@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/pug-code-gen/-/pug-code-gen-3.0.2.tgz#ad190f4943133bf186b60b80de483100e132e2ce" + integrity sha512-nJMhW16MbiGRiyR4miDTQMRWDgKplnHyeLvioEJYbk1RsPI3FuA3saEP8uwnTb2nTJEKBU90NFVWJBk4OU5qyg== + dependencies: + constantinople "^4.0.1" + doctypes "^1.1.0" + js-stringify "^1.0.2" + pug-attrs "^3.0.0" + pug-error "^2.0.0" + pug-runtime "^3.0.0" + void-elements "^3.1.0" + with "^7.0.0" + +pug-error@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-2.0.0.tgz#5c62173cb09c34de2a2ce04f17b8adfec74d8ca5" + integrity sha512-sjiUsi9M4RAGHktC1drQfCr5C5eriu24Lfbt4s+7SykztEOwVZtbFk1RRq0tzLxcMxMYTBR+zMQaG07J/btayQ== + +pug-filters@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pug-filters/-/pug-filters-4.0.0.tgz#d3e49af5ba8472e9b7a66d980e707ce9d2cc9b5e" + integrity sha512-yeNFtq5Yxmfz0f9z2rMXGw/8/4i1cCFecw/Q7+D0V2DdtII5UvqE12VaZ2AY7ri6o5RNXiweGH79OCq+2RQU4A== + dependencies: + constantinople "^4.0.1" + jstransformer "1.0.0" + pug-error "^2.0.0" + pug-walk "^2.0.0" + resolve "^1.15.1" + +pug-lexer@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/pug-lexer/-/pug-lexer-5.0.1.tgz#ae44628c5bef9b190b665683b288ca9024b8b0d5" + integrity sha512-0I6C62+keXlZPZkOJeVam9aBLVP2EnbeDw3An+k0/QlqdwH6rv8284nko14Na7c0TtqtogfWXcRoFE4O4Ff20w== + dependencies: + character-parser "^2.2.0" + is-expression "^4.0.0" + pug-error "^2.0.0" + +pug-linker@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pug-linker/-/pug-linker-4.0.0.tgz#12cbc0594fc5a3e06b9fc59e6f93c146962a7708" + integrity sha512-gjD1yzp0yxbQqnzBAdlhbgoJL5qIFJw78juN1NpTLt/mfPJ5VgC4BvkoD3G23qKzJtIIXBbcCt6FioLSFLOHdw== + dependencies: + pug-error "^2.0.0" + pug-walk "^2.0.0" + +pug-load@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pug-load/-/pug-load-3.0.0.tgz#9fd9cda52202b08adb11d25681fb9f34bd41b662" + integrity sha512-OCjTEnhLWZBvS4zni/WUMjH2YSUosnsmjGBB1An7CsKQarYSWQ0GCVyd4eQPMFJqZ8w9xgs01QdiZXKVjk92EQ== + dependencies: + object-assign "^4.1.1" + pug-walk "^2.0.0" + +pug-parser@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/pug-parser/-/pug-parser-6.0.0.tgz#a8fdc035863a95b2c1dc5ebf4ecf80b4e76a1260" + integrity sha512-ukiYM/9cH6Cml+AOl5kETtM9NR3WulyVP2y4HOU45DyMim1IeP/OOiyEWRr6qk5I5klpsBnbuHpwKmTx6WURnw== + dependencies: + pug-error "^2.0.0" + token-stream "1.0.0" + +pug-runtime@^3.0.0, pug-runtime@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/pug-runtime/-/pug-runtime-3.0.1.tgz#f636976204723f35a8c5f6fad6acda2a191b83d7" + integrity sha512-L50zbvrQ35TkpHwv0G6aLSuueDRwc/97XdY8kL3tOT0FmhgG7UypU3VztfV/LATAvmUfYi4wNxSajhSAeNN+Kg== + +pug-strip-comments@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pug-strip-comments/-/pug-strip-comments-2.0.0.tgz#f94b07fd6b495523330f490a7f554b4ff876303e" + integrity sha512-zo8DsDpH7eTkPHCXFeAk1xZXJbyoTfdPlNR0bK7rpOMuhBYb0f5qUVCO1xlsitYd3w5FQTK7zpNVKb3rZoUrrQ== + dependencies: + pug-error "^2.0.0" + +pug-walk@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pug-walk/-/pug-walk-2.0.0.tgz#417aabc29232bb4499b5b5069a2b2d2a24d5f5fe" + integrity sha512-yYELe9Q5q9IQhuvqsZNwA5hfPkMJ8u92bQLIMcsMxf/VADjNtEYptU+inlufAFYcWdHlwNfZOEnOOQrZrcyJCQ== + +pug@^3.0.1, pug@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/pug/-/pug-3.0.2.tgz#f35c7107343454e43bc27ae0ff76c731b78ea535" + integrity sha512-bp0I/hiK1D1vChHh6EfDxtndHji55XP/ZJKwsRqrz6lRia6ZC2OZbdAymlxdVFwd1L70ebrVJw4/eZ79skrIaw== + dependencies: + pug-code-gen "^3.0.2" + pug-filters "^4.0.0" + pug-lexer "^5.0.1" + pug-linker "^4.0.0" + pug-load "^3.0.0" + pug-parser "^6.0.0" + pug-runtime "^3.0.1" + pug-strip-comments "^2.0.0" + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +qs@6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" + integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== + dependencies: + side-channel "^1.0.4" + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +range-parser@^1.2.1, range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" + integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + +readable-stream@^2.0.1: + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.0.6: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +rechoir@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22" + integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ== + dependencies: + resolve "^1.20.0" + +regenerate-unicode-properties@^10.1.0: + version "10.1.1" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz#6b0e05489d9076b04c436f318d9b067bba459480" + integrity sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q== + dependencies: + regenerate "^1.4.2" + +regenerate@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" + integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== + +regenerator-runtime@^0.13.2: + version "0.13.11" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" + integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== + +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + +regenerator-transform@^0.15.2: + version "0.15.2" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.2.tgz#5bbae58b522098ebdf09bca2f83838929001c7a4" + integrity sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg== + dependencies: + "@babel/runtime" "^7.8.4" + +regex-parser@^2.2.11: + version "2.3.0" + resolved "https://registry.yarnpkg.com/regex-parser/-/regex-parser-2.3.0.tgz#4bb61461b1a19b8b913f3960364bb57887f920ee" + integrity sha512-TVILVSz2jY5D47F4mA4MppkBrafEaiUWJO/TcZHEIuI13AqoZMkK1WMA4Om1YkYbTx+9Ki1/tSUXbceyr9saRg== + +regexpu-core@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.2.tgz#11a2b06884f3527aec3e93dbbf4a3b958a95546b" + integrity sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ== + dependencies: + "@babel/regjsgen" "^0.8.0" + regenerate "^1.4.2" + regenerate-unicode-properties "^10.1.0" + regjsparser "^0.9.1" + unicode-match-property-ecmascript "^2.0.0" + unicode-match-property-value-ecmascript "^2.1.0" + +regjsparser@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709" + integrity sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ== + dependencies: + jsesc "~0.5.0" + +renderkid@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-3.0.0.tgz#5fd823e4d6951d37358ecc9a58b1f06836b6268a" + integrity sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg== + dependencies: + css-select "^4.1.3" + dom-converter "^0.2.0" + htmlparser2 "^6.1.0" + lodash "^4.17.21" + strip-ansi "^6.0.1" + +repeat-string@^1.0.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== + +reprism@^0.0.11: + version "0.0.11" + resolved "https://registry.yarnpkg.com/reprism/-/reprism-0.0.11.tgz#e760b85e0ae241722032cb8942a2bcab992a9083" + integrity sha512-VsxDR5QxZo08M/3nRypNlScw5r3rKeSOPdU/QhDmu3Ai3BJxHn/qgfXGWQp/tAxUtzwYNo9W6997JZR0tPLZsA== + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve-url-loader@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-5.0.0.tgz#ee3142fb1f1e0d9db9524d539cfa166e9314f795" + integrity sha512-uZtduh8/8srhBoMx//5bwqjQ+rfYOUq8zC9NrMUGtjBiGTtFJM42s58/36+hTqeqINcnYe08Nj3LkK9lW4N8Xg== + dependencies: + adjust-sourcemap-loader "^4.0.0" + convert-source-map "^1.7.0" + loader-utils "^2.0.0" + postcss "^8.2.14" + source-map "0.6.1" + +resolve@^1.14.2, resolve@^1.15.1, resolve@^1.20.0: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +retry@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" + integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rimraf@^3.0.0, rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +schema-utils@^3.1.1, schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + +schema-utils@^4.0.0, schema-utils@^4.0.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.2.0.tgz#70d7c93e153a273a805801882ebd3bff20d89c8b" + integrity sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw== + dependencies: + "@types/json-schema" "^7.0.9" + ajv "^8.9.0" + ajv-formats "^2.1.1" + ajv-keywords "^5.1.0" + +select-hose@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" + integrity sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg== + +selfsigned@^2.1.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-2.4.1.tgz#560d90565442a3ed35b674034cec4e95dceb4ae0" + integrity sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q== + dependencies: + "@types/node-forge" "^1.3.0" + node-forge "^1" + +semver@^5.6.0: + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + +semver@^7.3.2, semver@^7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + +send@0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" + integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== + dependencies: + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "2.0.0" + mime "1.6.0" + ms "2.1.3" + on-finished "2.4.1" + range-parser "~1.2.1" + statuses "2.0.1" + +serialize-javascript@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== + dependencies: + randombytes "^2.1.0" + +serve-index@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" + integrity sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw== + dependencies: + accepts "~1.3.4" + batch "0.6.1" + debug "2.6.9" + escape-html "~1.0.3" + http-errors "~1.6.2" + mime-types "~2.1.17" + parseurl "~1.3.2" + +serve-static@1.15.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" + integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.18.0" + +set-function-length@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.0.tgz#2f81dc6c16c7059bda5ab7c82c11f03a515ed8e1" + integrity sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w== + dependencies: + define-data-property "^1.1.1" + function-bind "^1.1.2" + get-intrinsic "^1.2.2" + gopd "^1.0.1" + has-property-descriptors "^1.0.1" + +setprototypeof@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" + integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +shell-quote@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" + integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== + +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + +signal-exit@^3.0.2, signal-exit@^3.0.3: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +sockjs@^0.3.24: + version "0.3.24" + resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.24.tgz#c9bc8995f33a111bea0395ec30aa3206bdb5ccce" + integrity sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ== + dependencies: + faye-websocket "^0.11.3" + uuid "^8.3.2" + websocket-driver "^0.7.4" + +source-map-js@^1.0.1, source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@0.6.1, source-map@^0.6.0, source-map@~0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +spark-md5@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz#7952c4a30784347abcee73268e473b9c0167e3fc" + integrity sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw== + +spdy-transport@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" + integrity sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw== + dependencies: + debug "^4.1.0" + detect-node "^2.0.4" + hpack.js "^2.1.6" + obuf "^1.1.2" + readable-stream "^3.0.6" + wbuf "^1.7.3" + +spdy@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.2.tgz#b74f466203a3eda452c02492b91fb9e84a27677b" + integrity sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA== + dependencies: + debug "^4.1.0" + handle-thing "^2.0.0" + http-deceiver "^1.2.7" + select-hose "^2.0.0" + spdy-transport "^3.0.0" + +stackframe@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310" + integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw== + +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + +"statuses@>= 1.4.0 < 2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== + +string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +style-loader@^3.3.0: + version "3.3.4" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-3.3.4.tgz#f30f786c36db03a45cbd55b6a70d930c479090e7" + integrity sha512-0WqXzrsMTyb8yjZJHDqwmnwRJvhALK9LfRtRc6B4UTWe8AijYLZYZ9thuJTZc2VfQWINADW/j+LiJnfy2RoC1w== + +stylehacks@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-6.0.2.tgz#5bf2654561752547d4548765f35c9a49659b3742" + integrity sha512-00zvJGnCu64EpMjX8b5iCZ3us2Ptyw8+toEkb92VdmkEaRaSGBNKAoK6aWZckhXxmQP8zWiTaFaiMGIU8Ve8sg== + dependencies: + browserslist "^4.22.2" + postcss-selector-parser "^6.0.15" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +svgo@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/svgo/-/svgo-3.2.0.tgz#7a5dff2938d8c6096e00295c2390e8e652fa805d" + integrity sha512-4PP6CMW/V7l/GmKRKzsLR8xxjdHTV4IMvhTnpuHwwBazSIlw5W/5SmPjN8Dwyt7lKbSJrRDgp4t9ph0HgChFBQ== + dependencies: + "@trysound/sax" "0.2.0" + commander "^7.2.0" + css-select "^5.1.0" + css-tree "^2.3.1" + css-what "^6.1.0" + csso "^5.0.5" + picocolors "^1.0.0" + +sync-rpc@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/sync-rpc/-/sync-rpc-1.3.6.tgz#b2e8b2550a12ccbc71df8644810529deb68665a7" + integrity sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw== + dependencies: + get-port "^3.1.0" + +tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + +terser-webpack-plugin@^5.3.0, terser-webpack-plugin@^5.3.10: + version "5.3.10" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" + integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.20" + jest-worker "^27.4.5" + schema-utils "^3.1.1" + serialize-javascript "^6.0.1" + terser "^5.26.0" + +terser@^5.26.0: + version "5.27.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.27.0.tgz#70108689d9ab25fef61c4e93e808e9fd092bf20c" + integrity sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + +thunky@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" + integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== + +tmp@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== + dependencies: + rimraf "^3.0.0" + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + +token-stream@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-1.0.0.tgz#cc200eab2613f4166d27ff9afc7ca56d49df6eb4" + integrity sha512-VSsyNPPW74RpHwR8Fc21uubwHY7wMDeJLys2IX5zJNih+OnAnaifKHo+1LHT7DAdloQ7apeaaWg8l7qnf/TnEg== + +tslib@^1.10.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +unicode-canonical-property-names-ecmascript@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" + integrity sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ== + +unicode-match-property-ecmascript@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz#54fd16e0ecb167cf04cf1f756bdcc92eba7976c3" + integrity sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q== + dependencies: + unicode-canonical-property-names-ecmascript "^2.0.0" + unicode-property-aliases-ecmascript "^2.0.0" + +unicode-match-property-value-ecmascript@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz#cb5fffdcd16a05124f5a4b0bf7c3770208acbbe0" + integrity sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA== + +unicode-property-aliases-ecmascript@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd" + integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w== + +universalify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" + integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== + +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + +update-browserslist-db@^1.0.13: + version "1.0.13" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" + integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +utila@~0.4: + version "0.4.0" + resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" + integrity sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA== + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== + +uuid@^8.3.0, uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + +void-elements@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09" + integrity sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w== + +watchpack@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" + integrity sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + +wbuf@^1.1.0, wbuf@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/wbuf/-/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df" + integrity sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA== + dependencies: + minimalistic-assert "^1.0.0" + +webpack-cli@^5.0.0: + version "5.1.4" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-5.1.4.tgz#c8e046ba7eaae4911d7e71e2b25b776fcc35759b" + integrity sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg== + dependencies: + "@discoveryjs/json-ext" "^0.5.0" + "@webpack-cli/configtest" "^2.1.1" + "@webpack-cli/info" "^2.0.2" + "@webpack-cli/serve" "^2.0.5" + colorette "^2.0.14" + commander "^10.0.1" + cross-spawn "^7.0.3" + envinfo "^7.7.3" + fastest-levenshtein "^1.0.12" + import-local "^3.0.2" + interpret "^3.1.1" + rechoir "^0.8.0" + webpack-merge "^5.7.3" + +webpack-dev-middleware@^5.3.1: + version "5.3.3" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz#efae67c2793908e7311f1d9b06f2a08dcc97e51f" + integrity sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA== + dependencies: + colorette "^2.0.10" + memfs "^3.4.3" + mime-types "^2.1.31" + range-parser "^1.2.1" + schema-utils "^4.0.0" + +webpack-dev-server@^4.8.0: + version "4.15.1" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.15.1.tgz#8944b29c12760b3a45bdaa70799b17cb91b03df7" + integrity sha512-5hbAst3h3C3L8w6W4P96L5vaV0PxSmJhxZvWKYIdgxOQm8pNZ5dEOmmSLBVpP85ReeyRt6AS1QJNyo/oFFPeVA== + dependencies: + "@types/bonjour" "^3.5.9" + "@types/connect-history-api-fallback" "^1.3.5" + "@types/express" "^4.17.13" + "@types/serve-index" "^1.9.1" + "@types/serve-static" "^1.13.10" + "@types/sockjs" "^0.3.33" + "@types/ws" "^8.5.5" + ansi-html-community "^0.0.8" + bonjour-service "^1.0.11" + chokidar "^3.5.3" + colorette "^2.0.10" + compression "^1.7.4" + connect-history-api-fallback "^2.0.0" + default-gateway "^6.0.3" + express "^4.17.3" + graceful-fs "^4.2.6" + html-entities "^2.3.2" + http-proxy-middleware "^2.0.3" + ipaddr.js "^2.0.1" + launch-editor "^2.6.0" + open "^8.0.9" + p-retry "^4.5.0" + rimraf "^3.0.2" + schema-utils "^4.0.0" + selfsigned "^2.1.1" + serve-index "^1.9.1" + sockjs "^0.3.24" + spdy "^4.0.2" + webpack-dev-middleware "^5.3.1" + ws "^8.13.0" + +webpack-merge@^5.7.3: + version "5.10.0" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177" + integrity sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA== + dependencies: + clone-deep "^4.0.1" + flat "^5.0.2" + wildcard "^2.0.0" + +webpack-notifier@^1.15.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/webpack-notifier/-/webpack-notifier-1.15.0.tgz#72644a1a4ec96b3528704d28f79da5e70048e8ee" + integrity sha512-N2V8UMgRB5komdXQRavBsRpw0hPhJq2/SWNOGuhrXpIgRhcMexzkGQysUyGStHLV5hkUlgpRiF7IUXoBqyMmzQ== + dependencies: + node-notifier "^9.0.0" + strip-ansi "^6.0.0" + +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack@^5.75.0: + version "5.90.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.90.0.tgz#313bfe16080d8b2fee6e29b6c986c0714ad4290e" + integrity sha512-bdmyXRCXeeNIePv6R6tGPyy20aUobw4Zy8r0LUS2EWO+U+Ke/gYDgsCh7bl5rB6jPpr4r0SZa6dPxBxLooDT3w== + dependencies: + "@types/eslint-scope" "^3.7.3" + "@types/estree" "^1.0.5" + "@webassemblyjs/ast" "^1.11.5" + "@webassemblyjs/wasm-edit" "^1.11.5" + "@webassemblyjs/wasm-parser" "^1.11.5" + acorn "^8.7.1" + acorn-import-assertions "^1.9.0" + browserslist "^4.21.10" + chrome-trace-event "^1.0.2" + enhanced-resolve "^5.15.0" + es-module-lexer "^1.2.1" + eslint-scope "5.1.1" + events "^3.2.0" + glob-to-regexp "^0.4.1" + graceful-fs "^4.2.9" + json-parse-even-better-errors "^2.3.1" + loader-runner "^4.2.0" + mime-types "^2.1.27" + neo-async "^2.6.2" + schema-utils "^3.2.0" + tapable "^2.1.1" + terser-webpack-plugin "^5.3.10" + watchpack "^2.4.0" + webpack-sources "^3.2.3" + +websocket-driver@>=0.5.1, websocket-driver@^0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.4.tgz#89ad5295bbf64b480abcba31e4953aca706f5760" + integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== + dependencies: + http-parser-js ">=0.5.1" + safe-buffer ">=5.1.0" + websocket-extensions ">=0.1.1" + +websocket-extensions@>=0.1.1: + version "0.1.4" + resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" + integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== + +which@^2.0.1, which@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wildcard@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" + integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== + +with@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/with/-/with-7.0.2.tgz#ccee3ad542d25538a7a7a80aad212b9828495bac" + integrity sha512-RNGKj82nUPg3g5ygxkQl0R937xLyho1J24ItRCBTr/m1YnZkzJy1hUiHUJrc/VlsDQzsCnInEGSg3bci0Lmd4w== + dependencies: + "@babel/parser" "^7.9.6" + "@babel/types" "^7.9.6" + assert-never "^1.2.1" + babel-walk "3.0.0-canary-5" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +ws@^8.13.0: + version "8.16.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" + integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@^21.0.0: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yocto-queue@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" + integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== From 5a92ca5a482cc2227e988fb5a8c1ae14a2c3bf48 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 31 Jan 2024 17:34:21 +0100 Subject: [PATCH 018/202] Fix deprecations --- composer.json | 18 +- composer.lock | 1696 ++++++++++++----- .../RaBundle/Controller/LocaleController.php | 4 +- .../RaBundle/Controller/ProfileController.php | 4 +- .../Controller/RaLocationController.php | 12 +- .../Controller/RaManagementController.php | 32 +- .../RaBundle/Controller/RaaController.php | 7 +- .../Controller/RecoveryTokenController.php | 8 +- .../RaBundle/Controller/SamlController.php | 11 +- .../Controller/SecondFactorController.php | 14 +- .../Controller/SecurityController.php | 4 +- .../Controller/Vetting/GssfController.php | 4 +- .../Vetting/SecondFactorController.php | 4 +- .../Controller/Vetting/SmsController.php | 4 +- .../Controller/Vetting/YubikeyController.php | 2 +- .../RaBundle/Controller/VettingController.php | 8 +- .../Controller/VettingTypeHintController.php | 10 +- .../RaBundle/Resources/config/routing.yml | 10 +- .../Security/Firewall/SamlListener.php | 31 +- 19 files changed, 1310 insertions(+), 573 deletions(-) diff --git a/composer.json b/composer.json index 8b33e46d..012022ad 100644 --- a/composer.json +++ b/composer.json @@ -16,10 +16,10 @@ "fortawesome/font-awesome": "~4.2.0", "guzzlehttp/guzzle": "^6", "incenteev/composer-parameter-handler": "~2.0", - "jms/translation-bundle": "^1.5", - "knplabs/knp-paginator-bundle": "^5.0", - "nelmio/security-bundle": "2.9.*", - "openconext/monitor-bundle": "^2.0", + "jms/translation-bundle": "^2.1", + "knplabs/knp-paginator-bundle": "^5.9", + "nelmio/security-bundle": "^2.12", + "openconext/monitor-bundle": "^3.0", "ramsey/uuid": "^3.5", "sensio/framework-extra-bundle": "^5.5", "sensiolabs/security-checker": "^6.0", @@ -29,18 +29,18 @@ "symfony/asset": "4.4.*", "symfony/expression-language": "4.4.*", "symfony/flex": "^v2.4.3", - "symfony/form": "4.4.*", + "symfony/form": "4.4.* || ^5.1", "symfony/http-foundation": "^5.0", "symfony/monolog-bundle": "^3.5", "symfony/security-bundle": "4.4.*", "symfony/translation": "4.4.*", - "symfony/twig-bundle": "4.4.*", + "symfony/twig-bundle": "4.4.* |^5.1", "symfony/validator": "4.4.*", "symfony/webpack-encore-bundle": "^1.7", "twbs/bootstrap": "~3.3.0", "twig/extensions": "~1.5", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12" + "twig/twig": "^2.12|^3.0" }, "require-dev": { "matthiasnoback/symfony-config-test": "^4.0", @@ -117,13 +117,13 @@ "optimize-autoloader": true, "sort-packages": true, "platform": { - "php": "7.2.5" + "php": "8.2.5" } }, "extra": { "symfony": { "allow-contrib": false, - "require": "4.4.*" + "require": "4.4.* || ^5.0" }, "symfony-app-dir": "app", "symfony-var-dir": "var", diff --git a/composer.lock b/composer.lock index fd23bacf..9027d34b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "229358c4d66e01b03457a809470f1ea5", + "content-hash": "e1258b1b6ecee2b6a7463f048b07f0f9", "packages": [ { "name": "beberlei/assert", @@ -143,32 +143,35 @@ }, { "name": "doctrine/annotations", - "version": "1.13.3", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "648b0343343565c4a056bfc8392201385e8d89f0" + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/648b0343343565c4a056bfc8392201385e8d89f0", - "reference": "648b0343343565c4a056bfc8392201385e8d89f0", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", "shasum": "" }, "require": { - "doctrine/lexer": "1.*", + "doctrine/lexer": "^1 || ^2", "ext-tokenizer": "*", "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^1.4.10 || ^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2", + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6", "vimeo/psalm": "^4.10" }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, "type": "library", "autoload": { "psr-4": { @@ -210,37 +213,327 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.3" + "source": "https://github.com/doctrine/annotations/tree/1.14.3" }, - "time": "2022-07-02T10:48:51+00:00" + "time": "2023-02-01T09:20:38+00:00" }, { - "name": "doctrine/lexer", - "version": "1.2.3", + "name": "doctrine/cache", + "version": "2.2.0", "source": { "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "doctrine/coding-standard": "^9.0", - "phpstan/phpstan": "^1.3", + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.11" + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/2.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2022-05-20T20:07:39+00:00" + }, + { + "name": "doctrine/collections", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "72328a11443a0de79967104ad36ba7b30bded134" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/72328a11443a0de79967104ad36ba7b30bded134", + "reference": "72328a11443a0de79967104ad36ba7b30bded134", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1", + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^12", + "ext-json": "*", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^5.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Collections\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.", + "homepage": "https://www.doctrine-project.org/projects/collections.html", + "keywords": [ + "array", + "collections", + "iterators", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/collections/issues", + "source": "https://github.com/doctrine/collections/tree/2.1.4" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcollections", + "type": "tidelift" + } + ], + "time": "2023-10-03T09:22:33+00:00" + }, + { + "name": "doctrine/common", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/8b5e5650391f851ed58910b3e3d48a71062eeced", + "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced", + "shasum": "" + }, + "require": { + "doctrine/persistence": "^2.0 || ^3.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0 || ^10.0", + "doctrine/collections": "^1", + "phpstan/phpstan": "^1.4.1", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0", + "squizlabs/php_codesniffer": "^3.0", + "symfony/phpunit-bridge": "^6.1", + "vimeo/psalm": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.", + "homepage": "https://www.doctrine-project.org/projects/common.html", + "keywords": [ + "common", + "doctrine", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/common/issues", + "source": "https://github.com/doctrine/common/tree/3.4.3" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcommon", + "type": "tidelift" + } + ], + "time": "2022-10-09T11:47:59+00:00" + }, + { + "name": "doctrine/dbal", + "version": "3.8.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/d244f2e6e6bf32bff5174e6729b57214923ecec9", + "reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1|^2", + "php": "^7.4 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" + }, + "require-dev": { + "doctrine/coding-standard": "12.0.0", + "fig/log-test": "^1", + "jetbrains/phpstorm-stubs": "2023.1", + "phpstan/phpstan": "1.10.56", + "phpstan/phpstan-strict-rules": "^1.5", + "phpunit/phpunit": "9.6.15", + "psalm/plugin-phpunit": "0.18.4", + "slevomat/coding-standard": "8.13.1", + "squizlabs/php_codesniffer": "3.8.1", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/console": "^4.4|^5.4|^6.0|^7.0", + "vimeo/psalm": "4.30.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." }, + "bin": [ + "bin/doctrine-dbal" + ], "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Doctrine\\DBAL\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -256,23 +549,616 @@ "name": "Roman Borschel", "email": "roman@code-factory.org" }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.8.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2024-01-25T21:44:02+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2022-10-12T20:59:15+00:00" + }, + { + "name": "doctrine/inflector", + "version": "2.0.9", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^11.0", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25 || ^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.9" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2024-01-15T18:05:13+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:15:36+00:00" + }, + { + "name": "doctrine/lexer", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/2.1.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-12-14T08:49:07+00:00" + }, + { + "name": "doctrine/orm", + "version": "2.17.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/orm.git", + "reference": "ccfc97c32f63aaa0988ac6aa42e71c5590bb794d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/orm/zipball/ccfc97c32f63aaa0988ac6aa42e71c5590bb794d", + "reference": "ccfc97c32f63aaa0988ac6aa42e71c5590bb794d", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.12.1 || ^2.1.1", + "doctrine/collections": "^1.5 || ^2.1", + "doctrine/common": "^3.0.3", + "doctrine/dbal": "^2.13.1 || ^3.2", + "doctrine/deprecations": "^0.5.3 || ^1", + "doctrine/event-manager": "^1.2 || ^2", + "doctrine/inflector": "^1.4 || ^2.0", + "doctrine/instantiator": "^1.3 || ^2", + "doctrine/lexer": "^2", + "doctrine/persistence": "^2.4 || ^3", + "ext-ctype": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3", + "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", + "symfony/polyfill-php72": "^1.23", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "doctrine/annotations": "<1.13 || >= 3.0" + }, + "require-dev": { + "doctrine/annotations": "^1.13 || ^2", + "doctrine/coding-standard": "^9.0.2 || ^12.0", + "phpbench/phpbench": "^0.16.10 || ^1.0", + "phpstan/phpstan": "~1.4.10 || 1.10.35", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", + "psr/log": "^1 || ^2 || ^3", + "squizlabs/php_codesniffer": "3.7.2", + "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2 || ^7.0", + "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "vimeo/psalm": "4.30.0 || 5.16.0" + }, + "suggest": { + "ext-dom": "Provides support for XSD validation for XML mapping files", + "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\ORM\\": "lib/Doctrine/ORM" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "https://www.doctrine-project.org/projects/orm.html", + "keywords": [ + "database", + "orm" + ], + "support": { + "issues": "https://github.com/doctrine/orm/issues", + "source": "https://github.com/doctrine/orm/tree/2.17.4" + }, + "time": "2024-01-26T19:41:16+00:00" + }, + { + "name": "doctrine/persistence", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/persistence.git", + "reference": "63fee8c33bef740db6730eb2a750cd3da6495603" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/63fee8c33bef740db6730eb2a750cd3da6495603", + "reference": "63fee8c33bef740db6730eb2a750cd3da6495603", + "shasum": "" + }, + "require": { + "doctrine/event-manager": "^1 || ^2", + "php": "^7.2 || ^8.0", + "psr/cache": "^1.0 || ^2.0 || ^3.0" + }, + "conflict": { + "doctrine/common": "<2.10" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/coding-standard": "^11", + "doctrine/common": "^3.0", + "phpstan/phpstan": "1.9.4", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6.0", + "vimeo/psalm": "4.30.0 || 5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Persistence\\": "src/Persistence" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" } ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "description": "The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.", + "homepage": "https://www.doctrine-project.org/projects/persistence.html", "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" + "mapper", + "object", + "odm", + "orm", + "persistence" ], "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.3" + "issues": "https://github.com/doctrine/persistence/issues", + "source": "https://github.com/doctrine/persistence/tree/3.2.0" }, "funding": [ { @@ -284,11 +1170,11 @@ "type": "patreon" }, { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence", "type": "tidelift" } ], - "time": "2022-02-28T11:07:21+00:00" + "time": "2023-05-17T18:32:04+00:00" }, { "name": "fortawesome/font-awesome", @@ -703,50 +1589,57 @@ }, { "name": "jms/translation-bundle", - "version": "1.6.2", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSTranslationBundle.git", - "reference": "abb7df81fc5066368bbd50b2a80c12901e84561d" + "reference": "da38bd07cf3bc375a0db8aa5b839514faae70810" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/abb7df81fc5066368bbd50b2a80c12901e84561d", - "reference": "abb7df81fc5066368bbd50b2a80c12901e84561d", + "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/da38bd07cf3bc375a0db8aa5b839514faae70810", + "reference": "da38bd07cf3bc375a0db8aa5b839514faae70810", "shasum": "" }, "require": { - "nikic/php-parser": "^1.4 || ^2.0 || ^3.0 || ^4.0", - "php": "^7.2 || ^8.0", - "symfony/console": "^3.4 || ^4.3 || ^5.0", - "symfony/expression-language": "^3.4 || ^4.3 || ^5.0", - "symfony/framework-bundle": "^3.4.31 || ^4.3 || ^5.0", - "symfony/translation": "^3.4 || ^4.3 || ^5.0", - "symfony/translation-contracts": "^1.1 || ^2.0", - "symfony/validator": "^3.4 || ^4.3 || ^5.0", + "nikic/php-parser": "^4.9", + "php": "^7.4 || ^8.0", + "psr/log": "^1.0 || ^2.0", + "symfony/config": "^4.3 || ^5.4 || ^6.2", + "symfony/console": "^4.3 || ^5.4 || ^6.0", + "symfony/expression-language": "^4.3 || ^5.4 || ^6.0", + "symfony/framework-bundle": "^4.3 || ^5.4 || ^6.0", + "symfony/translation": "^4.3 || ^5.4 || ^6.0", + "symfony/translation-contracts": "^1.1 || ^2.0 || ^3.0", + "symfony/validator": "^4.3 || ^5.4 || ^6.0", "twig/twig": "^1.42.4 || ^2.12.5 || ^3.0" }, "require-dev": { - "doctrine/annotations": "^1.8", - "doctrine/coding-standard": "^8.0", + "doctrine/annotations": "^1.11", + "doctrine/coding-standard": "^8.2.1", "matthiasnoback/symfony-dependency-injection-test": "^4.1", "nyholm/nsa": "^1.0.1", - "phpunit/phpunit": "^8.3", - "psr/log": "^1.0", - "sensio/framework-extra-bundle": "^5.4", - "symfony/asset": "^3.4 || ^4.3 || ^5.0", - "symfony/browser-kit": "^3.4 || ^4.3 || ^5.0", - "symfony/css-selector": "^3.4 || ^4.3 || ^5.0", - "symfony/filesystem": "^3.4 || ^4.3 || ^5.0", - "symfony/form": "^3.4 || ^4.3 || ^5.0", - "symfony/security-csrf": "^3.4 || ^4.3 || ^5.0", - "symfony/templating": "^3.4 || ^4.3 || ^5.0", - "symfony/twig-bundle": "^3.4.37 || ^4.3.11 || ^5.0" + "sensio/framework-extra-bundle": "^6.2.4", + "symfony/asset": "^4.4 || ^5.4 || ^6.4", + "symfony/browser-kit": "^4.4 || ^5.4 || ^6.4", + "symfony/css-selector": "^4.4 || ^5.4 || ^6.4", + "symfony/filesystem": "^4.4 || ^5.4 || ^6.4", + "symfony/flex": "^1.19 || ^2.0", + "symfony/form": "^4.4 || ^5.4 || ^6.4", + "symfony/phpunit-bridge": "^4.4 || ^5.4 || ^6.4", + "symfony/property-access": "^4.4 || ^5.4 || ^6.4", + "symfony/routing": "^4.4.15 || ^5.4 || ^6.4", + "symfony/security-csrf": "^4.4 || ^5.4 || ^6.4", + "symfony/templating": "^4.4 || ^5.4 || ^6.4", + "symfony/twig-bundle": "^4.4 || ^5.4 || ^6.4" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "2.x-dev" + }, + "symfony": { + "allow-contrib": true } }, "autoload": { @@ -778,9 +1671,9 @@ ], "support": { "issues": "https://github.com/schmittjoh/JMSTranslationBundle/issues", - "source": "https://github.com/schmittjoh/JMSTranslationBundle/tree/1.6.2" + "source": "https://github.com/schmittjoh/JMSTranslationBundle/tree/2.1.0" }, - "time": "2022-02-15T08:17:38+00:00" + "time": "2023-12-12T09:42:26+00:00" }, { "name": "knplabs/knp-components", @@ -864,39 +1757,40 @@ }, { "name": "knplabs/knp-paginator-bundle", - "version": "v5.3.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/KnpLabs/KnpPaginatorBundle.git", - "reference": "87ca999b6ac886e3f20a1e3abc07523140509ca4" + "reference": "7879916a8af4f4d4668535cb0b71f55cc416da66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/87ca999b6ac886e3f20a1e3abc07523140509ca4", - "reference": "87ca999b6ac886e3f20a1e3abc07523140509ca4", + "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/7879916a8af4f4d4668535cb0b71f55cc416da66", + "reference": "7879916a8af4f4d4668535cb0b71f55cc416da66", "shasum": "" }, "require": { - "knplabs/knp-components": "^2.4", - "php": "^7.2", - "symfony/config": "^4.4 || ^5.0", - "symfony/dependency-injection": "^4.4 || ^5.0", - "symfony/event-dispatcher": "^4.4 || ^5.0", - "symfony/http-foundation": "^4.4 || ^5.0", - "symfony/http-kernel": "^4.4 || ^5.0", - "symfony/routing": "^4.4 || ^5.0", - "symfony/translation": "^4.4 || ^5.0", + "knplabs/knp-components": "^2.4 || ^3.0", + "php": "^7.3 || ^8.0", + "symfony/config": "^4.4 || ^5.4 || ^6.0", + "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0", + "symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0", + "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0", + "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0", + "symfony/routing": "^4.4 || ^5.4 || ^6.0", + "symfony/translation": "^4.4 || ^5.4 || ^6.0", "twig/twig": "^2.0 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.2", - "symfony/expression-language": "^4.4 || ^5.0", - "symfony/templating": "^4.4 || ^5.0" + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^8.5 || ^9.5", + "symfony/expression-language": "^4.4 || ^5.4 || ^6.0", + "symfony/templating": "^4.4 || ^5.4 || ^6.0" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "5.3.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -931,9 +1825,9 @@ ], "support": { "issues": "https://github.com/KnpLabs/KnpPaginatorBundle/issues", - "source": "https://github.com/KnpLabs/KnpPaginatorBundle/tree/master" + "source": "https://github.com/KnpLabs/KnpPaginatorBundle/tree/v5.9.0" }, - "time": "2020-07-21T07:55:12+00:00" + "time": "2022-08-28T14:42:14+00:00" }, { "name": "monolog/monolog", @@ -1078,41 +1972,38 @@ }, { "name": "nelmio/security-bundle", - "version": "v2.9.1", + "version": "v2.12.0", "source": { "type": "git", "url": "https://github.com/nelmio/NelmioSecurityBundle.git", - "reference": "89ac385b28496691bfa7eef24d60aec9f20021a1" + "reference": "dc8b8c3ee5c64715486e1e3947f83f4169f4374f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nelmio/NelmioSecurityBundle/zipball/89ac385b28496691bfa7eef24d60aec9f20021a1", - "reference": "89ac385b28496691bfa7eef24d60aec9f20021a1", + "url": "https://api.github.com/repos/nelmio/NelmioSecurityBundle/zipball/dc8b8c3ee5c64715486e1e3947f83f4169f4374f", + "reference": "dc8b8c3ee5c64715486e1e3947f83f4169f4374f", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0|9.99.99", + "paragonie/random_compat": "~1.0|~2.0|~9.99.99", "php": ">5.4", - "symfony/framework-bundle": "~2.3|~v3.0|~4.0|~5.0", - "symfony/security-core": "~2.3|~3.0|~4.0|~5.0", - "symfony/security-csrf": "~2.3|~3.0|~4.0|~5.0", - "symfony/security-http": "~2.3|~3.0|~4.0|~5.0", + "symfony/framework-bundle": "~2.3|~v3.0|~4.0|~5.0|~6.0", + "symfony/security-core": "~2.3|~3.0|~4.0|~5.0|~6.0", + "symfony/security-csrf": "~2.3|~3.0|~4.0|~5.0|~6.0", + "symfony/security-http": "~2.3|~3.0|~4.0|~5.0|~6.0", + "symfony/yaml": "~2.3|~3.0|~4.0|~5.0|~6.0", "ua-parser/uap-php": "^3.4.4" }, "require-dev": { "doctrine/cache": "^1.0", "psr/cache": "^1.0", - "symfony/phpunit-bridge": "^5.0.5", - "symfony/yaml": "~2.3|~3.0|~4.0|~5.0", + "symfony/phpunit-bridge": "^5.0.5|^6.0", "twig/twig": "^1.38|^2.10|^3.0" }, - "suggest": { - "ua-parser/uap-php": "To allow adapt CSP directives given the user-agent" - }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.9.x-dev" + "dev-master": "2.11.x-dev" } }, "autoload": { @@ -1143,9 +2034,9 @@ ], "support": { "issues": "https://github.com/nelmio/NelmioSecurityBundle/issues", - "source": "https://github.com/nelmio/NelmioSecurityBundle/tree/v2.9.1" + "source": "https://github.com/nelmio/NelmioSecurityBundle/tree/v2.12.0" }, - "time": "2020-05-11T08:12:17+00:00" + "time": "2022-02-23T06:10:58+00:00" }, { "name": "nikic/php-parser", @@ -1205,35 +2096,36 @@ }, { "name": "openconext/monitor-bundle", - "version": "2.1.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/OpenConext/Monitor-bundle.git", - "reference": "f06e967b702bc5d78d85c39ba4a90219af152a67" + "reference": "719c34a5a00b0a2089ddc52abfe0876fc6ed9049" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Monitor-bundle/zipball/f06e967b702bc5d78d85c39ba4a90219af152a67", - "reference": "f06e967b702bc5d78d85c39ba4a90219af152a67", + "url": "https://api.github.com/repos/OpenConext/Monitor-bundle/zipball/719c34a5a00b0a2089ddc52abfe0876fc6ed9049", + "reference": "719c34a5a00b0a2089ddc52abfe0876fc6ed9049", "shasum": "" }, "require": { - "php": ">=5.4,<8.0-dev", - "symfony/dependency-injection": ">=3.4,<5", - "symfony/framework-bundle": ">=3.4,<5", - "webmozart/assert": "^1.2" + "doctrine/orm": "^2.9", + "php": ">=7.2, <9.0-dev", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^4.4|^5.0|^6.0", + "webmozart/assert": "^1.10" }, "require-dev": { - "jakub-onderka/php-parallel-lint": "^0.9.2", - "malukenho/docheader": "^0.1.6", - "matthiasnoback/symfony-config-test": "^2.1", - "mockery/mockery": "~0.9", - "phpdocumentor/reflection-docblock": "3.3.*", + "malukenho/docheader": "^0.1.8", + "matthiasnoback/symfony-config-test": "^4.3", + "mockery/mockery": "^1.3.5|^1.4.4", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpdocumentor/reflection-docblock": "^5.2", "phpmd/phpmd": "^2.6", - "phpunit/php-token-stream": "1.4.*", - "phpunit/phpunit": "^5.7", - "sebastian/phpcpd": "^3.0", - "squizlabs/php_codesniffer": "^3.1" + "phpunit/php-token-stream": "^3.1.3|^4.0.4", + "phpunit/phpunit": "^8.5|^9.0", + "sebastian/phpcpd": "^4.1|^5.0|^6.0", + "squizlabs/php_codesniffer": "^3.6" }, "type": "symfony-bundle", "autoload": { @@ -1245,7 +2137,7 @@ "license": [ "Apache-2.0" ], - "description": "A Symfony 4 bundle that facilitates health and info endpoints to a Symfony application. The bundle is backwards compatible with Symfony 2 projects.", + "description": "A Symfony 4/5/6 bundle that facilitates health and info endpoints to a Symfony application. The bundle is backwards compatible with Symfony 2 projects.", "keywords": [ "OpenConext", "health", @@ -1255,9 +2147,9 @@ ], "support": { "issues": "https://github.com/OpenConext/Monitor-bundle/issues", - "source": "https://github.com/OpenConext/Monitor-bundle/tree/2.1.0" + "source": "https://github.com/OpenConext/Monitor-bundle/tree/3.1.0" }, - "time": "2021-09-28T11:09:57+00:00" + "time": "2022-04-19T12:42:45+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -1328,20 +2220,20 @@ }, { "name": "paragonie/random_compat", - "version": "v9.99.99", + "version": "v9.99.100", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", "shasum": "" }, "require": { - "php": "^7" + "php": ">= 7" }, "require-dev": { "phpunit/phpunit": "4.*|5.*", @@ -1374,7 +2266,7 @@ "issues": "https://github.com/paragonie/random_compat/issues", "source": "https://github.com/paragonie/random_compat" }, - "time": "2018-07-02T15:55:56+00:00" + "time": "2020-10-15T08:29:30+00:00" }, { "name": "phpseclib/bcmath_compat", @@ -1440,16 +2332,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.19", + "version": "3.0.35", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "cc181005cf548bfd8a4896383bb825d859259f95" + "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cc181005cf548bfd8a4896383bb825d859259f95", - "reference": "cc181005cf548bfd8a4896383bb825d859259f95", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4b1827beabce71953ca479485c0ae9c51287f2fe", + "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe", "shasum": "" }, "require": { @@ -1530,7 +2422,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.19" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.35" }, "funding": [ { @@ -1546,24 +2438,24 @@ "type": "tidelift" } ], - "time": "2023-03-05T17:13:09+00:00" + "time": "2023-12-29T01:59:53+00:00" }, { "name": "psr/cache", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -1583,7 +2475,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -1593,26 +2485,26 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/2.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:23:37+00:00" }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -1641,9 +2533,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/http-message", @@ -2384,32 +3276,33 @@ }, { "name": "symfony/cache", - "version": "v4.4.48", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "3b98ed664887ad197b8ede3da2432787212eb915" + "reference": "db1adb004e2da984085d0178964eb6f319d3cba1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/3b98ed664887ad197b8ede3da2432787212eb915", - "reference": "3b98ed664887ad197b8ede3da2432787212eb915", + "url": "https://api.github.com/repos/symfony/cache/zipball/db1adb004e2da984085d0178964eb6f319d3cba1", + "reference": "db1adb004e2da984085d0178964eb6f319d3cba1", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "psr/cache": "^1.0|^2.0", - "psr/log": "^1|^2|^3", + "psr/log": "^1.1|^2|^3", "symfony/cache-contracts": "^1.1.7|^2", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.2|^5.0" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "conflict": { - "doctrine/dbal": "<2.7", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4|>=5.0", + "doctrine/dbal": "<2.13.1", + "symfony/dependency-injection": "<4.4", + "symfony/http-kernel": "<4.4", "symfony/var-dumper": "<4.4" }, "provide": { @@ -2420,14 +3313,15 @@ "require-dev": { "cache/integration-tests": "dev-master", "doctrine/cache": "^1.6|^2.0", - "doctrine/dbal": "^2.7|^3.0", + "doctrine/dbal": "^2.13.1|^3|^4", "predis/predis": "^1.1", "psr/simple-cache": "^1.0|^2.0", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^3.4|^4.1|^5.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/filesystem": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -2459,7 +3353,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v4.4.48" + "source": "https://github.com/symfony/cache/tree/v5.4.35" }, "funding": [ { @@ -2475,7 +3369,7 @@ "type": "tidelift" } ], - "time": "2022-10-17T20:21:54+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/cache-contracts", @@ -3100,16 +3994,16 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.13", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e" + "reference": "761c8b8387cfe5f8026594a75fdf0a4e83ba6974" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/1d5cd762abaa6b2a4169d3e77610193a7157129e", - "reference": "1d5cd762abaa6b2a4169d3e77610193a7157129e", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/761c8b8387cfe5f8026594a75fdf0a4e83ba6974", + "reference": "761c8b8387cfe5f8026594a75fdf0a4e83ba6974", "shasum": "" }, "require": { @@ -3159,7 +4053,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.13" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.10.0" }, "funding": [ { @@ -3175,7 +4069,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/expression-language", @@ -3242,21 +4136,22 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.42", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5" + "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5", - "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5a553607d4ffbfa9c0ab62facadea296c9db7086", + "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", "symfony/polyfill-php80": "^1.16" }, "type": "library", @@ -3285,7 +4180,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.42" + "source": "https://github.com/symfony/filesystem/tree/v5.4.35" }, "funding": [ { @@ -3301,24 +4196,25 @@ "type": "tidelift" } ], - "time": "2022-05-20T08:49:14+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/finder", - "version": "v4.4.44", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "66bd787edb5e42ff59d3523f623895af05043e4f" + "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/66bd787edb5e42ff59d3523f623895af05043e4f", - "reference": "66bd787edb5e42ff59d3523f623895af05043e4f", + "url": "https://api.github.com/repos/symfony/finder/zipball/abe6d6f77d9465fed3cd2d029b29d03b56b56435", + "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php80": "^1.16" }, "type": "library", @@ -3347,7 +4243,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v4.4.44" + "source": "https://github.com/symfony/finder/tree/v5.4.35" }, "funding": [ { @@ -3363,7 +4259,7 @@ "type": "tidelift" } ], - "time": "2022-07-29T07:35:46+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/flex", @@ -3530,16 +4426,16 @@ }, { "name": "symfony/framework-bundle", - "version": "v4.4.49", + "version": "v4.4.51", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "d8cf2558249004a29b8e27b1f6eae52337ff471b" + "reference": "8f1698ff2a97be8442fb202ac93111f7b6b40781" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/d8cf2558249004a29b8e27b1f6eae52337ff471b", - "reference": "d8cf2558249004a29b8e27b1f6eae52337ff471b", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/8f1698ff2a97be8442fb202ac93111f7b6b40781", + "reference": "8f1698ff2a97be8442fb202ac93111f7b6b40781", "shasum": "" }, "require": { @@ -3656,7 +4552,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v4.4.49" + "source": "https://github.com/symfony/framework-bundle/tree/v4.4.51" }, "funding": [ { @@ -3835,16 +4731,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.4.21", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3bb6ee5582366c4176d5ce596b380117c8200bbf" + "reference": "f2ab692a22aef1cd54beb893aa0068bdfb093928" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3bb6ee5582366c4176d5ce596b380117c8200bbf", - "reference": "3bb6ee5582366c4176d5ce596b380117c8200bbf", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f2ab692a22aef1cd54beb893aa0068bdfb093928", + "reference": "f2ab692a22aef1cd54beb893aa0068bdfb093928", "shasum": "" }, "require": { @@ -3891,7 +4787,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.21" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.35" }, "funding": [ { @@ -3907,20 +4803,20 @@ "type": "tidelift" } ], - "time": "2023-02-17T21:35:35+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.4.50", + "version": "v4.4.51", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "aa6df6c045f034aa13ac752fc234bb300b9488ef" + "reference": "ad8ab192cb619ff7285c95d28c69b36d718416c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/aa6df6c045f034aa13ac752fc234bb300b9488ef", - "reference": "aa6df6c045f034aa13ac752fc234bb300b9488ef", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ad8ab192cb619ff7285c95d28c69b36d718416c7", + "reference": "ad8ab192cb619ff7285c95d28c69b36d718416c7", "shasum": "" }, "require": { @@ -3995,7 +4891,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v4.4.50" + "source": "https://github.com/symfony/http-kernel/tree/v4.4.51" }, "funding": [ { @@ -4011,7 +4907,7 @@ "type": "tidelift" } ], - "time": "2023-02-01T08:01:31+00:00" + "time": "2023-11-10T13:31:29+00:00" }, { "name": "symfony/inflector", @@ -4175,31 +5071,39 @@ }, { "name": "symfony/mime", - "version": "v4.4.47", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "0eaf33cd6d1b3eaa50e7bc48b17f6e45789df35d" + "reference": "ee94d9b538f93abbbc1ee4ccff374593117b04a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/0eaf33cd6d1b3eaa50e7bc48b17f6e45789df35d", - "reference": "0eaf33cd6d1b3eaa50e7bc48b17f6e45789df35d", + "url": "https://api.github.com/repos/symfony/mime/zipball/ee94d9b538f93abbbc1ee4ccff374593117b04a9", + "reference": "ee94d9b538f93abbbc1ee4ccff374593117b04a9", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16" }, "conflict": { "egulias/email-validator": "~3.0.0", - "symfony/mailer": "<4.4" + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4", + "symfony/serializer": "<5.4.35|>=6,<6.3.12|>=6.4,<6.4.3" }, "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1", - "symfony/dependency-injection": "^3.4|^4.1|^5.0" + "egulias/email-validator": "^2.1.10|^3.1|^4", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.4.35|~6.3.12|^6.4.3" }, "type": "library", "autoload": { @@ -4231,7 +5135,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v4.4.47" + "source": "https://github.com/symfony/mime/tree/v5.4.35" }, "funding": [ { @@ -4247,7 +5151,7 @@ "type": "tidelift" } ], - "time": "2022-10-03T15:15:11+00:00" + "time": "2024-01-30T08:00:51+00:00" }, { "name": "symfony/monolog-bridge", @@ -4479,16 +5383,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -4503,7 +5407,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4541,7 +5445,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -4557,7 +5461,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-icu", @@ -4648,16 +5552,16 @@ }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da" + "reference": "ecaafce9f77234a6a449d29e49267ba10499116d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/ecaafce9f77234a6a449d29e49267ba10499116d", + "reference": "ecaafce9f77234a6a449d29e49267ba10499116d", "shasum": "" }, "require": { @@ -4671,7 +5575,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4715,7 +5619,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.28.0" }, "funding": [ { @@ -4731,20 +5635,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:30:37+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -4756,7 +5660,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4799,7 +5703,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -4815,20 +5719,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -4843,7 +5747,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4882,7 +5786,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -4898,20 +5802,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", "shasum": "" }, "require": { @@ -4920,7 +5824,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4958,7 +5862,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" }, "funding": [ { @@ -4974,20 +5878,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -4996,7 +5900,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5037,7 +5941,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -5053,20 +5957,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -5075,7 +5979,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5120,7 +6024,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -5136,20 +6040,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", "shasum": "" }, "require": { @@ -5158,7 +6062,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5199,7 +6103,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" }, "funding": [ { @@ -5215,7 +6119,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/property-access", @@ -5571,28 +6475,29 @@ }, { "name": "symfony/security-csrf", - "version": "v4.4.37", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "45c956ef58135091f53732646a0acd28034f02c0" + "reference": "6728ed79d7f9aae3b86fca7ea554f1c46bae1e0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/45c956ef58135091f53732646a0acd28034f02c0", - "reference": "45c956ef58135091f53732646a0acd28034f02c0", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/6728ed79d7f9aae3b86fca7ea554f1c46bae1e0b", + "reference": "6728ed79d7f9aae3b86fca7ea554f1c46bae1e0b", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php80": "^1.16", - "symfony/security-core": "^3.4|^4.0|^5.0" + "symfony/security-core": "^4.4|^5.0|^6.0" }, "conflict": { - "symfony/http-foundation": "<3.4" + "symfony/http-foundation": "<5.3" }, "require-dev": { - "symfony/http-foundation": "^3.4|^4.0|^5.0" + "symfony/http-foundation": "^5.3|^6.0" }, "suggest": { "symfony/http-foundation": "For using the class SessionTokenStorage." @@ -5623,7 +6528,7 @@ "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-csrf/tree/v4.4.37" + "source": "https://github.com/symfony/security-csrf/tree/v5.4.35" }, "funding": [ { @@ -5639,7 +6544,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/security-guard", @@ -6106,16 +7011,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v4.4.49", + "version": "v4.4.51", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113" + "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113", - "reference": "d6b0fbfd5e2fab79c0c7b8dfe579e47ee0999113", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/83b021cd395053ed30327b9ee5d3fd60631f73f5", + "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5", "shasum": "" }, "require": { @@ -6203,7 +7108,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v4.4.49" + "source": "https://github.com/symfony/twig-bridge/tree/v4.4.51" }, "funding": [ { @@ -6219,7 +7124,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T09:41:56+00:00" + "time": "2023-11-09T21:17:38+00:00" }, { "name": "symfony/twig-bundle", @@ -6417,33 +7322,33 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.47", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "1069c7a3fca74578022fab6f81643248d02f8e63" + "reference": "ce4685b30e47d94dfc990c5566285ff99ddf012b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1069c7a3fca74578022fab6f81643248d02f8e63", - "reference": "1069c7a3fca74578022fab6f81643248d02f8e63", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ce4685b30e47d94dfc990c5566285ff99ddf012b", + "reference": "ce4685b30e47d94dfc990c5566285ff99ddf012b", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5", "symfony/polyfill-php80": "^1.16" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" + "symfony/console": "<4.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0", + "twig/twig": "^2.13|^3.0.4" }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", @@ -6486,7 +7391,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v4.4.47" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.35" }, "funding": [ { @@ -6502,28 +7407,28 @@ "type": "tidelift" } ], - "time": "2022-10-03T15:15:11+00:00" + "time": "2024-01-23T14:28:09+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.4.21", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "be74908a6942fdd331554b3cec27ff41b45ccad4" + "reference": "a8c12b5448a5ac685347f5eeb2abf6a571ec16b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/be74908a6942fdd331554b3cec27ff41b45ccad4", - "reference": "be74908a6942fdd331554b3cec27ff41b45ccad4", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/a8c12b5448a5ac685347f5eeb2abf6a571ec16b8", + "reference": "a8c12b5448a5ac685347f5eeb2abf6a571ec16b8", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" }, "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9|^6.0" + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -6556,10 +7461,12 @@ "export", "hydrate", "instantiate", + "lazy-loading", + "proxy", "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.4.21" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.3" }, "funding": [ { @@ -6575,7 +7482,7 @@ "type": "tidelift" } ], - "time": "2023-02-21T19:46:44+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/webpack-encore-bundle", @@ -6917,16 +7824,16 @@ }, { "name": "twig/twig", - "version": "v2.15.3", + "version": "v2.16.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "ab402673db8746cb3a4c46f3869d6253699f614a" + "reference": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ab402673db8746cb3a4c46f3869d6253699f614a", - "reference": "ab402673db8746cb3a4c46f3869d6253699f614a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/0c9cc7ef2e0ec6d20c5af1200522a89ba101f623", + "reference": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623", "shasum": "" }, "require": { @@ -6937,12 +7844,12 @@ }, "require-dev": { "psr/container": "^1.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + "symfony/phpunit-bridge": "^5.4.9|^6.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.15-dev" + "dev-master": "2.16-dev" } }, "autoload": { @@ -6981,7 +7888,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.15.3" + "source": "https://github.com/twigphp/Twig/tree/v2.16.0" }, "funding": [ { @@ -6993,7 +7900,7 @@ "type": "tidelift" } ], - "time": "2022-09-28T08:40:08+00:00" + "time": "2023-12-22T07:22:15+00:00" }, { "name": "ua-parser/uap-php", @@ -7255,167 +8162,6 @@ ], "time": "2022-02-25T21:32:43+00:00" }, - { - "name": "doctrine/inflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "vimeo/psalm": "^4.10" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", - "homepage": "https://www.doctrine-project.org/projects/inflector.html", - "keywords": [ - "inflection", - "inflector", - "lowercase", - "manipulation", - "php", - "plural", - "singular", - "strings", - "uppercase", - "words" - ], - "support": { - "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", - "type": "tidelift" - } - ], - "time": "2021-10-22T20:16:43+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-03-03T08:28:38+00:00" - }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -10039,7 +10785,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "7.2.5" + "php": "8.2.5" }, "plugin-api-version": "2.6.0" } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index e49a1998..b276ea4d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -21,12 +21,12 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Command\SwitchLocaleCommand; use Surfnet\StepupBundle\Form\Type\SwitchLocaleType; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -final class LocaleController extends Controller +final class LocaleController extends AbstractController { public function switchLocaleAction(Request $request) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index 3f2aae09..a8dc7996 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -19,9 +19,9 @@ namespace Surfnet\StepupRa\RaBundle\Controller; use Surfnet\StepupRa\RaBundle\Service\ProfileService; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -final class ProfileController extends Controller +final class ProfileController extends AbstractController { public function profileAction() { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 9cbd0603..5f405c3f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -29,7 +29,7 @@ use Surfnet\StepupRa\RaBundle\Form\Type\RemoveRaLocationType; use Surfnet\StepupRa\RaBundle\Form\Type\SelectInstitutionType; use Surfnet\StepupRa\RaBundle\Service\ProfileService; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -39,7 +39,7 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) By making the Form Type classes explicit, MD now realizes couping * is to high. */ -final class RaLocationController extends Controller +final class RaLocationController extends AbstractController { /** * @Template @@ -48,7 +48,7 @@ final class RaLocationController extends Controller */ public function manageAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $institutionParameter = $request->get('institution'); @@ -111,7 +111,7 @@ public function manageAction(Request $request) public function createAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); $institution = $request->get('institution'); @@ -149,7 +149,7 @@ public function createAction(Request $request) public function changeAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); $requestedLocationId = $request->get('locationId'); @@ -202,7 +202,7 @@ public function changeAction(Request $request) */ public function removeAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 7f7a9034..20c82ede 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -31,22 +31,24 @@ use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaListingType; use Surfnet\StepupRa\RaBundle\Service\RaListingService; use Surfnet\StepupRa\RaBundle\Value\RoleAtInstitution; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class RaManagementController extends Controller +class RaManagementController extends AbstractController { /** * @param Request $request - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function manageAction(Request $request) + public function manageAction(Request $request): Response { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); $logger = $this->get('logger'); $institution = $this->getUser()->institution; @@ -100,11 +102,12 @@ public function manageAction(Request $request) /** * @param Request $request - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function raCandidateSearchAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); $logger = $this->get('logger'); $identity = $this->getCurrentUser(); @@ -157,11 +160,12 @@ public function raCandidateSearchAction(Request $request) /** * @param Request $request - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function createRaAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); $logger = $this->get('logger'); $logger->notice('Page for Accreditation of Identity to Ra or Raa requested'); @@ -216,11 +220,12 @@ public function createRaAction(Request $request) * @param Request $request * @param $identityId * @param $raInstitution - * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response */ public function amendRaInformationAction(Request $request, $identityId, $raInstitution) { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); $logger = $this->get('logger'); $logger->notice(sprintf("Loading information amendment form for RA(A) '%s'", $identityId)); @@ -263,11 +268,12 @@ public function amendRaInformationAction(Request $request, $identityId, $raInsti * @param Request $request * @param $identityId * @param $raInstitution - * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response */ public function retractRegistrationAuthorityAction(Request $request, $identityId, $raInstitution) { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); $logger = $this->get('logger'); $logger->notice(sprintf("Loading retract registration authority form for RA(A) '%s'", $identityId)); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index d5fc7c9a..8550aa9e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -24,14 +24,15 @@ use Surfnet\StepupRa\RaBundle\Command\SelectInstitutionCommand; use Surfnet\StepupRa\RaBundle\Form\Type\SelectInstitutionType; use Surfnet\StepupRa\RaBundle\Service\InstitutionConfigurationOptionsService; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; -class RaaController extends Controller +class RaaController extends AbstractController { public function institutionConfigurationAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); $logger = $this->get('logger'); /** @var Identity $identity */ diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 4aa52066..dc34c698 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -28,13 +28,13 @@ use Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRecoveryTokensType; use Surfnet\StepupRa\RaBundle\Service\RecoveryTokenService; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -final class RecoveryTokenController extends Controller +final class RecoveryTokenController extends AbstractController { /** * @var RecoveryTokenService @@ -68,7 +68,7 @@ public function __construct( public function searchAction(Request $request): Response { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $identity = $this->getCurrentUser(); $this->get('logger')->notice('Starting search for recovery tokens'); @@ -122,7 +122,7 @@ public function searchAction(Request $request): Response public function revokeAction(Request $request): RedirectResponse { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $this->logger->notice('Received request to revoke recovery token'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index f2c7f405..1fcef58c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -19,21 +19,22 @@ namespace Surfnet\StepupRa\RaBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Surfnet\SamlBundle\Http\PostBinding; use Surfnet\SamlBundle\Http\XMLResponse; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Surfnet\SamlBundle\Metadata\MetadataFactory; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; -class SamlController extends Controller +class SamlController extends AbstractController { /** * @Template */ public function consumeAssertionAction(Request $httpRequest) { - /** @var \Surfnet\SamlBundle\Http\PostBinding $postBinding */ + /** @var PostBinding $postBinding */ $postBinding = $this->get('surfnet_saml.http.post_binding'); - /** @var \SAML2\Assertion $assertion */ $assertion = $postBinding->processResponse( $httpRequest, $this->get('surfnet_saml.remote.idp'), @@ -45,7 +46,7 @@ public function consumeAssertionAction(Request $httpRequest) public function metadataAction() { - /** @var \Surfnet\SamlBundle\Metadata\MetadataFactory $metadataFactory */ + /** @var MetadataFactory $metadataFactory */ $metadataFactory = $this->get('surfnet_saml.metadata_factory'); return new XMLResponse($metadataFactory->generate()); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 57e2e59f..ad70c939 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -26,7 +26,7 @@ use Surfnet\StepupRa\RaBundle\Command\SearchSecondFactorAuditLogCommand; use Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaSecondFactorsType; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -35,7 +35,7 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) By making the Form Type classes explicit, MD now realizes couping * is to high. */ -final class SecondFactorController extends Controller +final class SecondFactorController extends AbstractController { /** * @Template @@ -44,7 +44,7 @@ final class SecondFactorController extends Controller */ public function searchAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $identity = $this->getCurrentUser(); $this->get('logger')->notice('Starting search for second factors'); @@ -62,7 +62,7 @@ public function searchAction(Request $request) $form = $this->createForm(SearchRaSecondFactorsType::class, $command, [ 'method' => 'get', - 'enable_export_button' => $this->isGranted(['ROLE_RAA']), + 'enable_export_button' => $this->isGranted('ROLE_RAA'), ]); $form->handleRequest($request); @@ -102,7 +102,7 @@ public function searchAction(Request $request) public function exportAction(SearchRaSecondFactorsCommand $command) { - $this->denyAccessUnlessGranted(['ROLE_RAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); $this->get('logger')->notice('Starting export of searched second factors'); @@ -117,7 +117,7 @@ public function exportAction(SearchRaSecondFactorsCommand $command) */ public function revokeAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); @@ -157,7 +157,7 @@ public function revokeAction(Request $request) */ public function auditLogAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); $identityId = $request->get('identityId'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index cf0f671c..f5b2c33b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -18,10 +18,10 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; -class SecurityController extends Controller +class SecurityController extends AbstractController { public function sessionExpiredAction(Request $request) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index 00640dad..8eee04f4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -49,7 +49,7 @@ public function initiateAction($procedureId, $provider) { $this->assertSecondFactorEnabled($provider); - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); @@ -71,7 +71,7 @@ public function authenticateAction($procedureId, $provider) { $this->assertSecondFactorEnabled($provider); - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Generating GSSF verification request', ['provider' => $provider]); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php index cd7cfe31..a261b238 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php @@ -18,9 +18,9 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -abstract class SecondFactorController extends Controller +abstract class SecondFactorController extends AbstractController { /** * @param string $type diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 6fa2bdff..980e9ff9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -44,7 +44,7 @@ public function sendChallengeAction(Request $request, $procedureId) { $this->assertSecondFactorEnabled('sms'); - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Received request for Send SMS Challenge page'); @@ -108,7 +108,7 @@ public function sendChallengeAction(Request $request, $procedureId) public function provePossessionAction(Request $request, $procedureId) { $this->assertSecondFactorEnabled('sms'); - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Received request for Proof of Possession of SMS Second Factor page'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 8e30c8f7..b97992a4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -39,7 +39,7 @@ public function verifyAction(Request $request, $procedureId) { $this->assertSecondFactorEnabled('yubikey'); - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Requested Yubikey Verfication'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index fb469ac2..2b6522b8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -30,7 +30,7 @@ use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; use Surfnet\StepupRa\RaBundle\Service\SecondFactorService; use Surfnet\StepupRa\RaBundle\Service\VettingService; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\SubmitButton; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -41,7 +41,7 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ -class VettingController extends Controller +class VettingController extends AbstractController { /** * @Template @@ -53,7 +53,7 @@ class VettingController extends Controller */ public function startProcedureAction(Request $request) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); $identity = $this->getIdentity(); @@ -192,7 +192,7 @@ public function cancelProcedureAction($procedureId) */ public function verifyIdentityAction(Request $request, $procedureId) { - $this->denyAccessUnlessGranted(['ROLE_RA']); + $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Verify Identity Form requested'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index 22a33bce..cde9d9a9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -27,10 +27,11 @@ use Surfnet\StepupRa\RaBundle\Service\InstitutionListingService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; use Surfnet\StepupRa\RaBundle\Service\VettingTypeHintService; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; -class VettingTypeHintController extends Controller +class VettingTypeHintController extends AbstractController { /** * @var LoggerInterface @@ -74,9 +75,10 @@ public function __construct( /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) Given the two forms being handled in this action, cc is higher. */ - public function vettingTypeHintAction(Request $request) + public function vettingTypeHintAction(Request $request): Response { - $this->denyAccessUnlessGranted(['ROLE_RAA', 'ROLE_SRAA']); + $this->denyAccessUnlessGranted('ROLE_RAA'); + $this->denyAccessUnlessGranted('ROLE_SRAA'); /** @var Identity $identity */ $identity = $this->getUser(); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml index 847ced43..c7d22807 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml @@ -31,22 +31,22 @@ ra_location_remove: ra_second_factors_search: path: /second-factors methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:SecondFactor:search } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::searchAction} ra_second_factor_revoke: path: /second-factors/revoke methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:SecondFactor:revoke } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::revokeAction } ra_second_factor_auditlog: path: /second-factors/{identityId}/auditlog methods: [GET] - defaults: { _controller: SurfnetStepupRaRaBundle:SecondFactor:auditLog } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::auditLogAction } ra_recovery_tokens_search: path: /recovery-tokens methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RecoveryToken:search } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RecoveryTokenController::searchAction } ra_recovery_tokens_revoke: path: /recovery-tokens/revoke @@ -116,7 +116,7 @@ ra_vetting_completed: ra_management_manage: path: /management/ra methods: [GET] - defaults: { _controller: SurfnetStepupRaRaBundle:RaManagement:manage } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaManagementController::manageAction } ra_management_ra_candidate_search: path: /management/search-ra-candidate diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php b/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php index a42e345e..79aae9f6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php @@ -22,41 +22,22 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Security\Authentication\Handler\AuthenticationHandler; use Surfnet\StepupRa\RaBundle\Security\Authentication\SamlInteractionProvider; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\Security\Core\Exception\AuthenticationException; -use Symfony\Component\Security\Http\Firewall\ListenerInterface; +use Symfony\Component\HttpKernel\Event\RequestEvent; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SamlListener implements ListenerInterface +class SamlListener { - /** - * @var AuthenticationHandler - */ - private $authenticationHandler; - - /** - * @var SamlInteractionProvider - */ - private $samlInteractionProvider; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - AuthenticationHandler $authenticationHandler, - SamlInteractionProvider $samlInteractionProvider, - LoggerInterface $logger + private readonly AuthenticationHandler $authenticationHandler, + private readonly SamlInteractionProvider $samlInteractionProvider, + private readonly LoggerInterface $logger ) { - $this->authenticationHandler = $authenticationHandler; - $this->samlInteractionProvider = $samlInteractionProvider; - $this->logger = $logger; } - public function handle(GetResponseEvent $event) + public function __invoke(RequestEvent $event): void { try { $this->authenticationHandler->process($event); From a8f2193bd7aed8f23b73dcefd4b2daee332e04cf Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 09:05:56 +0100 Subject: [PATCH 019/202] 1st Rector run LevelSetList::UP_TO_PHP_82, ClassPropertyAssignToConstructorPromotionRector::class, SymfonySetList::SYMFONY_44, --- ci/qa/phpcs.xml | 4 + composer.json | 4 +- composer.lock | 192 +++++++++++++++++- config/bootstrap.php | 2 +- public/index.php | 4 +- src/Kernel.php | 6 +- src/Surfnet/StepupRa/RaBundle/Assert.php | 12 +- .../Command/ExportRaSecondFactorsCommand.php | 9 +- .../Command/SearchRaSecondFactorsCommand.php | 8 +- .../Command/VettingTypeHintCommand.php | 12 +- .../RaBundle/Controller/LocaleController.php | 6 +- .../Controller/RaLocationController.php | 10 +- .../Controller/RaManagementController.php | 25 +-- .../RaBundle/Controller/RaaController.php | 2 +- .../Controller/RecoveryTokenController.php | 38 +--- .../RaBundle/Controller/SamlController.php | 2 +- .../Controller/SecondFactorController.php | 15 +- .../Controller/SecurityController.php | 2 +- .../Controller/Vetting/GssfController.php | 28 ++- .../Controller/Vetting/SmsController.php | 14 +- .../Controller/Vetting/YubikeyController.php | 1 - .../RaBundle/Controller/VettingController.php | 24 +-- .../Controller/VettingTypeHintController.php | 45 +--- .../DependencyInjection/Configuration.php | 24 +-- .../SurfnetStepupRaRaExtension.php | 6 +- .../InconsistentStateListener.php | 12 +- .../RaBundle/EventListener/LocaleListener.php | 19 +- .../Exception/AssertionFailedException.php | 9 +- .../Exception/InvalidArgumentException.php | 6 +- .../Form/Extension/RaRoleChoiceList.php | 4 +- .../Extension/SecondFactorTypeChoiceList.php | 34 +--- ...ndRegistrationAuthorityInformationType.php | 7 +- .../Form/Type/ChangeRaLocationType.php | 7 +- .../RaBundle/Form/Type/ChangeRaRoleType.php | 11 +- .../Form/Type/CreateRaLocationType.php | 7 +- .../RaBundle/Form/Type/CreateRaType.php | 6 +- .../RaBundle/Form/Type/InitiateGssfType.php | 10 +- .../StepupRa/RaBundle/Form/Type/OtpType.php | 2 +- .../Form/Type/RemoveRaLocationType.php | 3 +- .../Type/RetractRegistrationAuthorityType.php | 7 +- .../Form/Type/RevokeSecondFactorType.php | 3 +- .../Form/Type/RoleAtInstitutionType.php | 11 +- .../Form/Type/SearchRaCandidatesType.php | 2 +- .../Form/Type/SearchRaSecondFactorsType.php | 12 +- .../Form/Type/SearchRecoveryTokensType.php | 2 +- .../Form/Type/SelectInstitutionType.php | 6 +- .../Form/Type/SendSmsChallengeType.php | 3 +- .../Form/Type/StartVettingProcedureType.php | 10 +- .../RaBundle/Form/Type/VerifyIdentityType.php | 3 +- .../Form/Type/VerifyPhoneNumberType.php | 7 +- .../Form/Type/VerifyYubikeyPublicIdType.php | 3 +- .../Form/Type/VettingTypeHintType.php | 10 +- .../RaBundle/Logger/ProcedureAwareLogger.php | 9 +- .../SessionVettingProcedureRepository.php | 9 +- .../Handler/AuthenticatedUserHandler.php | 30 +-- .../Handler/ExplicitSessionTimeoutHandler.php | 57 +----- .../InitiateSamlAuthenticationHandler.php | 60 +----- .../Handler/LogoutSuccessHandler.php | 15 +- .../ProcessSamlAuthenticationHandler.php | 64 +----- .../Authentication/Provider/SamlProvider.php | 44 +--- .../SamlInteractionProvider.php | 67 ++---- .../Session/SessionLifetimeGuard.php | 20 +- .../Authentication/Session/SessionStorage.php | 15 +- .../Authentication/Token/SamlToken.php | 20 +- .../RaBundle/Security/Factory/SamlFactory.php | 8 +- .../Security/Firewall/SamlListener.php | 8 +- .../RaBundle/Service/AuditLogService.php | 9 +- .../RaBundle/Service/CommandService.php | 18 +- .../RaBundle/Service/GlobalViewParameters.php | 10 +- .../StepupRa/RaBundle/Service/GssfService.php | 10 +- .../RaBundle/Service/IdentityService.php | 38 +--- ...InstitutionConfigurationOptionsService.php | 13 +- .../Service/InstitutionListingService.php | 14 +- .../Service/LocaleProviderService.php | 10 +- .../RaBundle/Service/ProfileService.php | 16 +- .../RaBundle/Service/RaCandidateService.php | 41 +--- .../RaBundle/Service/RaListingService.php | 17 +- .../RaBundle/Service/RaLocationService.php | 32 +-- .../RaBundle/Service/RaSecondFactorExport.php | 13 +- .../Service/RaSecondFactorService.php | 42 +--- .../StepupRa/RaBundle/Service/RaService.php | 22 +- .../RaBundle/Service/RecoveryTokenService.php | 23 +-- .../RaBundle/Service/SecondFactorService.php | 22 +- .../RaBundle/Service/VettingService.php | 101 ++------- .../Service/VettingTypeHintService.php | 28 +-- .../VerificationResult.php | 16 +- .../Service/YubikeySecondFactorService.php | 27 +-- .../RaBundle/Service/YubikeyService.php | 19 +- .../Service/YubikeyVerificationResult.php | 14 +- .../Extensions/Extension/SecondFactorType.php | 10 +- .../StepupRa/RaBundle/Value/DateTime.php | 17 +- .../StepupRa/RaBundle/Value/TimeFrame.php | 18 +- .../StepupRa/RaBundle/VettingProcedure.php | 16 +- .../Compiler/ViewConfigCollectionPass.php | 2 +- .../DependencyInjection/Configuration.php | 16 +- ...netStepupRaSamlStepupProviderExtension.php | 44 ++-- .../Exception/InvalidArgumentException.php | 4 +- .../Exception/UnknownProviderException.php | 4 +- .../Provider/Metadata.php | 9 +- .../Provider/Provider.php | 35 +--- .../Provider/ProviderRepository.php | 5 +- .../Provider/ViewConfig.php | 21 +- .../Saml/StateHandler.php | 13 +- symfony.lock | 4 +- 104 files changed, 623 insertions(+), 1287 deletions(-) diff --git a/ci/qa/phpcs.xml b/ci/qa/phpcs.xml index 8e73a4dc..863065d1 100644 --- a/ci/qa/phpcs.xml +++ b/ci/qa/phpcs.xml @@ -21,4 +21,8 @@ + + + + diff --git a/composer.json b/composer.json index 012022ad..96bccfe3 100644 --- a/composer.json +++ b/composer.json @@ -49,6 +49,7 @@ "phpmd/phpmd": "^2.6", "phpunit/phpunit": "8.5.*", "rector/rector": "^0.19.5", + "slevomat/coding-standard": "^8.13", "sebastian/exporter": "3.1.*", "squizlabs/php_codesniffer": "^3.4", "symfony/dotenv": "4.4.*", @@ -112,7 +113,8 @@ }, "config": { "allow-plugins": { - "symfony/flex": true + "symfony/flex": true, + "dealerdirect/phpcodesniffer-composer-installer": true }, "optimize-autoloader": true, "sort-packages": true, diff --git a/composer.lock b/composer.lock index 9027d34b..fcd33614 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e1258b1b6ecee2b6a7463f048b07f0f9", + "content-hash": "27059ace1999dcd4abca5b7838c7c501", "packages": [ { "name": "beberlei/assert", @@ -8162,6 +8162,84 @@ ], "time": "2022-02-25T21:32:43+00:00" }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "time": "2023-01-05T11:28:13+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -8988,6 +9066,53 @@ }, "time": "2021-12-08T12:19:24+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.25.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", + "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" + }, + "time": "2024-01-04T17:06:16+00:00" + }, { "name": "phpstan/phpstan", "version": "1.10.57", @@ -10226,6 +10351,71 @@ }, "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "8.14.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.23.1", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "phing/phing": "2.17.4", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.10.37", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.14", + "phpstan/phpstan-strict-rules": "1.5.1", + "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2023-10-08T07:28:08+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.7.1", diff --git a/config/bootstrap.php b/config/bootstrap.php index 19bdb9a5..7c2cf308 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -12,5 +12,5 @@ $_SERVER += $_ENV; $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; -$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; +$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/public/index.php b/public/index.php index 8ea2cf09..6fb28cd7 100644 --- a/public/index.php +++ b/public/index.php @@ -12,13 +12,13 @@ } if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); + Request::setTrustedProxies(explode(',', (string) $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); } if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { Request::setTrustedHosts([$trustedHosts]); } -if (isset($_COOKIE['testcookie']) && strpos($_SERVER['HTTP_USER_AGENT'], 'GuzzleHttp') !== false) { +if (isset($_COOKIE['testcookie']) && str_contains((string) $_SERVER['HTTP_USER_AGENT'], 'GuzzleHttp')) { $_SERVER['APP_ENV'] = 'smoketest'; $_SERVER['APP_DEBUG'] = true; } diff --git a/src/Kernel.php b/src/Kernel.php index 1cd05726..10e367d7 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -8,6 +8,8 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\RouteCollectionBuilder; +use function dirname; +use const PHP_VERSION_ID; class Kernel extends BaseKernel { @@ -27,13 +29,13 @@ public function registerBundles(): iterable public function getProjectDir(): string { - return \dirname(__DIR__); + return dirname(__DIR__); } protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); - $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug); + $container->setParameter('container.dumper.inline_class_loader', PHP_VERSION_ID < 70400 || $this->debug); $container->setParameter('container.dumper.inline_factories', true); $confDir = $this->getProjectDir().'/config'; diff --git a/src/Surfnet/StepupRa/RaBundle/Assert.php b/src/Surfnet/StepupRa/RaBundle/Assert.php index e841ad4d..d36b211b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Assert.php +++ b/src/Surfnet/StepupRa/RaBundle/Assert.php @@ -23,7 +23,7 @@ final class Assert extends Assertion { - protected static $exceptionClass = '\Surfnet\StepupRa\RaBundle\Exception\AssertionFailedException'; + protected static $exceptionClass = AssertionFailedException::class; public static function keysAre(array $array, array $expectedKeys, $propertyPath = null) { @@ -42,12 +42,12 @@ public static function keysAre(array $array, array $expectedKeys, $propertyPath if ($givenCount < $expectedCount) { $message = sprintf( 'Required keys "%s" are missing', - implode('", "', array_diff($expectedKeys, $givenKeys)) + implode('", "', array_diff($expectedKeys, $givenKeys)), ); } elseif ($givenCount > $expectedCount) { $message = sprintf( 'Additional keys "%s" found', - implode('", "', array_diff($givenKeys, $expectedKeys)) + implode('", "', array_diff($givenKeys, $expectedKeys)), ); } else { $additional = array_diff($givenKeys, $expectedKeys); @@ -57,18 +57,18 @@ public static function keysAre(array $array, array $expectedKeys, $propertyPath if (!empty($additional)) { $message .= sprintf( ', additional keys "%s" found', - implode('", "', array_diff($givenKeys, $expectedKeys)) + implode('", "', array_diff($givenKeys, $expectedKeys)), ); } if (!empty($required)) { $message .= sprintf( ', required keys "%s" are missing', - implode('", "', array_diff($expectedKeys, $givenKeys)) + implode('", "', array_diff($expectedKeys, $givenKeys)), ); } } - throw new AssertionFailedException($message, 0, $propertyPath, $array); + throw new AssertionFailedException($message, 0, $array, $propertyPath); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php index 4df93c1a..1ba4cf11 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php @@ -22,10 +22,10 @@ final class ExportRaSecondFactorsCommand { - const STATUS_UNVERIFIED = 'unverified'; - const STATUS_VERIFIED = 'verified'; - const STATUS_VETTED = 'vetted'; - const STATUS_REVOKED = 'revoked'; + public const STATUS_UNVERIFIED = 'unverified'; + public const STATUS_VERIFIED = 'verified'; + public const STATUS_VETTED = 'vetted'; + public const STATUS_REVOKED = 'revoked'; /** * @Assert\NotBlank(message="ra.search_ra_second_factors.actor.blank") @@ -89,7 +89,6 @@ final class ExportRaSecondFactorsCommand /** * Builds the command from a SearchRaSecondFactorsCommand - * @param SearchRaSecondFactorsCommand $command * @return ExportRaSecondFactorsCommand */ public static function fromSearchCommand(SearchRaSecondFactorsCommand $command) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php index 5853317d..ff600488 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php @@ -22,10 +22,10 @@ final class SearchRaSecondFactorsCommand { - const STATUS_UNVERIFIED = 'unverified'; - const STATUS_VERIFIED = 'verified'; - const STATUS_VETTED = 'vetted'; - const STATUS_REVOKED = 'revoked'; + public const STATUS_UNVERIFIED = 'unverified'; + public const STATUS_VERIFIED = 'verified'; + public const STATUS_VETTED = 'vetted'; + public const STATUS_REVOKED = 'revoked'; /** * @Assert\NotBlank(message="ra.search_ra_second_factors.actor.blank") diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php index 6b113b3e..305e2fb2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php @@ -89,7 +89,7 @@ public function __isset($name): bool try { $this->assertValidLanguageInName($name); $locale = $this->extractLocaleFromFormFieldName($name); - } catch (RuntimeException $e) { + } catch (RuntimeException) { return false; } return array_key_exists($locale, $this->hints); @@ -108,8 +108,8 @@ private function assertValidLanguageInName($name) 'An invalid language ("%s") was rendered on the VettingTypeHintType form. ' . 'Unable to process it in VettingTypeHintCommand. Configure it in the ' . 'parameters.yaml or investigate why this rogue language ended up on the form.', - $locale - ) + $locale, + ), ); } } @@ -118,7 +118,7 @@ private function extractLocaleFromFormFieldName(string $name): string { if (empty($this->locales)) { throw new RuntimeException( - 'No locales have been configured on the command yet, unable to process vetting type hints' + 'No locales have been configured on the command yet, unable to process vetting type hints', ); } @@ -131,8 +131,8 @@ private function extractLocaleFromFormFieldName(string $name): string 'Unable to extract a locale from the form field name "%s". The field name prefix ' . 'did not match the configured value "%s"', $name, - $prefix - ) + $prefix, + ), ); } return $matches[1]; diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index b276ea4d..89d40144 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -35,10 +35,10 @@ public function switchLocaleAction(Request $request) // Return URLs generated by us always include a path (ie. at least a forward slash) // @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878 $domain = $request->getSchemeAndHttpHost() . '/'; - if (strpos($returnUrl, $domain) !== 0) { + if (!str_starts_with($returnUrl, $domain)) { $this->get('logger')->error(sprintf( 'Identity "%s" used illegal return-url for redirection after changing locale, aborting request', - $this->getIdentity()->id + $this->getIdentity()->id, )); throw new BadRequestHttpException('Invalid return-url given'); @@ -59,7 +59,7 @@ public function switchLocaleAction(Request $request) $form = $this->createForm( SwitchLocaleType::class, $command, - ['route' => 'ra_switch_locale', 'route_parameters' => ['return_url' => $returnUrl]] + ['route' => 'ra_switch_locale', 'route_parameters' => ['return_url' => $returnUrl]], ); $form->handleRequest($request); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 5f405c3f..9ace7bd7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -43,7 +43,6 @@ final class RaLocationController extends AbstractController { /** * @Template - * @param Request $request * @return array|Response */ public function manageAction(Request $request) @@ -95,7 +94,7 @@ public function manageAction(Request $request) $this->get('logger')->notice(sprintf( 'Searching for RA locations yielded "%d" results', - $locations->getTotalItems() + $locations->getTotalItems(), )); return [ @@ -131,7 +130,7 @@ public function createAction(Request $request) if ($success) { $this->addFlash( 'success', - $this->get('translator')->trans('ra.create_ra_location.created') + $this->get('translator')->trans('ra.create_ra_location.created'), ); $logger->debug('RA Location added, redirecting to the RA location overview'); @@ -180,7 +179,7 @@ public function changeAction(Request $request) if ($success) { $this->addFlash( 'success', - $this->get('translator')->trans('ra.create_ra_location.changed') + $this->get('translator')->trans('ra.create_ra_location.changed'), ); $logger->debug('RA Location added, redirecting to the RA location overview'); @@ -197,7 +196,6 @@ public function changeAction(Request $request) } /** - * @param Request $request * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function removeAction(Request $request) @@ -218,7 +216,7 @@ public function removeAction(Request $request) 'Sending middleware request to remove RA location "%s" belonging to "%s" on behalf of "%s"', $command->locationId, $command->institution, - $command->currentUserId + $command->currentUserId, )); $translator = $this->get('translator'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 20c82ede..7a2cf6fd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -42,7 +42,6 @@ class RaManagementController extends AbstractController { /** - * @param Request $request * @return Response */ public function manageAction(Request $request): Response @@ -77,13 +76,13 @@ public function manageAction(Request $request): Response $pagination = $this->getPaginator()->paginate( $raList->getTotalItems() > 0 ? $raList->getElements() : [], $raList->getCurrentPage(), - $raList->getItemsPerPage() + $raList->getItemsPerPage(), ); $pagination->setTotalItemCount($raList->getTotalItems()); $logger->notice(sprintf( 'Searching for RA(A)s yielded "%d" results', - $raList->getTotalItems() + $raList->getTotalItems(), )); /** @var \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListing[] $raListings */ @@ -96,12 +95,11 @@ public function manageAction(Request $request): Response 'raList' => $raListings, 'numberOfResults' => $raList->getTotalItems(), 'pagination' => $pagination, - ] + ], ); } /** - * @param Request $request * @return Response */ public function raCandidateSearchAction(Request $request) @@ -138,14 +136,14 @@ public function raCandidateSearchAction(Request $request) $pagination = $this->getPaginator()->paginate( $raCandidateList->getTotalItems() > 0 ? $raCandidateList->getElements() : [], $raCandidateList->getCurrentPage(), - $raCandidateList->getItemsPerPage() + $raCandidateList->getItemsPerPage(), ); $pagination->setTotalItemCount($raCandidateList->getTotalItems()); $logger->notice(sprintf( 'Searching for RaCandidates within institution "%s" yielded "%s" results', $institution, - $raCandidateList->getTotalItems() + $raCandidateList->getTotalItems(), )); return $this->render( @@ -154,12 +152,11 @@ public function raCandidateSearchAction(Request $request) 'form' => $form->createView(), 'raCandidates' => $raCandidateList, 'pagination' => $pagination - ] + ], ); } /** - * @param Request $request * @return Response */ public function createRaAction(Request $request) @@ -178,9 +175,7 @@ public function createRaAction(Request $request) throw new NotFoundHttpException(); } - $options = array_map(function (RaCandidateInstitution $institution) { - return $institution->institution; - }, $raCandidate->institutions->getElements()); + $options = array_map(fn(RaCandidateInstitution $institution) => $institution->institution, $raCandidate->institutions->getElements()); $selectOptions = array_combine($options, $options); $command = new AccreditCandidateCommand(); @@ -199,7 +194,7 @@ public function createRaAction(Request $request) if ($success) { $this->addFlash( 'success', - $this->get('translator')->trans('ra.management.create_ra.identity_accredited') + $this->get('translator')->trans('ra.management.create_ra.identity_accredited'), ); $logger->debug('Identity Accredited, redirecting to candidate overview'); @@ -217,7 +212,6 @@ public function createRaAction(Request $request) } /** - * @param Request $request * @param $identityId * @param $raInstitution * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response @@ -265,7 +259,6 @@ public function amendRaInformationAction(Request $request, $identityId, $raInsti } /** - * @param Request $request * @param $identityId * @param $raInstitution * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response @@ -306,7 +299,7 @@ public function retractRegistrationAuthorityAction(Request $request, $identityId $logger->notice(sprintf( 'Could not retract Registration Authority credentials for identity "%s"', - $identityId + $identityId, )); $this->addFlash('error', 'ra.management.retract_ra.middleware_command_failed'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index 8550aa9e..224a9ce4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -79,7 +79,7 @@ public function institutionConfigurationAction(Request $request) 'configuration' => (array)$configuration, 'form' => isset($form) ? $form->createView() : null, 'institution' => $institution, - ] + ], ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index dc34c698..7477bdf2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -36,34 +36,12 @@ final class RecoveryTokenController extends AbstractController { - /** - * @var RecoveryTokenService - */ - private $recoveryTokenService; - - /** - * @var Paginator - */ - private $paginator; - - /** @var TokenStorageInterface */ - private $tokenStorage; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - RecoveryTokenService $recoveryTokenService, - Paginator $paginator, - TokenStorageInterface $tokenStorage, - LoggerInterface $logger + private readonly RecoveryTokenService $recoveryTokenService, + private readonly Paginator $paginator, + private readonly TokenStorageInterface $tokenStorage, + private readonly LoggerInterface $logger, ) { - $this->recoveryTokenService = $recoveryTokenService; - $this->paginator = $paginator; - $this->tokenStorage = $tokenStorage; - $this->logger = $logger; } public function searchAction(Request $request): Response @@ -94,7 +72,7 @@ public function searchAction(Request $request): Response $pagination = $this->paginator->paginate( $recoveryTokens->getElements(), $recoveryTokens->getCurrentPage(), - $recoveryTokens->getItemsPerPage() + $recoveryTokens->getItemsPerPage(), ); $pagination->setTotalItemCount($recoveryTokenCount); @@ -102,7 +80,7 @@ public function searchAction(Request $request): Response $this->logger->notice(sprintf( 'Searching for recovery tokens yielded "%d" results', - $recoveryTokenCount + $recoveryTokenCount, )); return $this->render( @@ -116,7 +94,7 @@ public function searchAction(Request $request): Response 'orderBy' => $command->orderBy, 'orderDirection' => $command->orderDirection ?: 'asc', 'inverseOrderDirection' => $command->orderDirection === 'asc' ? 'desc' : 'asc', - ] + ], ); } @@ -136,7 +114,7 @@ public function revokeAction(Request $request): RedirectResponse 'Sending middleware request to revoke recovery token "%s" belonging to "%s" on behalf of "%s"', $command->recoveryTokenId, $command->identityId, - $command->currentUserId + $command->currentUserId, )); if ($this->recoveryTokenService->revoke($command)) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 1fcef58c..7e680788 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -38,7 +38,7 @@ public function consumeAssertionAction(Request $httpRequest) $assertion = $postBinding->processResponse( $httpRequest, $this->get('surfnet_saml.remote.idp'), - $this->get('surfnet_saml.hosted.service_provider') + $this->get('surfnet_saml.hosted.service_provider'), ); return $assertion->getAttributes(); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index ad70c939..8a24f175 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -39,7 +39,6 @@ final class SecondFactorController extends AbstractController { /** * @Template - * @param Request $request * @return array|Response */ public function searchAction(Request $request) @@ -77,7 +76,7 @@ public function searchAction(Request $request) $pagination = $this->getPaginator()->paginate( $secondFactors->getElements(), $secondFactors->getCurrentPage(), - $secondFactors->getItemsPerPage() + $secondFactors->getItemsPerPage(), ); $pagination->setTotalItemCount($secondFactors->getTotalItems()); @@ -85,7 +84,7 @@ public function searchAction(Request $request) $this->get('logger')->notice(sprintf( 'Searching for second factors yielded "%d" results', - $secondFactors->getTotalItems() + $secondFactors->getTotalItems(), )); return [ @@ -112,7 +111,6 @@ public function exportAction(SearchRaSecondFactorsCommand $command) } /** - * @param Request $request * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function revokeAction(Request $request) @@ -133,7 +131,7 @@ public function revokeAction(Request $request) 'Sending middleware request to revoke Second Factor "%s" belonging to "%s" on behalf of "%s"', $command->secondFactorId, $command->identityId, - $command->currentUserId + $command->currentUserId, )); $translator = $this->get('translator'); @@ -152,7 +150,6 @@ public function revokeAction(Request $request) } /** - * @param Request $request * @return Response */ public function auditLogAction(Request $request) @@ -169,7 +166,7 @@ public function auditLogAction(Request $request) $logger->notice(sprintf( 'User with Identity "%s" requested non-existent identity "%s"', $this->getCurrentUser()->id, - $identityId + $identityId, )); throw new NotFoundHttpException(); @@ -188,7 +185,7 @@ public function auditLogAction(Request $request) $pagination = $this->getPaginator()->paginate( $auditLog->getElements(), $auditLog->getCurrentPage(), - $auditLog->getItemsPerPage() + $auditLog->getItemsPerPage(), ); $pagination->setTotalItemCount($auditLog->getTotalItems()); @@ -200,7 +197,7 @@ public function auditLogAction(Request $request) 'pagination' => $pagination, 'auditLog' => $auditLog, 'identity' => $identity, - ] + ], ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index f5b2c33b..b9c860e0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -31,7 +31,7 @@ public function sessionExpiredAction(Request $request) return $this->render( '@SurfnetStepupRaRa/security/session_expired.html.twig', - ['redirect_to_url' => $redirectToUrl] + ['redirect_to_url' => $redirectToUrl], ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index 8eee04f4..f00f40f7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -85,7 +85,7 @@ public function authenticateAction($procedureId, $provider) $authnRequest = AuthnRequestFactory::createNewRequest( $provider->getServiceProvider(), - $provider->getRemoteIdentityProvider() + $provider->getRemoteIdentityProvider(), ); /** @var \Surfnet\StepupRa\RaBundle\Service\VettingService $vettingService */ @@ -103,9 +103,9 @@ public function authenticateAction($procedureId, $provider) 'Sending AuthnRequest with request ID: "%s" to GSSP "%s" at "%s"', $authnRequest->getRequestId(), $provider->getName(), - $provider->getRemoteIdentityProvider()->getSsoUrl() + $provider->getRemoteIdentityProvider()->getSsoUrl(), ), - ['provider' => $provider] + ['provider' => $provider], ); $vettingService->startGssfVerification($procedureId); @@ -114,7 +114,6 @@ public function authenticateAction($procedureId, $provider) } /** - * @param Request $httpRequest * @param string $provider * @return array|Response */ @@ -125,7 +124,7 @@ public function verifyAction(Request $httpRequest, $provider) $provider = $this->getProvider($provider); $this->get('logger')->notice( - sprintf('Received GSSP "%s" SAMLResponse through Gateway, attempting to process', $provider->getName()) + sprintf('Received GSSP "%s" SAMLResponse through Gateway, attempting to process', $provider->getName()), ); try { @@ -134,16 +133,16 @@ public function verifyAction(Request $httpRequest, $provider) $assertion = $postBinding->processResponse( $httpRequest, $provider->getRemoteIdentityProvider(), - $provider->getServiceProvider() + $provider->getServiceProvider(), ); } catch (Exception $exception) { $provider->getStateHandler()->clear(); $this->getLogger()->error( - sprintf('Could not process received Response, error: "%s"', $exception->getMessage()) + sprintf('Could not process received Response, error: "%s"', $exception->getMessage()), ); throw new BadRequestHttpException( - 'Could not process received SAML response, cannot return to vetting procedure' + 'Could not process received SAML response, cannot return to vetting procedure', ); } @@ -153,14 +152,14 @@ public function verifyAction(Request $httpRequest, $provider) if (!InResponseTo::assertEquals($assertion, $expectedResponseTo)) { $this->getLogger()->critical(sprintf( 'Received Response with unexpected InResponseTo: %s', - ($expectedResponseTo ? 'expected "' . $expectedResponseTo . '"' : ' no response expected') + ($expectedResponseTo ? 'expected "' . $expectedResponseTo . '"' : ' no response expected'), )); throw new BadRequestHttpException('Received unexpected SAML response, cannot return to vetting procedure'); } $this->get('logger')->notice( - sprintf('Processed GSSP "%s" SAMLResponse received through Gateway successfully', $provider->getName()) + sprintf('Processed GSSP "%s" SAMLResponse received through Gateway successfully', $provider->getName()), ); /** @var \Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary $attributeDictionary */ @@ -185,13 +184,13 @@ public function verifyAction(Request $httpRequest, $provider) $this->getLogger()->notice( 'Unable to prove possession of correct GSSF: ' . - 'GSSF ID registered in Self-Service does not match current GSSF ID' + 'GSSF ID registered in Self-Service does not match current GSSF ID', ); return $this->renderInitiateForm( $result->getProcedureId(), $provider->getName(), - ['gssfIdMismatch' => true] + ['gssfIdMismatch' => true], ); } @@ -249,7 +248,6 @@ private function getVettingService() /** * @param string $procedureId * @param string $provider - * @param array $parameters * @return Response */ private function renderInitiateForm($procedureId, $provider, array $parameters = []) @@ -265,7 +263,7 @@ private function renderInitiateForm($procedureId, $provider, array $parameters = 'provider' => $provider, /** @Ignore from translation message extraction */ 'label' => $secondFactorConfig->getInitiate() - ] + ], ); $templateParameters = array_merge( @@ -275,7 +273,7 @@ private function renderInitiateForm($procedureId, $provider, array $parameters = 'procedureId' => $procedureId, 'provider' => $provider, 'secondFactorConfig' => $secondFactorConfig - ] + ], ); return $this->render('SurfnetStepupRaRaBundle:vetting/gssf:initiate.html.twig', $templateParameters); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 980e9ff9..dd82a14f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -36,7 +36,6 @@ class SmsController extends SecondFactorController { /** * @Template - * @param Request $request * @param string $procedureId * @return array|Response */ @@ -74,14 +73,14 @@ public function sendChallengeAction(Request $request, $procedureId) return array_merge( $viewVariables, - ['phoneNumber' => $phoneNumber, 'form' => $form->createView()] + ['phoneNumber' => $phoneNumber, 'form' => $form->createView()], ); } $logger->notice('Sending of SMS Challenge has been requested, sending OTP via SMS'); if ($vettingService->sendSmsChallenge($procedureId, $command)) { $logger->notice( - 'SMS Challenge successfully sent, redirecting to Proof of Possession page to verify challenge' + 'SMS Challenge successfully sent, redirecting to Proof of Possession page to verify challenge', ); return $this->redirectToRoute('ra_vetting_sms_prove_possession', ['procedureId' => $procedureId]); @@ -90,18 +89,17 @@ public function sendChallengeAction(Request $request, $procedureId) $this->addFlash('error', 'ra.sms_send_challenge.send_sms_challenge_failed'); $logger->notice( - 'SMS Challenge could not be sent, added error to page to notify user and re-rendering send challenge page' + 'SMS Challenge could not be sent, added error to page to notify user and re-rendering send challenge page', ); return array_merge( $viewVariables, - ['phoneNumber' => $phoneNumber, 'form' => $form->createView()] + ['phoneNumber' => $phoneNumber, 'form' => $form->createView()], ); } /** * @Template - * @param Request $request * @param string $procedureId * @return array|Response */ @@ -131,7 +129,7 @@ public function provePossessionAction(Request $request, $procedureId) if (!$form->isSubmitted() || !$form->isValid()) { $logger->notice( - 'SMS OTP was not submitted through form, rendering Proof of Possession of SMS Second Factor page' + 'SMS OTP was not submitted through form, rendering Proof of Possession of SMS Second Factor page', ); return ['form' => $form->createView()]; @@ -144,7 +142,7 @@ public function provePossessionAction(Request $request, $procedureId) return $this->redirectToRoute( 'ra_vetting_verify_identity', - ['procedureId' => $procedureId] + ['procedureId' => $procedureId], ); } elseif ($verification->didOtpExpire()) { $this->addFlash('error', 'ra.prove_phone_possession.challenge_expired'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index b97992a4..2aaa54fd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -31,7 +31,6 @@ class YubikeyController extends SecondFactorController { /** * @Template - * @param Request $request * @param string $procedureId * @return array|Response */ diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 2b6522b8..47c66724 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -45,7 +45,6 @@ class VettingController extends AbstractController { /** * @Template - * @param Request $request * @return array|Response * * @SuppressWarnings(PHPMD.CyclomaticComplexity) https://www.pivotaltracker.com/story/show/135045063 @@ -85,14 +84,14 @@ public function startProcedureAction(Request $request) sprintf( 'An RA attempted vetting of disabled second factor "%s" of type "%s"', $secondFactor->id, - $secondFactor->type - ) + $secondFactor->type, + ), ); return $this ->render( 'SurfnetStepupRaRaBundle:vetting:second_factor_type_disabled.html.twig', - ['secondFactorType' => $secondFactor->type] + ['secondFactorType' => $secondFactor->type], ) ->setStatusCode(Response::HTTP_BAD_REQUEST); } @@ -111,13 +110,13 @@ public function startProcedureAction(Request $request) 'ra.verify_identity.registration_code_expired', [ '%self_service_url%' => $this->getParameter('surfnet_stepup_ra.self_service_url'), - ] - ) + ], + ), ); $logger->notice( 'Second factor registration code is expired', - ['registration_requested_at' => $secondFactor->registrationRequestedAt->format('Y-m-d')] + ['registration_requested_at' => $secondFactor->registrationRequestedAt->format('Y-m-d')], ); return ['form' => $form->createView()]; @@ -157,11 +156,11 @@ public function startProcedureAction(Request $request) [ 'procedureId' => $procedureId, 'provider' => $secondFactor->type - ] + ], ); } else { throw new RuntimeException( - sprintf('RA does not support vetting procedure for second factor type "%s"', $secondFactor->type) + sprintf('RA does not support vetting procedure for second factor type "%s"', $secondFactor->type), ); } } @@ -183,7 +182,6 @@ public function cancelProcedureAction($procedureId) /** * @Template - * @param Request $request * @param string $procedureId * @return array|Response * @@ -236,7 +234,7 @@ public function verifyIdentityAction(Request $request, $procedureId) } catch (DomainException $e) { $this->get('logger')->error( "RA attempted to verify identity, but the vetting procedure does not allow it", - ['exception' => $e, 'procedure' => $procedureId] + ['exception' => $e, 'procedure' => $procedureId], ); return $showForm('ra.verify_identity.identity_verification_failed'); @@ -258,7 +256,7 @@ public function verifyIdentityAction(Request $request, $procedureId) 'ra.verify_identity.registration_code_expired', [ '%self_service_url%' => $this->getParameter('surfnet_stepup_ra.self_service_url'), - ] + ], ); return $showForm($registrationCodeExpiredError); @@ -268,7 +266,7 @@ public function verifyIdentityAction(Request $request, $procedureId) } catch (DomainException $e) { $logger->error( "RA attempted to vet second factor, but the vetting procedure didn't allow it", - ['exception' => $e] + ['exception' => $e], ); return $showForm('ra.verify_identity.second_factor_vetting_failed'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index cde9d9a9..fe6a88d8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -33,43 +33,16 @@ class VettingTypeHintController extends AbstractController { - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var ProfileService - */ - private $profileService; - - /** - * @var VettingTypeHintService - */ - private $vettingTypeHintService; - - /** - * @var InstitutionListingService - */ - private $institutionListingService; - - /** - * @var string[] - */ - private $locales; - public function __construct( - LoggerInterface $logger, - InstitutionListingService $institutionListingService, - ProfileService $profileService, - VettingTypeHintService $vettingTypeHintService, - array $locales + private readonly LoggerInterface $logger, + private readonly InstitutionListingService $institutionListingService, + private readonly ProfileService $profileService, + private readonly VettingTypeHintService $vettingTypeHintService, + /** + * @var string[] + */ + private array $locales, ) { - $this->institutionListingService = $institutionListingService; - $this->profileService = $profileService; - $this->vettingTypeHintService = $vettingTypeHintService; - $this->locales = $locales; - $this->logger = $logger; } /** @@ -140,7 +113,7 @@ public function vettingTypeHintAction(Request $request): Response 'form' => isset($form) ? $form->createView() : null, 'hintForm' => $hintForm->createView(), 'institution' => $institution, - ] + ], ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php index b74f44c9..fd37067f 100644 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php @@ -48,17 +48,12 @@ private function appendLoaConfiguration(NodeBuilder $childNodes) ->info('The required LOA to be able to log in, should match the loa defined at the gateway') ->isRequired() ->validate() - ->ifTrue(function ($value) { - return !is_string($value); - }) + ->ifTrue(fn($value) => !is_string($value)) ->thenInvalid('the required loa must be a string') ->end() ->end(); } - /** - * @param NodeBuilder $childNodes - */ private function appendSecondFactorTypesConfiguration(NodeBuilder $childNodes) { $childNodes @@ -78,9 +73,6 @@ private function appendSecondFactorTypesConfiguration(NodeBuilder $childNodes) ->end(); } - /** - * @param NodeBuilder $childNodes - */ private function appendSessionConfiguration(NodeBuilder $childNodes) { $childNodes @@ -94,9 +86,7 @@ private function appendSessionConfiguration(NodeBuilder $childNodes) ->example('3600 -> 1 hour * 60 minutes * 60 seconds') ->validate() ->ifTrue( - function ($lifetime) { - return !is_int($lifetime); - } + fn($lifetime) => !is_int($lifetime) ) ->thenInvalid('max_absolute_lifetime must be an integer') ->end() @@ -106,14 +96,12 @@ function ($lifetime) { ->defaultValue(600) ->info( 'The maximum relative lifetime of a session; the maximum allowed time between two ' - . 'interactions by the user' + . 'interactions by the user', ) ->example('600 -> 10 minutes * 60 seconds') ->validate() ->ifTrue( - function ($lifetime) { - return !is_int($lifetime); - } + fn($lifetime) => !is_int($lifetime) ) ->thenInvalid('max_relative_lifetime must be an integer') ->end() @@ -129,9 +117,7 @@ private function appendUrlConfiguration(NodeBuilder $childNodes) ->info('The URL of Self Service, where a user can register and revoke second factors') ->validate() ->ifTrue( - function ($url) { - return filter_var($url, FILTER_VALIDATE_URL) === false; - } + fn($url) => filter_var($url, FILTER_VALIDATE_URL) === false ) ->thenInvalid('self_service_url must be a valid url') ->end(); diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php index 5a8c8792..207944d9 100644 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php +++ b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php @@ -43,16 +43,16 @@ public function load(array $configs, ContainerBuilder $container) $gssfSecondFactors = array_keys($config['enabled_generic_second_factors']); $container->setParameter( 'surfnet_stepup_ra.enabled_second_factors', - array_merge($config['enabled_second_factors'], $gssfSecondFactors) + array_merge($config['enabled_second_factors'], $gssfSecondFactors), ); $container->setParameter( 'ra.security.authentication.session.maximum_absolute_lifetime_in_seconds', - $config['session_lifetimes']['max_absolute_lifetime'] + $config['session_lifetimes']['max_absolute_lifetime'], ); $container->setParameter( 'ra.security.authentication.session.maximum_relative_lifetime_in_seconds', - $config['session_lifetimes']['max_relative_lifetime'] + $config['session_lifetimes']['max_relative_lifetime'], ); $container->setParameter('surfnet_stepup_ra.self_service_url', $config['self_service_url']); diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php index 2627f1e8..eebe6386 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php @@ -24,19 +24,13 @@ class InconsistentStateListener { - /** - * @var LoggerInterface - */ - private $logger; - - public function __construct(LoggerInterface $logger) + public function __construct(private readonly LoggerInterface $logger) { - $this->logger = $logger; } public function onKernelException(GetResponseForExceptionEvent $event) { - $exception = $event->getException(); + $exception = $event->getThrowable(); if (!$exception instanceof InconsistentStateException) { return; @@ -44,7 +38,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) $this->logger->critical( sprintf('An inconsistent state has been reached: "%s"', $exception->getMessage()), - ['exception' => $exception] + ['exception' => $exception], ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php index 2136978e..7d9e1a68 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php @@ -24,23 +24,12 @@ use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Translation\TranslatorInterface; +use InvalidArgumentException; -final class LocaleListener implements EventSubscriberInterface +final readonly class LocaleListener implements EventSubscriberInterface { - /** - * @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct(TokenStorageInterface $tokenStorage, TranslatorInterface $translator) + public function __construct(private TokenStorageInterface $tokenStorage, private TranslatorInterface $translator) { - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; } public function setRequestLocale(GetResponseEvent $event) @@ -64,7 +53,7 @@ public function setRequestLocale(GetResponseEvent $event) // As per \Symfony\Component\HttpKernel\EventListener\TranslatorListener::setLocale() try { $this->translator->setLocale($request->getLocale()); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException) { $this->translator->setLocale($request->getDefaultLocale()); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php b/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php index 3ba2285d..7206c421 100644 --- a/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php @@ -22,17 +22,10 @@ class AssertionFailedException extends InvalidArgumentException implements AssertAssertionFailedException { - private $propertyPath; - private $value; - private $constraints; - // @codingStandardsIgnoreStart Compliance with beberlei/assert's invalid argument exception - public function __construct($message, $code, $propertyPath = null, $value, array $constraints = array()) + public function __construct($message, $code, private $value, private $propertyPath = null, private readonly array $constraints = []) { parent::__construct($message, $code); - $this->propertyPath = $propertyPath; - $this->value = $value; - $this->constraints = $constraints; } // @codingStandardsIgnoreEnd diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php index 7635b753..523ada10 100644 --- a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php @@ -26,13 +26,13 @@ class InvalidArgumentException extends \InvalidArgumentException * @param mixed $parameter the parameter that is not of the expected type. * @return self */ - public static function invalidType($expected, $parameterName, $parameter) + public static function invalidType($expected, $parameterName, mixed $parameter) { $message = sprintf( 'Invalid argument type: "%s" expected, "%s" given for "%s"', $expected, - is_object($parameter) ? get_class($parameter) : gettype($parameter), - $parameterName + get_debug_type($parameter), + $parameterName, ); return new self($message); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php index 32f14986..8de30a40 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php @@ -31,9 +31,7 @@ public static function create() private static function buildChoices() { $choices = self::getChoices(); - $labels = array_map(function ($choice) { - return 'ra.form.extension.ra_role_choice.' . $choice; - }, $choices); + $labels = array_map(fn($choice) => 'ra.form.extension.ra_role_choice.' . $choice, $choices); $combined = array_combine($labels, $choices); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php index bce888a4..b4bdae78 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php @@ -40,33 +40,11 @@ */ class SecondFactorTypeChoiceList { - /** - * @var SecondFactorTypeService - */ - private $secondFactorTypeService; - - /** - * @var SecondFactorTypeTranslationService - */ - private $translator; - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @param SecondFactorTypeService $service - * @param SecondFactorTypeTranslationService $translator - */ public function __construct( - SecondFactorTypeService $service, - SecondFactorTypeTranslationService $translator, - LoggerInterface $logger + private readonly SecondFactorTypeService $secondFactorTypeService, + private readonly SecondFactorTypeTranslationService $translator, + private readonly LoggerInterface $logger, ) { - $this->secondFactorTypeService = $service; - $this->translator = $translator; - $this->logger = $logger; } /** @@ -82,7 +60,7 @@ public function create() foreach ($collection as $sfTypeIdentifier) { $translation = $this->translator->translate( $sfTypeIdentifier, - 'ra.form.ra_search_ra_second_factors.choice.type.%s' + 'ra.form.ra_search_ra_second_factors.choice.type.%s', ); // Test if the translator was able to translate the second factor type @@ -90,8 +68,8 @@ public function create() $this->logger->warning( sprintf( 'Unable to add a filter option on the second factor type select list for type: "%s"', - $sfTypeIdentifier - ) + $sfTypeIdentifier, + ), ); continue; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php index 3ce6c3d2..34392b63 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand; class AmendRegistrationAuthorityInformationType extends AbstractType { @@ -42,7 +43,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('amend_ra_info', SubmitType::class, [ 'label' => 'ra.management.form.amend_ra_info.label.amend_ra_info', @@ -52,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'ra.management.form.amend_ra_info.label.cancel', 'route' => 'ra_management_manage', 'attr' => ['class' => 'btn btn-link cancel'] - ]) + ]), ) ; } @@ -60,7 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand' + 'data_class' => AmendRegistrationAuthorityInformationCommand::class ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php index 6868a0c8..d7a4f824 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\ChangeRaLocationCommand; class ChangeRaLocationType extends AbstractType { @@ -49,7 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'row_attr' => [ 'class' => 'form-group button-group' ], - ] + ], ) ->add('change_ra_location', SubmitType::class, [ 'label' => 'ra.management.form.change_ra_location.label.change_ra_location', @@ -59,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'ra.management.form.change_ra_location.label.cancel', 'route' => 'ra_locations_manage', 'attr' => ['class' => 'btn btn-link pull-right cancel'], - ]) + ]), ) ; } @@ -67,7 +68,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\ChangeRaLocationCommand' + 'data_class' => ChangeRaLocationCommand::class ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php index 8abf3a43..60d25702 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php @@ -24,6 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\ChangeRaRoleCommand; class ChangeRaRoleType extends AbstractType { @@ -33,9 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('role', ChoiceType::class, [ 'label' => 'ra.management.form.change_ra_role.label.role', 'choices' => RaRoleChoiceList::create(), - 'choice_value' => function ($choice) { - return $choice; - }, + 'choice_value' => fn($choice) => $choice, ]) ->add( @@ -44,7 +43,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('create_ra', SubmitType::class, [ 'label' => 'ra.management.form.change_ra_role.label.save', @@ -54,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'ra.management.form.create_ra.label.cancel', 'route' => 'ra_management_ra_candidate_search', 'attr' => ['class' => 'btn btn-link'] - ]) + ]), ) ; } @@ -62,7 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\ChangeRaRoleCommand' + 'data_class' => ChangeRaRoleCommand::class ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php index 9b29b34e..08473733 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\CreateRaLocationCommand; class CreateRaLocationType extends AbstractType { @@ -44,7 +45,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('create_ra_location', SubmitType::class, [ 'label' => 'ra.form.ra_create_ra_location.label.create_ra_location', @@ -54,7 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'ra.form.ra_create_ra_location.label.cancel', 'route' => 'ra_locations_manage', 'attr' => ['class' => 'btn btn-link cancel'] - ]) + ]), ) ; } @@ -62,7 +63,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\CreateRaLocationCommand' + 'data_class' => CreateRaLocationCommand::class ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php index d8411f84..21f9b50e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php @@ -31,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $options = array_combine( $builder->getData()->availableInstitutions, - $builder->getData()->availableInstitutions + $builder->getData()->availableInstitutions, ); $builder @@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('create_ra', SubmitType::class, [ 'label' => 'ra.management.form.create_ra.label.create_ra', @@ -61,7 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'ra.management.form.create_ra.label.cancel', 'route' => 'ra_management_ra_candidate_search', 'attr' => ['class' => 'btn btn-link cancel'], - ]) + ]), ) ; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php index 2ae70d73..a7a7b759 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php @@ -26,21 +26,15 @@ class InitiateGssfType extends AbstractType { - /** - * @var RouterInterface - */ - private $router; - - public function __construct(RouterInterface $router) + public function __construct(private readonly RouterInterface $router) { - $this->router = $router; } public function buildForm(FormBuilderInterface $builder, array $options) { $action = $this->router->generate( 'ra_vetting_gssf_authenticate', - ['procedureId' => $options['procedureId'], 'provider' => $options['provider']] + ['procedureId' => $options['procedureId'], 'provider' => $options['provider']], ); $builder diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php index 787fa18a..cbc1220a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php @@ -33,7 +33,7 @@ public function configureOptions(OptionsResolver $resolver) 'autofocus' => true, 'autocomplete' => 'off', ] - ] + ], ); } public function getBlockPrefix() diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php index e86ded09..b61c04cf 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php @@ -22,6 +22,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\RemoveRaLocationCommand; class RemoveRaLocationType extends AbstractType { @@ -35,7 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\RemoveRaLocationCommand', + 'data_class' => RemoveRaLocationCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php index 5a7061f9..328410a6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php @@ -22,6 +22,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand; class RetractRegistrationAuthorityType extends AbstractType { @@ -33,7 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('confirm', SubmitType::class, [ 'attr' => ['class' => 'btn btn-warning pull-right'], @@ -42,14 +43,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('cancel', SubmitType::class, [ 'attr' => ['class' => 'btn btn-info pull-right'], 'label' => 'ra.management.retract_ra.modal.cancel', - ]) + ]), ); } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand' + 'data_class' => RetractRegistrationAuthorityCommand::class ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php index ae17510a..f36d86dc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php @@ -22,6 +22,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; class RevokeSecondFactorType extends AbstractType { @@ -35,7 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand', + 'data_class' => RevokeSecondFactorCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php index 2e29d5aa..fbd7884a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php @@ -49,9 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add('role', ChoiceType::class, [ 'label' => false, 'choices' => RaRoleChoiceList::create(), - 'choice_value' => function ($choice) { - return $choice; - }, + 'choice_value' => fn($choice) => $choice, 'required' => $isRequired, ])->add('institution', ChoiceType::class, [ 'label' => 'ra.form.role_at_institution.label.institution', @@ -62,12 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefaults(array( - 'data_class' => RoleAtInstitution::class, - 'choices' => [], - 'horizontal' => true, - 'error_bubbling' => false, - )); + $resolver->setDefaults(['data_class' => RoleAtInstitution::class, 'choices' => [], 'horizontal' => true, 'error_bubbling' => false]); } public function getBlockPrefix() diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php index 2de3d996..0185f236 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php @@ -54,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\SearchRaCandidatesCommand', + 'data_class' => SearchRaCandidatesCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php index a4924ce6..33802be6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php @@ -28,14 +28,8 @@ class SearchRaSecondFactorsType extends AbstractType { - /** - * @var SecondFactorTypeChoiceList - */ - private $secondFactorTypeChoiseList; - - public function __construct(SecondFactorTypeChoiceList $secondFactorTypeChoiceList) + public function __construct(private readonly SecondFactorTypeChoiceList $secondFactorTypeChoiseList) { - $this->secondFactorTypeChoiseList = $secondFactorTypeChoiceList; } public function buildForm(FormBuilderInterface $builder, array $options) @@ -79,7 +73,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('search', SubmitType::class, [ 'label' => 'ra.form.ra_search_ra_second_factors.button.search', @@ -99,7 +93,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\SearchRaSecondFactorsCommand', + 'data_class' => SearchRaSecondFactorsCommand::class, 'enable_export_button' => true, ]); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php index 65f04538..8e5cd684 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php @@ -70,7 +70,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ButtonGroupType::class, [ 'inherit_data' => true, - ] + ], ) ->add('search', SubmitType::class, [ 'label' => 'ra.form.ra_search_recovery_tokens.button.search', diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php index c4605564..bcf2cb2d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php @@ -36,14 +36,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) [ 'label' => 'ra.form.select_institution.label.institution', 'choices' => $builder->getData()->availableInstitutions, - ] + ], )->add( 'select_and_apply', SubmitType::class, [ 'label' => 'ra.form.select_institution.button.switch', 'attr' => ['class' => 'btn btn-primary pull-right'], - ] + ], ); } @@ -52,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setDefaults( [ 'data_class' => SelectInstitutionCommand::class, - ] + ], ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php index 6ca0a472..ae1de935 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php @@ -22,6 +22,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupBundle\Command\SendSmsChallengeCommand; class SendSmsChallengeType extends AbstractType { @@ -36,7 +37,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupBundle\Command\SendSmsChallengeCommand', + 'data_class' => SendSmsChallengeCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php index a19136aa..0f0fa4f4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand; class StartVettingProcedureType extends AbstractType { @@ -31,12 +32,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add('registrationCode', TextType::class, [ 'label' => /** @Ignore */ false, 'required' => true, - 'attr' => array( - 'autofocus' => true, - 'autocomplete' => 'off', - 'placeholder' => 'ra.form.start_vetting_procedure.enter_activation_code_here', - 'class' => 'fa-search', - ) + 'attr' => ['autofocus' => true, 'autocomplete' => 'off', 'placeholder' => 'ra.form.start_vetting_procedure.enter_activation_code_here', 'class' => 'fa-search'] ]); $builder->add('search', SubmitType::class, [ 'label' => 'ra.form.start_vetting_procedure.search', @@ -47,7 +43,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand', + 'data_class' => StartVettingProcedureCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php index bd7927a7..612bf577 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php @@ -24,6 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand; class VerifyIdentityType extends AbstractType { @@ -54,7 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand', + 'data_class' => VerifyIdentityCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php index ed5deca1..d0066daa 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand; class VerifyPhoneNumberType extends AbstractType { @@ -31,9 +32,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add('challenge', TextType::class, [ 'label' => 'ra.form.ra_verify_phone_number.text.challenge', 'required' => true, - 'attr' => array( - 'autofocus' => true, - ), + 'attr' => ['autofocus' => true], ]); $builder->add('verifyChallenge', SubmitType::class, [ 'label' => 'ra.form.ra_verify_phone_number.button.verify_challenge', @@ -54,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand', + 'data_class' => VerifyPossessionOfPhoneCommand::class, 'procedureId' => null, ]); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php index ec0736c5..0d7e2393 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php @@ -21,6 +21,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; class VerifyYubikeyPublicIdType extends AbstractType { @@ -32,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => 'Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand', + 'data_class' => VerifyYubikeyPublicIdCommand::class, ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php index e502e314..9d116e9b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php @@ -28,7 +28,7 @@ class VettingTypeHintType extends AbstractType { - public const HINT_TEXTAREA_NAME_PREFIX = 'vetting_type_hint_'; + final public const HINT_TEXTAREA_NAME_PREFIX = 'vetting_type_hint_'; public function buildForm(FormBuilderInterface $builder, array $options) { @@ -40,13 +40,13 @@ public function buildForm(FormBuilderInterface $builder, array $options) [ 'label' => $locale, 'required' => false, - ] + ], ); } $builder ->add( 'institution', - HiddenType::class + HiddenType::class, ) ->add( 'continue', @@ -54,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) [ 'label' => 'ra.form.vetting_type_hint.button.continue', 'attr' => ['class' => 'btn btn-primary pull-right'], - ] + ], ); } @@ -63,7 +63,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setDefaults( [ 'data_class' => VettingTypeHintCommand::class, - ] + ], ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php index 74600dfb..b46184c6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php +++ b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php @@ -32,14 +32,8 @@ final class ProcedureAwareLogger implements LoggerInterface */ private $procedure; - /** - * @var LoggerInterface - */ - private $logger; - - public function __construct(LoggerInterface $logger) + public function __construct(private readonly LoggerInterface $logger) { - $this->logger = $logger; } public function forProcedure($procedure) @@ -103,7 +97,6 @@ public function log($level, $message, array $context = []) /** * Adds the procedure to the log context. * - * @param array $context * @return array * @throws RuntimeException */ diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php index 63247161..c5ba379a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php +++ b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php @@ -24,23 +24,16 @@ class SessionVettingProcedureRepository implements VettingProcedureRepository { - /** - * @var SessionInterface - */ - private $session; - /** * @var string */ private $namespace; - public function __construct(SessionInterface $session, $namespace) + public function __construct(private readonly SessionInterface $session, $namespace) { if (!is_string($namespace)) { throw InvalidArgumentException::invalidType('string', 'namespace', $namespace); } - - $this->session = $session; $this->namespace = $namespace; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php index 816d1a6a..3712b4e7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php @@ -31,34 +31,12 @@ class AuthenticatedUserHandler implements AuthenticationHandler */ private $nextHandler; - /** - * @var TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var AuthenticatedSessionStateHandler - */ - private $sessionStateHandler; - /** - * @var SessionLifetimeGuard - */ - private $sessionLifetimeGuard; - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - TokenStorageInterface $tokenStorage, - SessionLifetimeGuard $sessionLifetimeGuard, - AuthenticatedSessionStateHandler $sessionStateHandler, - LoggerInterface $logger + private readonly TokenStorageInterface $tokenStorage, + private readonly SessionLifetimeGuard $sessionLifetimeGuard, + private readonly AuthenticatedSessionStateHandler $sessionStateHandler, + private readonly LoggerInterface $logger, ) { - $this->tokenStorage = $tokenStorage; - $this->sessionLifetimeGuard = $sessionLifetimeGuard; - $this->sessionStateHandler = $sessionStateHandler; - $this->logger = $logger; } public function process(GetResponseEvent $event) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php index d680fbe8..73b1d967 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php @@ -38,56 +38,15 @@ class ExplicitSessionTimeoutHandler implements AuthenticationHandler */ private $nextHandler; - /** - * @var TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var SessionLifetimeGuard - */ - private $sessionLifetimeGuard; - - /** - * @var AuthenticatedSessionStateHandler - */ - private $authenticatedSession; - - /** - * @var SessionLogoutHandler - */ - private $sessionLogoutHandler; - - /** - * @var CookieClearingLogoutHandler - */ - private $cookieClearingLogoutHandler; - - /** - * @var RouterInterface - */ - private $router; - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - TokenStorageInterface $tokenStorageInterface, - AuthenticatedSessionStateHandler $authenticatedSessionStateHandler, - SessionLifetimeGuard $sessionLifetimeGuard, - SessionLogoutHandler $sessionLogoutHandler, - CookieClearingLogoutHandler $cookieClearingLogoutHandler, - RouterInterface $router, - LoggerInterface $logger + private readonly TokenStorageInterface $tokenStorage, + private readonly AuthenticatedSessionStateHandler $authenticatedSession, + private readonly SessionLifetimeGuard $sessionLifetimeGuard, + private readonly SessionLogoutHandler $sessionLogoutHandler, + private readonly CookieClearingLogoutHandler $cookieClearingLogoutHandler, + private readonly RouterInterface $router, + private readonly LoggerInterface $logger, ) { - $this->tokenStorage = $tokenStorageInterface; - $this->authenticatedSession = $authenticatedSessionStateHandler; - $this->sessionLifetimeGuard = $sessionLifetimeGuard; - $this->sessionLogoutHandler = $sessionLogoutHandler; - $this->cookieClearingLogoutHandler = $cookieClearingLogoutHandler; - $this->router = $router; - $this->logger = $logger; } public function process(GetResponseEvent $event) @@ -107,7 +66,7 @@ public function process(GetResponseEvent $event) $this->logger->notice(sprintf( 'Authenticated user found, but session was determined to be outside of the "%s" time limit. User will ' . 'be logged out and redirected to session-expired page to attempt new login.', - implode(' and ', $invalidatedBy) + implode(' and ', $invalidatedBy), )); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php index 171e978e..a28e8d57 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php @@ -34,57 +34,15 @@ class InitiateSamlAuthenticationHandler implements AuthenticationHandler */ private $nextHandler; - /** - * @var TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var AuthenticatedSessionStateHandler - */ - private $authenticatedSession; - - /** - * @var SamlAuthenticationStateHandler - */ - private $samlAuthenticationStateHandler; - - /** - * @var SamlInteractionProvider - */ - private $samlInteractionProvider; - - /** - * @var RouterInterface - */ - private $router; - - /** - * @var SamlAuthenticationLogger - */ - private $authenticationLogger; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - TokenStorageInterface $tokenStorageInterface, - AuthenticatedSessionStateHandler $authenticatedSession, - SamlAuthenticationStateHandler $samlAuthenticationStateHandler, - SamlInteractionProvider $samlInteractionProvider, - RouterInterface $router, - SamlAuthenticationLogger $authenticationLogger, - LoggerInterface $logger + private readonly TokenStorageInterface $tokenStorage, + private readonly AuthenticatedSessionStateHandler $authenticatedSession, + private readonly SamlAuthenticationStateHandler $samlAuthenticationStateHandler, + private readonly SamlInteractionProvider $samlInteractionProvider, + private readonly RouterInterface $router, + private readonly SamlAuthenticationLogger $authenticationLogger, + private readonly LoggerInterface $logger, ) { - $this->tokenStorage = $tokenStorageInterface; - $this->authenticatedSession = $authenticatedSession; - $this->samlAuthenticationStateHandler = $samlAuthenticationStateHandler; - $this->samlInteractionProvider = $samlInteractionProvider; - $this->router = $router; - $this->authenticationLogger = $authenticationLogger; - $this->logger = $logger; } public function process(GetResponseEvent $event) @@ -103,7 +61,7 @@ public function process(GetResponseEvent $event) $this->logger->notice( 'No authenticated user, a AuthnRequest was sent, but the current request is not a POST to our ACS ' . 'thus we assume the user attempts to access the application again (possibly after a browser ' - . 'prefetch). Resetting the login state so that a new AuthnRequest can be sent.' + . 'prefetch). Resetting the login state so that a new AuthnRequest can be sent.', ); $this->samlInteractionProvider->reset(); @@ -118,7 +76,7 @@ public function process(GetResponseEvent $event) $event->setResponse($this->samlInteractionProvider->initiateSamlRequest()); $logger = $this->authenticationLogger->forAuthentication( - $this->samlAuthenticationStateHandler->getRequestId() + $this->samlAuthenticationStateHandler->getRequestId(), ); $logger->notice('Sending AuthnRequest'); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php index c4537db9..59a1c29d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php @@ -26,23 +26,10 @@ final class LogoutSuccessHandler implements LogoutSuccessHandlerInterface { /** - * @var TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var string[] - */ - private $logoutRedirectUrl; - - /** - * @param TokenStorageInterface $tokenStorage * @param string[] $logoutRedirectUrl */ - public function __construct(TokenStorageInterface $tokenStorage, array $logoutRedirectUrl) + public function __construct(private readonly TokenStorageInterface $tokenStorage, private array $logoutRedirectUrl) { - $this->tokenStorage = $tokenStorage; - $this->logoutRedirectUrl = $logoutRedirectUrl; } public function onLogoutSuccess(Request $request) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php index 1ad39920..24f7a182 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php @@ -43,64 +43,16 @@ class ProcessSamlAuthenticationHandler implements AuthenticationHandler */ private $nextHandler; - /** - * @var TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var SamlInteractionProvider - */ - private $samlInteractionProvider; - - /** - * @var SamlAuthenticationStateHandler - */ - private $authenticationStateHandler; - - /** - * @var AuthenticatedSessionStateHandler - */ - private $authenticatedSession; - - /** - * @var AuthenticationManagerInterface - */ - private $authenticationManager; - - /** - * @var LoaResolutionService - */ - private $loaResolutionService; - - /** - * @var SamlAuthenticationLogger - */ - private $authenticationLogger; - - /** - * @var EngineInterface - */ - private $templating; - public function __construct( - TokenStorageInterface $tokenStorage, - SamlInteractionProvider $samlInteractionProvider, - SamlAuthenticationStateHandler $authenticationStateHandler, - AuthenticatedSessionStateHandler $authenticatedSession, - AuthenticationManagerInterface $authenticationManager, - LoaResolutionService $loaResolutionService, - SamlAuthenticationLogger $authenticationLogger, - EngineInterface $templating + private readonly TokenStorageInterface $tokenStorage, + private readonly SamlInteractionProvider $samlInteractionProvider, + private readonly SamlAuthenticationStateHandler $authenticationStateHandler, + private readonly AuthenticatedSessionStateHandler $authenticatedSession, + private readonly AuthenticationManagerInterface $authenticationManager, + private readonly LoaResolutionService $loaResolutionService, + private readonly SamlAuthenticationLogger $authenticationLogger, + private readonly EngineInterface $templating, ) { - $this->tokenStorage = $tokenStorage; - $this->samlInteractionProvider = $samlInteractionProvider; - $this->authenticationStateHandler = $authenticationStateHandler; - $this->authenticatedSession = $authenticatedSession; - $this->authenticationManager = $authenticationManager; - $this->loaResolutionService = $loaResolutionService; - $this->authenticationLogger = $authenticationLogger; - $this->templating = $templating; } public function process(GetResponseEvent $event) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index 37610a30..ffa20dc7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -36,36 +36,12 @@ */ class SamlProvider implements AuthenticationProviderInterface { - /** - * @var IdentityService - */ - private $identityService; - - /** - * @var ProfileService - */ - private $profileService; - - /** - * @var AttributeDictionary - */ - private $attributeDictionary; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - IdentityService $identityService, - ProfileService $profileService, - AttributeDictionary $attributeDictionary, - LoggerInterface $logger + private readonly IdentityService $identityService, + private readonly ProfileService $profileService, + private readonly AttributeDictionary $attributeDictionary, + private readonly LoggerInterface $logger, ) { - $this->identityService = $identityService; - $this->profileService = $profileService; - $this->attributeDictionary = $attributeDictionary; - $this->logger = $logger; } /** @@ -86,7 +62,7 @@ public function authenticate(TokenInterface $token) // if no identity can be found, we're done. if ($identity === null) { throw new BadCredentialsException( - 'Unable to find Identity matching the criteria. Has the identity been registered before?' + 'Unable to find Identity matching the criteria. Has the identity been registered before?', ); } @@ -95,7 +71,7 @@ public function authenticate(TokenInterface $token) // if no credentials can be found, we're done. if (!$profile->isSraa && empty($profile->authorizations) && empty($profile->management)) { throw new UserNotRaException( - 'The Identity is not registered as (S)RA(A) and therefore does not have access to this application' + 'The Identity is not registered as (S)RA(A) and therefore does not have access to this application', ); } @@ -130,8 +106,8 @@ private function getSingleStringValue($attribute, AssertionAdapter $translatedAs throw new MissingRequiredAttributeException( sprintf( 'Missing a required SAML attribute. This application requires the "%s" attribute to function.', - $attribute - ) + $attribute, + ), ); } @@ -140,7 +116,7 @@ private function getSingleStringValue($attribute, AssertionAdapter $translatedAs $this->logger->warning(sprintf( 'Found "%d" values for attribute "%s", using first value', count($values), - $attribute + $attribute, )); } @@ -150,7 +126,7 @@ private function getSingleStringValue($attribute, AssertionAdapter $translatedAs $message = sprintf( 'First value of attribute "%s" must be a string, "%s" given', $attribute, - is_object($value) ? get_class($value) : gettype($value) + get_debug_type($value), ); $this->logger->warning($message); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php index e1e51722..0a0f5d97 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php @@ -35,57 +35,15 @@ */ class SamlInteractionProvider { - /** - * @var \Surfnet\SamlBundle\Entity\ServiceProvider - */ - private $serviceProvider; - - /** - * @var \Surfnet\SamlBundle\Entity\IdentityProvider - */ - private $identityProvider; - - /** - * @var \Surfnet\SamlBundle\Http\RedirectBinding - */ - private $redirectBinding; - - /** - * @var \Surfnet\SamlBundle\Http\PostBinding - */ - private $postBinding; - - /** - * @var \Surfnet\StepupRa\RaBundle\Security\Authentication\SamlAuthenticationStateHandler - */ - private $samlAuthenticationStateHandler; - - /** - * @var \Surfnet\StepupBundle\Service\LoaResolutionService - */ - private $loaResolutionService; - - /** - * @var \Surfnet\StepupBundle\Value\Loa - */ - private $requiredLoa; - public function __construct( - ServiceProvider $serviceProvider, - IdentityProvider $identityProvider, - RedirectBinding $redirectBinding, - PostBinding $postBinding, - SamlAuthenticationStateHandler $samlAuthenticationStateHandler, - LoaResolutionService $loaResolutionService, - Loa $requiredLoa + private readonly ServiceProvider $serviceProvider, + private readonly IdentityProvider $identityProvider, + private readonly RedirectBinding $redirectBinding, + private readonly PostBinding $postBinding, + private readonly SamlAuthenticationStateHandler $samlAuthenticationStateHandler, + private readonly LoaResolutionService $loaResolutionService, + private readonly Loa $requiredLoa, ) { - $this->serviceProvider = $serviceProvider; - $this->identityProvider = $identityProvider; - $this->redirectBinding = $redirectBinding; - $this->postBinding = $postBinding; - $this->loaResolutionService = $loaResolutionService; - $this->requiredLoa = $requiredLoa; - $this->samlAuthenticationStateHandler = $samlAuthenticationStateHandler; } /** @@ -103,7 +61,7 @@ public function initiateSamlRequest() { $authnRequest = AuthnRequestFactory::createNewRequest( $this->serviceProvider, - $this->identityProvider + $this->identityProvider, ); $authnRequest->setAuthenticationContextClassRef((string) $this->requiredLoa); @@ -114,7 +72,6 @@ public function initiateSamlRequest() } /** - * @param Request $request * @return \SAML2\Assertion * @throws LoaTooLowException When required LoA is not met by response * @throws AuthenticationException When response LoA cannot be resolved @@ -126,7 +83,7 @@ public function processSamlResponse(Request $request) $assertion = $this->postBinding->processResponse( $request, $this->identityProvider, - $this->serviceProvider + $this->serviceProvider, ); $this->samlAuthenticationStateHandler->clearRequestId(); @@ -135,7 +92,7 @@ public function processSamlResponse(Request $request) throw new UnexpectedIssuerException(sprintf( 'Expected issuer to be configured remote IdP "%s", got "%s"', $this->identityProvider->getEntityId(), - $assertion->getIssuer() + $assertion->getIssuer(), )); } @@ -149,8 +106,8 @@ public function processSamlResponse(Request $request) sprintf( "Gateway responded with LoA '%s', which is lower than required LoA '%s'", $assertion->getAuthnContextClassRef(), - (string) $this->requiredLoa - ) + (string) $this->requiredLoa, + ), ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php index 07e9e648..ca26c389 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php @@ -24,23 +24,13 @@ class SessionLifetimeGuard { - /** - * @var TimeFrame - */ - private $relativeTimeoutLimit; - /** - * @var TimeFrame - */ - private $absoluteTimeoutLimit; - - public function __construct(TimeFrame $absoluteTimeoutLimit, TimeFrame $relativeTimeoutLimit) - { - $this->absoluteTimeoutLimit = $absoluteTimeoutLimit; - $this->relativeTimeoutLimit = $relativeTimeoutLimit; + public function __construct( + private readonly TimeFrame $absoluteTimeoutLimit, + private readonly TimeFrame $relativeTimeoutLimit, + ) { } /** - * @param AuthenticatedSessionStateHandler $sessionStateHandler * @return bool */ public function sessionLifetimeWithinLimits(AuthenticatedSessionStateHandler $sessionStateHandler) @@ -50,7 +40,6 @@ public function sessionLifetimeWithinLimits(AuthenticatedSessionStateHandler $se } /** - * @param AuthenticatedSessionStateHandler $sessionStateHandler * @return bool */ public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHandler $sessionStateHandler) @@ -71,7 +60,6 @@ public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHand } /** - * @param AuthenticatedSessionStateHandler $sessionStateHandler * @return bool */ public function sessionLifetimeWithinRelativeLimit(AuthenticatedSessionStateHandler $sessionStateHandler) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php index 503eb6d2..4fce2428 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php @@ -29,20 +29,11 @@ class SessionStorage implements AuthenticatedSessionStateHandler, SamlAuthentica /** * Session keys */ - const AUTH_SESSION_KEY = '__auth/'; - const SAML_SESSION_KEY = '__saml/'; + final public const AUTH_SESSION_KEY = '__auth/'; + final public const SAML_SESSION_KEY = '__saml/'; - /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface - */ - private $session; - - /** - * @param SessionInterface $session - */ - public function __construct(SessionInterface $session) + public function __construct(private readonly SessionInterface $session) { - $this->session = $session; } public function logAuthenticationMoment() diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php index 79afd2f9..071631a2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php @@ -31,16 +31,9 @@ class SamlToken extends AbstractToken */ public $assertion; - /** - * @var \Surfnet\StepupBundle\Value\Loa - */ - private $loa; - - public function __construct(Loa $loa, array $roles = []) + public function __construct(private readonly Loa $loa, array $roles = []) { parent::__construct($roles); - - $this->loa = $loa; $this->setAuthenticated(count($roles)); } @@ -68,18 +61,15 @@ public function serialize() [ parent::serialize(), $this->loa, - ] + ], ); } public function unserialize($serialized) { - list( - $parent, - $this->loa, - ) = unserialize( - $serialized - ); + [$parent, $this->loa, ] = unserialize( + $serialized, + ); parent::unserialize($parent); } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php index 4cd06ea6..f62a58e0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php @@ -30,23 +30,23 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider, $providerId = 'security.authentication.provider.saml.' . $id; $container->setDefinition( $providerId, - new ChildDefinition('ra.security.authentication.provider.saml') + new ChildDefinition('ra.security.authentication.provider.saml'), ); $listenerId = 'security.authentication.listener.saml.' . $id; $container->setDefinition( $listenerId, - new ChildDefinition('ra.security.authentication.listener') + new ChildDefinition('ra.security.authentication.listener'), ); $cookieHandlerId = 'security.logout.handler.cookie_clearing.' . $id; $cookieHandler = $container->setDefinition( $cookieHandlerId, - new ChildDefinition('security.logout.handler.cookie_clearing') + new ChildDefinition('security.logout.handler.cookie_clearing'), ); $cookieHandler->addArgument([]); - return array($providerId, $listenerId, $defaultEntryPoint); + return [$providerId, $listenerId, $defaultEntryPoint]; } public function getPosition() diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php b/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php index 79aae9f6..9863e35c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php @@ -33,7 +33,7 @@ class SamlListener public function __construct( private readonly AuthenticationHandler $authenticationHandler, private readonly SamlInteractionProvider $samlInteractionProvider, - private readonly LoggerInterface $logger + private readonly LoggerInterface $logger, ) { } @@ -46,7 +46,7 @@ public function __invoke(RequestEvent $event): void $this->logger->warning(sprintf( 'Could not authenticate, AuthenticationException encountered: "%s"', - $exception->getMessage() + $exception->getMessage(), )); throw $exception; @@ -55,8 +55,8 @@ public function __invoke(RequestEvent $event): void $this->logger->error(sprintf( 'Could not authenticate, Exception of type "%s" encountered: %s', - get_class($exception), - $exception->getMessage() + $exception::class, + $exception->getMessage(), )); throw $exception; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php index f6f1cd15..55887ce9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php @@ -25,18 +25,11 @@ class AuditLogService { - /** - * @var ApiAuditLogService - */ - private $apiAuditLogService; - - public function __construct(ApiAuditLogService $auditLogService) + public function __construct(private readonly ApiAuditLogService $apiAuditLogService) { - $this->apiAuditLogService = $auditLogService; } /** - * @param SearchSecondFactorAuditLogCommand $command * @return AuditLog */ public function getAuditlog(SearchSecondFactorAuditLogCommand $command) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php index 7e19551b..dcad81dd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php @@ -23,24 +23,12 @@ use Surfnet\StepupMiddlewareClientBundle\Service\CommandService as MiddlewareCommandService; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -final class CommandService +final readonly class CommandService { - /** - * @var \Surfnet\StepupMiddlewareClientBundle\Service\CommandService - */ - private $commandService; - - /** - * @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface - */ - private $tokenStorage; - public function __construct( - MiddlewareCommandService $commandService, - TokenStorageInterface $tokenStorage + private MiddlewareCommandService $commandService, + private TokenStorageInterface $tokenStorage, ) { - $this->commandService = $commandService; - $this->tokenStorage = $tokenStorage; } public function execute(Command $command) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php index 43955555..0816d820 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php @@ -23,11 +23,6 @@ final class GlobalViewParameters { - /** - * @var TranslatorInterface - */ - private $translator; - /** * @var string[] */ @@ -39,15 +34,12 @@ final class GlobalViewParameters private $supportUrl; /** - * @param TranslatorInterface $translator * @param string[] $locales * @param string[] $supportUrl */ - public function __construct(TranslatorInterface $translator, array $locales, array $supportUrl) + public function __construct(private readonly TranslatorInterface $translator, array $locales, array $supportUrl) { Assert::keysAre($supportUrl, $locales); - - $this->translator = $translator; $this->locales = $locales; $this->supportUrl = $supportUrl; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index df010977..cac3b4f3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -21,16 +21,10 @@ use Surfnet\StepupRa\RaBundle\Service\Gssf\VerificationResult; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; -final class GssfService +final readonly class GssfService { - /** - * @var \Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface - */ - private $state; - - public function __construct(AttributeBagInterface $state) + public function __construct(private AttributeBagInterface $state) { - $this->state = $state; } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index 228255ce..b57d45c2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -33,36 +33,12 @@ class IdentityService implements UserProviderInterface { - /** - * @var \Surfnet\StepupMiddlewareClientBundle\Identity\Service\IdentityService - */ - private $apiIdentityService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\CommandService - */ - private $commandService; - - /** - * @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface - */ - private $tokenStorage; - - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - public function __construct( - ApiIdentityService $apiIdentityService, - CommandService $commandService, - TokenStorageInterface $tokenStorage, - LoggerInterface $logger + private readonly ApiIdentityService $apiIdentityService, + private readonly CommandService $commandService, + private readonly TokenStorageInterface $tokenStorage, + private readonly LoggerInterface $logger, ) { - $this->apiIdentityService = $apiIdentityService; - $this->commandService = $commandService; - $this->tokenStorage = $tokenStorage; - $this->logger = $logger; } /** @@ -92,7 +68,7 @@ public function refreshUser(UserInterface $user) */ public function supportsClass($class) { - return $class === 'Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity'; + return $class === Identity::class; } /** @@ -135,12 +111,11 @@ public function findByNameIdAndInstitution($nameId, $institution) throw new RuntimeException(sprintf( 'Got an unexpected amount of identities, expected 0 or 1, got "%d"', - count($elements) + count($elements), )); } /** - * @param Identity $identity * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RegistrationAuthorityCredentials|null */ public function getRaCredentials(Identity $identity) @@ -158,7 +133,6 @@ public function getRaCredentials(Identity $identity) } /** - * @param SwitchLocaleCommand $command * @return bool */ public function switchLocale(SwitchLocaleCommand $command) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php index 0ebbebee..c4ccb7d4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php @@ -22,16 +22,11 @@ use Surfnet\StepupMiddlewareClientBundle\Configuration\Service\InstitutionConfigurationOptionsService as ApiInstitutionConfigurationOptionsService; use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; -final class InstitutionConfigurationOptionsService implements InstitutionConfigurationOptionsServiceInterface +final readonly class InstitutionConfigurationOptionsService implements InstitutionConfigurationOptionsServiceInterface { - /** - * @var ApiInstitutionConfigurationOptionsService - */ - private $apiInstitutionConfigurationOptionsService; - - public function __construct(ApiInstitutionConfigurationOptionsService $apiService) - { - $this->apiInstitutionConfigurationOptionsService = $apiService; + public function __construct( + private ApiInstitutionConfigurationOptionsService $apiInstitutionConfigurationOptionsService, + ) { } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php index 336e3853..4c8dff6a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php @@ -21,18 +21,8 @@ class InstitutionListingService { - /** - * @var ApiInstitutionListingService - */ - private $institutionListingService; - - /** - * @param ApiInstitutionListingService $institutionListingService - */ - public function __construct( - ApiInstitutionListingService $institutionListingService - ) { - $this->institutionListingService = $institutionListingService; + public function __construct(private readonly ApiInstitutionListingService $institutionListingService) + { } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php b/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php index f946ba8d..5145d109 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php @@ -22,16 +22,10 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -final class LocaleProviderService implements StepupLocaleProviderService +final readonly class LocaleProviderService implements StepupLocaleProviderService { - /** - * @var TokenStorageInterface - */ - private $tokenStorage; - - public function __construct(TokenStorageInterface $tokenStorage) + public function __construct(private TokenStorageInterface $tokenStorage) { - $this->tokenStorage = $tokenStorage; } public function determinePreferredLocale() diff --git a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php index e451d51d..a19fca95 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php @@ -24,22 +24,10 @@ class ProfileService { - /** - * @var ApiProfileService - */ - private $apiProfileService; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - ApiProfileService $apiProfileService, - LoggerInterface $logger + private readonly ApiProfileService $apiProfileService, + private readonly LoggerInterface $logger, ) { - $this->apiProfileService = $apiProfileService; - $this->logger = $logger; } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php index 2521f430..78b922ff 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php @@ -35,40 +35,15 @@ */ class RaCandidateService { - /** - * @var \Surfnet\StepupMiddlewareClientBundle\Identity\Service\RaCandidateService - */ - private $apiRaCandidateService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\CommandService - */ - private $commandService; - - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - - /** - * @var SecondFactorTypeService - */ - private $secondFactorTypeService; - public function __construct( - ApiRaCandidateService $raCandidateService, - CommandService $commandService, - LoggerInterface $logger, - SecondFactorTypeService $secondFactorTypeService + private readonly ApiRaCandidateService $apiRaCandidateService, + private readonly CommandService $commandService, + private readonly LoggerInterface $logger, + private readonly SecondFactorTypeService $secondFactorTypeService, ) { - $this->apiRaCandidateService = $raCandidateService; - $this->commandService = $commandService; - $this->logger = $logger; - $this->secondFactorTypeService = $secondFactorTypeService; } /** - * @param SearchRaCandidatesCommand $command * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateCollection */ public function search(SearchRaCandidatesCommand $command) @@ -142,8 +117,8 @@ public function accreditCandidate(AccreditCandidateCommand $command) $apiCommand->institution, $apiCommand->raInstitution, $apiCommand->role, - implode(", ", $result->getErrors()) - ) + implode(", ", $result->getErrors()), + ), ); } @@ -163,9 +138,9 @@ function ($secondFactorType) use ($loa3) { return $this->secondFactorTypeService->canSatisfy( $secondFactorType, $loa3, - new VettingType(VettingType::TYPE_ON_PREMISE) + new VettingType(VettingType::TYPE_ON_PREMISE), ); - } + }, ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php index a6a59a97..17526f73 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php @@ -26,29 +26,16 @@ use Surfnet\StepupRa\RaBundle\Command\SearchRaListingCommand; use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; -final class RaListingService +final readonly class RaListingService { - /** - * @var ApiRaListingService - */ - private $apiRaListingService; - - /** - * @var LoggerInterface - */ - private $logger; - - public function __construct(ApiRaListingService $raListingService, LoggerInterface $logger) + public function __construct(private ApiRaListingService $apiRaListingService, private LoggerInterface $logger) { - $this->apiRaListingService = $raListingService; - $this->logger = $logger; } /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) -- The command to query mapping in search exceed the * @SuppressWarnings(PHPMD.NPathComplexity) CyclomaticComplexity and NPathComplexity threshold. * - * @param SearchRaListingCommand $command * @return RaListingCollection */ public function search(SearchRaListingCommand $command) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php index 75347149..9e1435a2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php @@ -36,29 +36,11 @@ */ class RaLocationService { - /** - * @var \Surfnet\StepupMiddlewareClientBundle\Configuration\Service\RaLocationService - */ - private $apiRaLocationService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\CommandService - */ - private $commandService; - - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - public function __construct( - ApiRaLocationService $apiRaLocationService, - CommandService $commandService, - LoggerInterface $logger + private readonly ApiRaLocationService $apiRaLocationService, + private readonly CommandService $commandService, + private readonly LoggerInterface $logger, ) { - $this->apiRaLocationService = $apiRaLocationService; - $this->commandService = $commandService; - $this->logger = $logger; } /** @@ -71,7 +53,6 @@ public function find($id) } /** - * @param SearchRaLocationsCommand $command * @return RaLocationCollection */ public function search(SearchRaLocationsCommand $command) @@ -106,7 +87,7 @@ public function create(CreateRaLocationCommand $command) $middlewareCommand->name, $middlewareCommand->institution, $command->currentUserId, - implode(", ", $result->getErrors()) + implode(", ", $result->getErrors()), )); } @@ -130,7 +111,7 @@ public function change(ChangeRaLocationCommand $command) $middlewareCommand->name, $middlewareCommand->institution, $command->currentUserId, - implode(", ", $result->getErrors()) + implode(", ", $result->getErrors()), )); } @@ -138,7 +119,6 @@ public function change(ChangeRaLocationCommand $command) } /** - * @param RemoveRaLocationCommand $command * @return bool */ public function remove(RemoveRaLocationCommand $command) @@ -154,7 +134,7 @@ public function remove(RemoveRaLocationCommand $command) $middlewareCommand->raLocationId, $middlewareCommand->institution, $command->currentUserId, - implode(", ", $result->getErrors()) + implode(", ", $result->getErrors()), )); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php index 67f0d3eb..b8321cb9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php @@ -25,15 +25,8 @@ class RaSecondFactorExport { - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - - public function __construct( - LoggerInterface $logger - ) { - $this->logger = $logger; + public function __construct(private readonly LoggerInterface $logger) + { } public function export(RaSecondFactorExportCollection $collection, $fileName) @@ -61,7 +54,7 @@ function () use ($collection, $keys) { [ 'Content-Type' => 'application/csv', 'Content-Disposition' => sprintf('attachment; filename="%s.csv"', $fileName), - ] + ], ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php index 9823ebee..10a3b81e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php @@ -34,42 +34,12 @@ */ class RaSecondFactorService { - /** - * @var \Surfnet\StepupMiddlewareClientBundle\Identity\Service\RaSecondFactorService - */ - private $apiRaSecondFactorService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\CommandService - */ - private $commandService; - - /** - * @var RaSecondFactorExport - */ - private $exporter; - - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - - /** - * @param ApiRaSecondFactorService $apiRaSecondFactorService - * @param CommandService $commandService - * @param RaSecondFactorExport $exporter - * @param LoggerInterface $logger - */ public function __construct( - ApiRaSecondFactorService $apiRaSecondFactorService, - CommandService $commandService, - RaSecondFactorExport $exporter, - LoggerInterface $logger + private readonly ApiRaSecondFactorService $apiRaSecondFactorService, + private readonly CommandService $commandService, + private readonly RaSecondFactorExport $exporter, + private readonly LoggerInterface $logger, ) { - $this->apiRaSecondFactorService = $apiRaSecondFactorService; - $this->commandService = $commandService; - $this->exporter = $exporter; - $this->logger = $logger; } public function revoke(RevokeSecondFactorCommand $command) @@ -87,7 +57,7 @@ public function revoke(RevokeSecondFactorCommand $command) $middlewareCommand->secondFactorId, $middlewareCommand->identityId, $middlewareCommand->authorityId, - implode(", ", $result->getErrors()) + implode(", ", $result->getErrors()), )); } @@ -95,7 +65,6 @@ public function revoke(RevokeSecondFactorCommand $command) } /** - * @param SearchRaSecondFactorsCommand $command * @return RaSecondFactorCollection */ public function search(SearchRaSecondFactorsCommand $command) @@ -109,7 +78,6 @@ public function search(SearchRaSecondFactorsCommand $command) * Searches for a collection of second factor tokens and returns a Http response with an attachment * Content-Disposition. * - * @param ExportRaSecondFactorsCommand $command * @return \Symfony\Component\HttpFoundation\Response */ public function export(ExportRaSecondFactorsCommand $command) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php index 99d64ed1..c19acb1c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php @@ -27,22 +27,10 @@ use Surfnet\StepupRa\RaBundle\Command\ChangeRaRoleCommand; use Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand; -final class RaService +final readonly class RaService { - /** - * @var CommandService - */ - private $commandService; - - /** - * @var LoggerInterface - */ - private $logger; - - public function __construct(CommandService $commandService, LoggerInterface $logger) + public function __construct(private CommandService $commandService, private LoggerInterface $logger) { - $this->commandService = $commandService; - $this->logger = $logger; } public function amendRegistrationAuthorityInformation(AmendRegistrationAuthorityInformationCommand $command) @@ -59,7 +47,7 @@ public function amendRegistrationAuthorityInformation(AmendRegistrationAuthority $this->logger->error(sprintf( "Amending of registration authority %s's information failed: '%s'", $apiCommand->identityId, - implode("', '", $result->getErrors()) + implode("', '", $result->getErrors()), )); } @@ -79,7 +67,7 @@ public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command) 'Could not change Identity "%s" role to "%s": "%s"', $apiCommand->identityId, $apiCommand->role, - implode("', '", $result->getErrors()) + implode("', '", $result->getErrors()), )); } @@ -98,7 +86,7 @@ public function retractRegistrationAuthority(RetractRegistrationAuthorityCommand $this->logger->error(sprintf( 'Could not retract registration authority for identity "%s": "%s"', $apiCommand->identityId, - implode("', '", $result->getErrors()) + implode("', '", $result->getErrors()), )); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php b/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php index 23e64a41..fbb78b26 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php @@ -28,26 +28,11 @@ class RecoveryTokenService { - private $commandService; - - /** - * @var ApiRecoveryTokenService - */ - private $apiRecoveryTokenService; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - CommandService $commandService, - ApiRecoveryTokenService $apiRecoveryTokenService, - LoggerInterface $logger + private readonly CommandService $commandService, + private readonly ApiRecoveryTokenService $apiRecoveryTokenService, + private readonly LoggerInterface $logger, ) { - $this->commandService = $commandService; - $this->apiRecoveryTokenService = $apiRecoveryTokenService; - $this->logger = $logger; } public function revoke(RevokeRecoveryTokenCommand $command) @@ -65,7 +50,7 @@ public function revoke(RevokeRecoveryTokenCommand $command) $middlewareCommand->recoveryTokenId, $middlewareCommand->identityId, $middlewareCommand->authorityId, - implode(", ", $result->getErrors()) + implode(", ", $result->getErrors()), )); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php index 188ffbe8..7659c6e0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php @@ -27,26 +27,10 @@ class SecondFactorService { - /** - * @var \Surfnet\StepupMiddlewareClientBundle\Identity\Service\SecondFactorService - */ - private $apiSecondFactorService; - - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; - - /** - * @param ApiSecondFactorService $apiSecondFactorService - * @param LoggerInterface $logger - */ public function __construct( - ApiSecondFactorService $apiSecondFactorService, - LoggerInterface $logger + private readonly ApiSecondFactorService $apiSecondFactorService, + private readonly LoggerInterface $logger, ) { - $this->apiSecondFactorService = $apiSecondFactorService; - $this->logger = $logger; } /** @@ -82,7 +66,7 @@ public function findVerifiedSecondFactorByRegistrationCode($registrationCode, $a } throw new RuntimeException( - sprintf('Got an unexpected amount of identities, expected 0 or 1, got "%d"', $elementCount) + sprintf('Got an unexpected amount of identities, expected 0 or 1, got "%d"', $elementCount), ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index 2e9f5659..a0ae4aa2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -49,81 +49,26 @@ */ class VettingService { - const REGISTRATION_CODE_EXPIRED_ERROR = + final public const REGISTRATION_CODE_EXPIRED_ERROR = 'Surfnet\Stepup\Exception\DomainException: Cannot vet second factor, the registration window is closed.'; - /** - * @var \Surfnet\StepupBundle\Service\SmsSecondFactorServiceInterface - */ - private $smsSecondFactorService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactorService - */ - private $yubikeySecondFactorService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\GssfService - */ - private $gssfService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\CommandService - */ - private $commandService; - - /** - * @var \Surfnet\StepupRa\RaBundle\Repository\VettingProcedureRepository - */ - private $vettingProcedureRepository; - - /** - * @var \Symfony\Component\Translation\TranslatorInterface - */ - private $translator; - - /** - * @var \Surfnet\StepupRa\RaBundle\Service\IdentityService - */ - private $identityService; - - /** - * @var \Surfnet\StepupBundle\Service\SecondFactorTypeService - */ - private $secondFactorTypeService; - - /** - * @var SecondFactorService - */ - private $secondFactorService; - /** * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - SmsSecondFactorServiceInterface $smsSecondFactorService, - YubikeySecondFactorService $yubikeySecondFactorService, - GssfService $gssfService, - CommandService $commandService, - VettingProcedureRepository $vettingProcedureRepository, - TranslatorInterface $translator, - IdentityService $identityService, - SecondFactorTypeService $secondFactorTypeService, - SecondFactorService $secondFactorService + private readonly SmsSecondFactorServiceInterface $smsSecondFactorService, + private readonly YubikeySecondFactorService $yubikeySecondFactorService, + private readonly GssfService $gssfService, + private readonly CommandService $commandService, + private readonly VettingProcedureRepository $vettingProcedureRepository, + private readonly TranslatorInterface $translator, + private readonly IdentityService $identityService, + private readonly SecondFactorTypeService $secondFactorTypeService, + private readonly SecondFactorService $secondFactorService, ) { - $this->smsSecondFactorService = $smsSecondFactorService; - $this->yubikeySecondFactorService = $yubikeySecondFactorService; - $this->gssfService = $gssfService; - $this->commandService = $commandService; - $this->vettingProcedureRepository = $vettingProcedureRepository; - $this->translator = $translator; - $this->identityService = $identityService; - $this->secondFactorTypeService = $secondFactorTypeService; - $this->secondFactorService = $secondFactorService; } /** - * @param StartVettingProcedureCommand $command * @return bool */ public function isLoaSufficientToStartProcedure(StartVettingProcedureCommand $command) @@ -133,12 +78,11 @@ public function isLoaSufficientToStartProcedure(StartVettingProcedureCommand $co return $this->secondFactorTypeService->isSatisfiedBy( $secondFactorType, $command->authorityLoa, - new VettingType(VettingType::TYPE_ON_PREMISE) + new VettingType(VettingType::TYPE_ON_PREMISE), ); } /** - * @param StartVettingProcedureCommand $command * @return bool */ public function isExpiredRegistrationCode(StartVettingProcedureCommand $command) @@ -147,13 +91,12 @@ public function isExpiredRegistrationCode(StartVettingProcedureCommand $command) new DateTime( $command->secondFactor->registrationRequestedAt ->add(new DateInterval('P14D')) - ->setTime(23, 59, 59) - ) + ->setTime(23, 59, 59), + ), ); } /** - * @param StartVettingProcedureCommand $command * @return string The procedure ID. */ public function startProcedure(StartVettingProcedureCommand $command) @@ -165,8 +108,8 @@ public function startProcedure(StartVettingProcedureCommand $command) sprintf( "Registration authority has LoA '%s', which is not enough to allow vetting of a '%s' second factor", $command->authorityLoa, - $command->secondFactor->type - ) + $command->secondFactor->type, + ), ); } @@ -177,7 +120,7 @@ public function startProcedure(StartVettingProcedureCommand $command) $command->authorityId, $command->registrationCode, $command->secondFactor, - $provePossessionSkipped + $provePossessionSkipped, ); $this->vettingProcedureRepository->store($procedure); @@ -199,7 +142,7 @@ public function cancelProcedure($procedureId) if (!$procedure) { throw new UnknownVettingProcedureException( - sprintf("No vetting procedure with id '%s' is known.", $procedureId) + sprintf("No vetting procedure with id '%s' is known.", $procedureId), ); } @@ -224,7 +167,6 @@ public function getSmsMaximumOtpRequestsCount() /** * @param string $procedureId - * @param SendSmsChallengeCommand $command * @return bool * @throws UnknownVettingProcedureException * @throws RuntimeException @@ -234,7 +176,7 @@ public function sendSmsChallenge($procedureId, SendSmsChallengeCommand $command) $procedure = $this->getProcedure($procedureId); $phoneNumber = InternationalPhoneNumber::fromStringFormat( - $procedure->getSecondFactor()->secondFactorIdentifier + $procedure->getSecondFactor()->secondFactorIdentifier, ); $identity = $this->identityService->findById($procedure->getSecondFactor()->identityId); @@ -248,7 +190,7 @@ public function sendSmsChallenge($procedureId, SendSmsChallengeCommand $command) 'ra.vetting.sms.challenge_body', [], 'messages', - $identity->preferredLocale + $identity->preferredLocale, ); $command->identity = $procedure->getSecondFactor()->identityId; $command->institution = $procedure->getSecondFactor()->institution; @@ -259,7 +201,6 @@ public function sendSmsChallenge($procedureId, SendSmsChallengeCommand $command) /** * @param string $procedureId - * @param VerifyPossessionOfPhoneCommand $command * @return OtpVerification * @throws UnknownVettingProcedureException * @throws DomainException @@ -283,7 +224,6 @@ public function verifyPhoneNumber($procedureId, VerifyPossessionOfPhoneCommand $ /** * @param string $procedureId - * @param VerifyYubikeyPublicIdCommand $command * @return YubikeySecondFactor\VerificationResult */ public function verifyYubikeyPublicId($procedureId, VerifyYubikeyPublicIdCommand $command) @@ -338,7 +278,6 @@ public function verifyGssfId($gssfId) /** * @param string $procedureId - * @param VerifyIdentityCommand $command * @return void * @throws UnknownVettingProcedureException * @throws DomainException @@ -438,7 +377,7 @@ private function getProcedure($procedureId) if (!$procedure) { throw new UnknownVettingProcedureException( - sprintf("No vetting procedure with id '%s' is known.", $procedureId) + sprintf("No vetting procedure with id '%s' is known.", $procedureId), ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php index 70f00658..a0c097c2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php @@ -27,29 +27,11 @@ class VettingTypeHintService { - /** - * @var CommandService - */ - private $commandService; - - /** - * @var LibraryVettingTypeHintService - */ - private $service; - - /** - * @var LoggerInterface - */ - private $logger; - public function __construct( - CommandService $commandService, - LibraryVettingTypeHintService $vettingTypeHintService, - LoggerInterface $logger + private readonly CommandService $commandService, + private readonly LibraryVettingTypeHintService $service, + private readonly LoggerInterface $logger, ) { - $this->commandService = $commandService; - $this->service = $vettingTypeHintService; - $this->logger = $logger; } public function save(VettingTypeHintCommand $command) @@ -66,7 +48,7 @@ public function save(VettingTypeHintCommand $command) 'Saving of the vetting type hint for institution "%s" by user "%s" failed: "%s"', $middlewareCommand->institution, $command->identityId, - implode(", ", $result->getErrors()) + implode(", ", $result->getErrors()), )); } @@ -77,7 +59,7 @@ public function findBy(string $institution): ?VettingTypeHint { try { return $this->service->findOne($institution); - } catch (NotFoundException $e) { + } catch (NotFoundException) { return null; } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php index c626a04f..6c106618 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php @@ -23,15 +23,10 @@ class VerificationResult { - const RESULT_PUBLIC_ID_MATCHED = 0; - const RESULT_PUBLIC_ID_DID_NOT_MATCH = 1; - const RESULT_OTP_VERIFICATION_FAILED = 2; - const RESULT_OTP_INVALID = 3; - - /** - * @var \Surfnet\StepupBundle\Value\YubikeyPublicId|null - */ - private $publicId; + final public const RESULT_PUBLIC_ID_MATCHED = 0; + final public const RESULT_PUBLIC_ID_DID_NOT_MATCH = 1; + final public const RESULT_OTP_VERIFICATION_FAILED = 2; + final public const RESULT_OTP_INVALID = 3; /** * @var int One of the RESULT constants. @@ -42,7 +37,7 @@ class VerificationResult * @param int $result * @param YubikeyPublicId|null $publicId */ - public function __construct($result, YubikeyPublicId $publicId = null) + public function __construct($result, private readonly ?YubikeyPublicId $publicId = null) { $acceptableResults = [ self::RESULT_PUBLIC_ID_MATCHED, @@ -56,7 +51,6 @@ public function __construct($result, YubikeyPublicId $publicId = null) } $this->result = $result; - $this->publicId = $publicId; } public function didPublicIdMatch() diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php index 63620e27..95687fcc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php @@ -27,28 +27,13 @@ class YubikeySecondFactorService { - /** - * @var YubikeyService - */ - private $yubikeyService; - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @param YubikeyService $yubikeyService - * @param LoggerInterface $logger - */ - public function __construct(YubikeyService $yubikeyService, LoggerInterface $logger) - { - $this->yubikeyService = $yubikeyService; - $this->logger = $logger; + public function __construct( + private readonly YubikeyService $yubikeyService, + private readonly LoggerInterface $logger, + ) { } /** - * @param VerifyYubikeyPublicIdCommand $command * @return VerificationResult */ public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command) @@ -75,14 +60,14 @@ public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command) if ($publicId->getYubikeyPublicId() !== $command->expectedPublicId) { $this->logger->notice( - 'Yubikey used by registrant during vetting did not match the one used during registration.' + 'Yubikey used by registrant during vetting did not match the one used during registration.', ); return new VerificationResult(VerificationResult::RESULT_PUBLIC_ID_DID_NOT_MATCH, $publicId); } $this->logger->info( - 'Yubikey used by registrant during vetting matches the one used during registration.' + 'Yubikey used by registrant during vetting matches the one used during registration.', ); return new VerificationResult(VerificationResult::RESULT_PUBLIC_ID_MATCHED, $publicId); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php index 777b2c92..f32b1113 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php @@ -22,31 +22,18 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Http\JsonHelper; use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyOtpCommand; +use RuntimeException; class YubikeyService { - /** - * @var Client - */ - private $guzzleClient; - - /** - * @var LoggerInterface - */ - private $logger; - /** * @param Client $guzzleClient A Guzzle client configured with the Yubikey API base URL and authentication. - * @param LoggerInterface $logger */ - public function __construct(Client $guzzleClient, LoggerInterface $logger) + public function __construct(private readonly Client $guzzleClient, private readonly LoggerInterface $logger) { - $this->guzzleClient = $guzzleClient; - $this->logger = $logger; } /** - * @param VerifyYubikeyOtpCommand $command * @return YubikeyVerificationResult */ public function verify(VerifyYubikeyOtpCommand $command) @@ -69,7 +56,7 @@ public function verify(VerifyYubikeyOtpCommand $command) try { $result = JsonHelper::decode((string) $response->getBody()); - } catch (\RuntimeException $e) { + } catch (RuntimeException) { $this->logger->error('Yubikey OTP verification failed; server responded with malformed JSON.'); return new YubikeyVerificationResult(false, true); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php index 29ebc5f0..09598252 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php @@ -20,24 +20,12 @@ class YubikeyVerificationResult { - /** - * @var bool - */ - private $clientError; - - /** - * @var bool - */ - private $serverError; - /** * @param bool $clientError * @param bool $serverError */ - public function __construct($clientError, $serverError) + public function __construct(private $clientError, private $serverError) { - $this->clientError = $clientError; - $this->serverError = $serverError; } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php index 5b0711fd..999787a3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php @@ -24,14 +24,8 @@ final class SecondFactorType extends Twig_Extension { - /** - * @var SecondFactorTypeTranslationService - */ - private $translator; - - public function __construct(SecondFactorTypeTranslationService $translator) + public function __construct(private readonly SecondFactorTypeTranslationService $translator) { - $this->translator = $translator; } public function getName() @@ -42,7 +36,7 @@ public function getName() public function getFilters() { return [ - new Twig_SimpleFilter('trans_second_factor_type', [$this, 'translateSecondFactorType']), + new Twig_SimpleFilter('trans_second_factor_type', $this->translateSecondFactorType(...)), ]; } diff --git a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php index 5b32ce92..430292da 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php @@ -21,16 +21,17 @@ use DateInterval; use DateTime as CoreDateTime; use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; +use Stringable; /** * @SuppressWarnings(PHPMD.TooManyPublicMethods) due to comparison methods */ -class DateTime +class DateTime implements Stringable { /** * This string can also be used with `DateTime::createFromString()`. */ - const FORMAT = DATE_ATOM; + final public const FORMAT = DATE_ATOM; /** * Allows for mocking of time. @@ -80,7 +81,6 @@ public function __construct(CoreDateTime $dateTime = null) } /** - * @param DateInterval $interval * @return DateTime */ public function add(DateInterval $interval) @@ -92,7 +92,6 @@ public function add(DateInterval $interval) } /** - * @param DateInterval $interval * @return DateTime */ public function sub(DateInterval $interval) @@ -104,7 +103,6 @@ public function sub(DateInterval $interval) } /** - * @param DateTime $dateTime * @return boolean */ public function comesBefore(DateTime $dateTime) @@ -113,7 +111,6 @@ public function comesBefore(DateTime $dateTime) } /** - * @param DateTime $dateTime * @return boolean */ public function comesBeforeOrIsEqual(DateTime $dateTime) @@ -122,7 +119,6 @@ public function comesBeforeOrIsEqual(DateTime $dateTime) } /** - * @param DateTime $dateTime * @return boolean */ public function comesAfter(DateTime $dateTime) @@ -131,7 +127,6 @@ public function comesAfter(DateTime $dateTime) } /** - * @param DateTime $dateTime * @return boolean */ public function comesAfterOrIsEqual(DateTime $dateTime) @@ -151,8 +146,8 @@ public function format($format) throw new InvalidArgumentException( sprintf( 'Given format "%s" is not a valid format for DateTime', - $format - ) + $format, + ), ); } @@ -162,7 +157,7 @@ public function format($format) /** * @return string An ISO 8601 representation of this DateTime. */ - public function __toString() + public function __toString(): string { return $this->format(self::FORMAT); } diff --git a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php index 2124388f..758cc984 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php @@ -20,20 +20,12 @@ use DateInterval; use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; +use Stringable; -final class TimeFrame +final readonly class TimeFrame implements Stringable { - /** - * @var DateInterval - */ - private $timeFrame; - - /** - * @param DateInterval $timeFrame - */ - final private function __construct(DateInterval $timeFrame) + final private function __construct(private DateInterval $timeFrame) { - $this->timeFrame = $timeFrame; } /** @@ -50,7 +42,6 @@ public static function ofSeconds($seconds) } /** - * @param DateTime $dateTime * @return DateTime */ public function getEndWhenStartingAt(DateTime $dateTime) @@ -59,7 +50,6 @@ public function getEndWhenStartingAt(DateTime $dateTime) } /** - * @param TimeFrame $other * @return bool */ public function equals(TimeFrame $other) @@ -67,7 +57,7 @@ public function equals(TimeFrame $other) return $this->timeFrame->s === $other->timeFrame->s; } - public function __toString() + public function __toString(): string { return $this->timeFrame->format('%S'); } diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index 857f9f3d..2261e118 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -76,12 +76,16 @@ class VettingProcedure * @param string $id * @param string $authorityId * @param string $registrationCode - * @param VerifiedSecondFactor $secondFactor * @param bool $skipProvePossession * @return self */ - public static function start($id, $authorityId, $registrationCode, VerifiedSecondFactor $secondFactor, $skipProvePossession) - { + public static function start( + $id, + $authorityId, + $registrationCode, + VerifiedSecondFactor $secondFactor, + $skipProvePossession, + ) { if (!is_string($id)) { throw InvalidArgumentException::invalidType('string', 'id', $id); } @@ -122,7 +126,7 @@ public function verifySecondFactorIdentifier($secondFactorIdentifier) if (!$this->isReadyForSecondFactorToBeVerified()) { throw new DomainException( 'Second factor is not yet ready for verification of second factor, ' . - 'it has already been verified or the registration code is unknown.' + 'it has already been verified or the registration code is unknown.', ); } @@ -144,7 +148,7 @@ public function verifyIdentity($documentNumber, $identityVerified) if (!$this->isReadyForIdentityVerification()) { throw new DomainException( 'Second factor is not yet ready for verification of its Identity; ' . - 'verify the registrant has the same second factor as used during the registration process.' + 'verify the registrant has the same second factor as used during the registration process.', ); } @@ -174,7 +178,7 @@ public function vet() throw new DomainException( 'Second factor is not yet ready for verification of its Identity; ' . 'verify the registrant has the same second factor as used during the registration process, '. - "and verify the registrant's identity." + "and verify the registrant's identity.", ); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php index 09f6959d..12f930df 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php @@ -37,7 +37,7 @@ public function process(ContainerBuilder $container) $definition = $container->findDefinition('surfnet_stepup.provider.collection'); $taggedServices = $container->findTaggedServiceIds( - SurfnetStepupRaSamlStepupProviderExtension::VIEW_CONFIG_TAG_NAME + SurfnetStepupRaSamlStepupProviderExtension::VIEW_CONFIG_TAG_NAME, ); $taggedServices = array_keys($taggedServices); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php index c34347d1..da318c3e 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php @@ -38,9 +38,6 @@ public function getConfigTreeBuilder() return $treeBuilder; } - /** - * @param ArrayNodeDefinition $rootNode - */ private function addRoutesSection(ArrayNodeDefinition $rootNode) { $rootNode @@ -50,18 +47,14 @@ private function addRoutesSection(ArrayNodeDefinition $rootNode) ->scalarNode('consume_assertion') ->isRequired() ->validate() - ->ifTrue(function ($v) { - return !is_string($v) || strlen($v) === 0; - }) + ->ifTrue(fn($v) => !is_string($v) || strlen($v) === 0) ->thenInvalid('Consume assertion route must be a non-empty string') ->end() ->end() ->scalarNode('metadata') ->isRequired() ->validate() - ->ifTrue(function ($v) { - return !is_string($v) || strlen($v) === 0; - }) + ->ifTrue(fn($v) => !is_string($v) || strlen($v) === 0) ->thenInvalid('Metadata route must be a non-empty string') ->end() ->end() @@ -69,9 +62,6 @@ private function addRoutesSection(ArrayNodeDefinition $rootNode) ->end(); } - /** - * @param ArrayNodeDefinition $rootNode - */ private function addProvidersSection(ArrayNodeDefinition $rootNode) { /** @var ArrayNodeDefinition $protoType */ @@ -127,7 +117,7 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode) ->isRequired() ->info( 'The contents of the certificate used to sign the AuthnResponse with, if different from' - . ' the public key configured below' + . ' the public key configured below', ) ->end() ->end() diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index ee125db9..fbe756e0 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -25,11 +25,19 @@ use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Surfnet\StepupRa\SamlStepupProviderBundle\Saml\StateHandler; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig; +use Surfnet\SamlBundle\Entity\ServiceProvider; +use Surfnet\SamlBundle\Entity\HostedEntities; +use Surfnet\SamlBundle\Entity\IdentityProvider; +use Surfnet\SamlBundle\Metadata\MetadataConfiguration; +use Surfnet\SamlBundle\Metadata\MetadataFactory; class SurfnetStepupRaSamlStepupProviderExtension extends Extension { - const VIEW_CONFIG_TAG_NAME = 'gssp.view_config'; + final public const VIEW_CONFIG_TAG_NAME = 'gssp.view_config'; /** * {@inheritdoc} @@ -45,7 +53,7 @@ public function load(array $configs, ContainerBuilder $container) foreach ($config['providers'] as $provider => $providerConfiguration) { // may seem a bit strange, but this prevents casing issue when getting/setting/creating provider // service definitions etc. - if ($provider !== strtolower($provider)) { + if ($provider !== strtolower((string) $provider)) { throw new InvalidConfigurationException('The provider name must be completely lowercase'); } @@ -57,7 +65,7 @@ private function loadProviderConfiguration( $provider, array $configuration, array $routes, - ContainerBuilder $container + ContainerBuilder $container, ) { if ($container->has('gssp.provider.' . $provider)) { throw new InvalidConfigurationException(sprintf('Cannot create the same provider "%s" twice', $provider)); @@ -67,13 +75,13 @@ private function loadProviderConfiguration( $this->createMetadataDefinition($provider, $configuration['hosted'], $routes, $container); $this->createRemoteDefinition($provider, $configuration['remote'], $container); - $stateHandlerDefinition = new Definition('Surfnet\StepupRa\SamlStepupProviderBundle\Saml\StateHandler', [ + $stateHandlerDefinition = new Definition(StateHandler::class, [ new Reference('gssp.sessionbag'), $provider ]); $container->setDefinition('gssp.provider.' . $provider . '.statehandler', $stateHandlerDefinition); - $providerDefinition = new Definition('Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider', [ + $providerDefinition = new Definition(Provider::class, [ $provider, new Reference('gssp.provider.' . $provider . '.hosted.sp'), new Reference('gssp.provider.' . $provider . '.remote.idp'), @@ -83,7 +91,7 @@ private function loadProviderConfiguration( $providerDefinition->setPublic(false); $container->setDefinition('gssp.provider.' . $provider, $providerDefinition); - $viewConfigDefinition = new Definition('Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig', [ + $viewConfigDefinition = new Definition(ViewConfig::class, [ new Reference('request_stack'), $configuration['view_config']['title'], $configuration['view_config']['page_title'], @@ -103,21 +111,18 @@ private function loadProviderConfiguration( /** * @param string $provider - * @param array $configuration - * @param array $routes - * @param ContainerBuilder $container */ private function createHostedDefinitions( $provider, array $configuration, array $routes, - ContainerBuilder $container + ContainerBuilder $container, ) { $hostedDefinition = $this->buildHostedEntityDefinition($provider, $configuration, $routes); $container->setDefinition('gssp.provider.' . $provider . '.hosted_entities', $hostedDefinition); $hostedSpDefinition = (new Definition()) - ->setClass('Surfnet\SamlBundle\Entity\ServiceProvider') + ->setClass(ServiceProvider::class) ->setFactory([ new Reference('gssp.provider.' . $provider . '.hosted_entities'), 'getServiceProvider' @@ -128,8 +133,6 @@ private function createHostedDefinitions( /** * @param string $provider - * @param array $configuration - * @param array $routes * @return Definition */ private function buildHostedEntityDefinition($provider, array $configuration, array $routes) @@ -146,7 +149,7 @@ private function buildHostedEntityDefinition($provider, array $configuration, ar $serviceProvider = array_merge($configuration['service_provider'], $spAdditional, $entityId); $identityProvider = array_merge($idpAdditional, $entityId); - $hostedDefinition = new Definition('Surfnet\SamlBundle\Entity\HostedEntities', [ + $hostedDefinition = new Definition(HostedEntities::class, [ new Reference('router'), new Reference('request_stack'), $serviceProvider, @@ -160,12 +163,10 @@ private function buildHostedEntityDefinition($provider, array $configuration, ar /** * @param string $provider - * @param array $configuration - * @param ContainerBuilder $container */ private function createRemoteDefinition($provider, array $configuration, ContainerBuilder $container) { - $definition = new Definition('Surfnet\SamlBundle\Entity\IdentityProvider', [ + $definition = new Definition(IdentityProvider::class, [ [ 'entityId' => $configuration['entity_id'], 'ssoUrl' => $configuration['sso_url'], @@ -179,18 +180,15 @@ private function createRemoteDefinition($provider, array $configuration, Contain /** * @param string $provider - * @param array $configuration - * @param array $routes - * @param ContainerBuilder $container * @return Definition */ private function createMetadataDefinition( $provider, array $configuration, array $routes, - ContainerBuilder $container + ContainerBuilder $container, ) { - $metadataConfiguration = new Definition('Surfnet\SamlBundle\Metadata\MetadataConfiguration'); + $metadataConfiguration = new Definition(MetadataConfiguration::class); $propertyMap = [ 'entityIdRoute' => $this->createRouteConfig($provider, $routes['metadata']), @@ -205,7 +203,7 @@ private function createMetadataDefinition( $metadataConfiguration->setPublic(false); $container->setDefinition('gssp.provider.' . $provider . 'metadata.configuration', $metadataConfiguration); - $metadataFactory = new Definition('Surfnet\SamlBundle\Metadata\MetadataFactory', [ + $metadataFactory = new Definition(MetadataFactory::class, [ new Reference('templating'), new Reference('router'), new Reference('surfnet_saml.signing_service'), diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php index 1a1a1249..067a3812 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php @@ -29,8 +29,8 @@ public static function invalidType($expectedType, $parameter, $value) 'Invalid Argument, parameter "%s" should be of type "%s", "%s" given', $parameter, $expectedType, - is_object($value) ? get_class($value) : gettype($value) - ) + get_debug_type($value), + ), ); } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php index bf4daae7..f15a599a 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php @@ -24,8 +24,8 @@ public static function create($unknownProvider, array $knownProviders) { return new static(sprintf( 'Unknown Generic SAML Stepup Provider requested "%s", known providers: "%s"', - is_object($unknownProvider) ? '(object)' . get_class($unknownProvider) : $unknownProvider, - implode('", "', $knownProviders) + is_object($unknownProvider) ? '(object)' . $unknownProvider::class : $unknownProvider, + implode('", "', $knownProviders), )); } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php index b70f9935..1e8eadec 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php @@ -21,8 +21,9 @@ use DOMDocument; use LogicException; use Surfnet\SamlBundle\Signing\Signable; +use Stringable; -class Metadata implements Signable +class Metadata implements Signable, Stringable { /** * @var string @@ -62,15 +63,15 @@ public function getAppendBeforeNode() { if (!$this->document) { throw new LogicException( - 'Cannot get the appendBeforeNode of Metadata before the document has been generated' + 'Cannot get the appendBeforeNode of Metadata before the document has been generated', ); } return $this->document->documentElement->childNodes->item(0); } - public function __toString() + public function __toString(): string { - return $this->document->saveXML(); + return (string) $this->document->saveXML(); } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php index 4859c6d4..f52cb893 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php @@ -24,42 +24,15 @@ final class Provider { - /** - * @var string - */ - private $name; - - /** - * @var \Surfnet\SamlBundle\Entity\ServiceProvider - */ - private $serviceProvider; - - /** - * @var \Surfnet\SamlBundle\Entity\IdentityProvider - */ - private $remoteIdentityProvider; - - /** - * @var \Surfnet\StepupRa\SamlStepupProviderBundle\Saml\StateHandler - */ - private $stateHandler; - /** * @param string $name - * @param ServiceProvider $serviceProvider - * @param IdentityProvider $remoteIdentityProvider - * @param StateHandler $stateHandler */ public function __construct( - $name, - ServiceProvider $serviceProvider, - IdentityProvider $remoteIdentityProvider, - StateHandler $stateHandler + private $name, + private readonly ServiceProvider $serviceProvider, + private readonly IdentityProvider $remoteIdentityProvider, + private readonly StateHandler $stateHandler, ) { - $this->name = $name; - $this->serviceProvider = $serviceProvider; - $this->remoteIdentityProvider = $remoteIdentityProvider; - $this->stateHandler = $stateHandler; } /** diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php index 9be6fb6c..1ef110cd 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php @@ -33,15 +33,12 @@ public function __construct() $this->providers = []; } - /** - * @param Provider $provider - */ public function addProvider(Provider $provider) { if ($this->has($provider->getName())) { throw new InvalidConfigurationException(sprintf( 'Provider "%s" has already been added to the repository', - $provider->getName() + $provider->getName(), )); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index 0a5fbbf7..ec56657f 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -49,31 +49,19 @@ class ViewConfig implements ViewConfigInterface */ public $gssfIdMismatch; - /** - * @var RequestStack - */ - private $requestStack; - /** * The arrays are arrays of translated text, indexed on locale. * - * @param RequestStack $requestStack - * @param array $title - * @param array $pageTitle - * @param array $explanation - * @param array $initiate - * @param array $gssfIdMismatch * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - RequestStack $requestStack, + private readonly RequestStack $requestStack, array $title, array $pageTitle, array $explanation, array $initiate, - array $gssfIdMismatch + array $gssfIdMismatch, ) { - $this->requestStack = $requestStack; $this->title = $title; $this->pageTitle = $pageTitle; $this->explanation = $explanation; @@ -122,7 +110,6 @@ public function getPageTitle() } /** - * @param array $translations * @return mixed * @throws LogicException */ @@ -139,8 +126,8 @@ private function getTranslation(array $translations) sprintf( 'The requested translation is not available in this language: %s. Available languages: %s', $currentLocale, - implode(', ', array_keys($translations)) - ) + implode(', ', array_keys($translations)), + ), ); } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php index 3de13b0d..3c3ed847 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php @@ -24,19 +24,10 @@ final class StateHandler { /** - * @var string + * @param string $provider */ - private $provider; - - /** - * @var NamespacedAttributeBag - */ - private $attributeBag; - - public function __construct(NamespacedAttributeBag $attributeBag, $provider) + public function __construct(private readonly NamespacedAttributeBag $attributeBag, private $provider) { - $this->attributeBag = $attributeBag; - $this->provider = $provider; } /** diff --git a/symfony.lock b/symfony.lock index 310adfa1..75c71e70 100644 --- a/symfony.lock +++ b/symfony.lock @@ -566,9 +566,9 @@ "version": "4.4", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "4.4", - "ref": "15a41bbd66a1323d09824a189b485c126bbefa51" + "ref": "73baff3f7b3cea12a73812a7cfd2c0924a9e250f" }, "files": [ "config/packages/test/twig.yaml", From 7dbaa0cf561c8d9e0b491692eb2e8570891f3e52 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 09:11:28 +0100 Subject: [PATCH 020/202] Rector remove Action suffix --- .../StepupRa/RaBundle/Controller/LocaleController.php | 2 +- .../StepupRa/RaBundle/Controller/ProfileController.php | 2 +- .../RaBundle/Controller/RaLocationController.php | 8 ++++---- .../RaBundle/Controller/RaManagementController.php | 10 +++++----- .../StepupRa/RaBundle/Controller/RaaController.php | 2 +- .../RaBundle/Controller/RecoveryTokenController.php | 4 ++-- .../StepupRa/RaBundle/Controller/SamlController.php | 4 ++-- .../RaBundle/Controller/SecondFactorController.php | 8 ++++---- .../RaBundle/Controller/SecurityController.php | 2 +- .../RaBundle/Controller/Vetting/GssfController.php | 8 ++++---- .../RaBundle/Controller/Vetting/SmsController.php | 4 ++-- .../RaBundle/Controller/Vetting/YubikeyController.php | 2 +- .../StepupRa/RaBundle/Controller/VettingController.php | 8 ++++---- .../RaBundle/Controller/VettingTypeHintController.php | 2 +- .../StepupRa/RaBundle/Resources/config/routing.yml | 10 +++++----- 15 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 89d40144..7623cb72 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -28,7 +28,7 @@ final class LocaleController extends AbstractController { - public function switchLocaleAction(Request $request) + public function switchLocale(Request $request) { $returnUrl = $request->query->get('return-url'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index a8dc7996..f7de0ea8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -23,7 +23,7 @@ final class ProfileController extends AbstractController { - public function profileAction() + public function profile() { $logger = $this->get('logger'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 9ace7bd7..2c55714d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -45,7 +45,7 @@ final class RaLocationController extends AbstractController * @Template * @return array|Response */ - public function manageAction(Request $request) + public function manage(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -108,7 +108,7 @@ public function manageAction(Request $request) ]; } - public function createAction(Request $request) + public function create(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); @@ -146,7 +146,7 @@ public function createAction(Request $request) ]); } - public function changeAction(Request $request) + public function change(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); @@ -198,7 +198,7 @@ public function changeAction(Request $request) /** * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - public function removeAction(Request $request) + public function remove(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 7a2cf6fd..ed0ba00b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -44,7 +44,7 @@ class RaManagementController extends AbstractController /** * @return Response */ - public function manageAction(Request $request): Response + public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -102,7 +102,7 @@ public function manageAction(Request $request): Response /** * @return Response */ - public function raCandidateSearchAction(Request $request) + public function raCandidateSearch(Request $request) { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -159,7 +159,7 @@ public function raCandidateSearchAction(Request $request) /** * @return Response */ - public function createRaAction(Request $request) + public function createRa(Request $request) { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -216,7 +216,7 @@ public function createRaAction(Request $request) * @param $raInstitution * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response */ - public function amendRaInformationAction(Request $request, $identityId, $raInstitution) + public function amendRaInformation(Request $request, $identityId, $raInstitution) { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -263,7 +263,7 @@ public function amendRaInformationAction(Request $request, $identityId, $raInsti * @param $raInstitution * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response */ - public function retractRegistrationAuthorityAction(Request $request, $identityId, $raInstitution) + public function retractRegistrationAuthority(Request $request, $identityId, $raInstitution) { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index 224a9ce4..cbce14bb 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -29,7 +29,7 @@ class RaaController extends AbstractController { - public function institutionConfigurationAction(Request $request) + public function institutionConfiguration(Request $request) { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 7477bdf2..f21f6c3d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -44,7 +44,7 @@ public function __construct( ) { } - public function searchAction(Request $request): Response + public function search(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -98,7 +98,7 @@ public function searchAction(Request $request): Response ); } - public function revokeAction(Request $request): RedirectResponse + public function revoke(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 7e680788..96a60a78 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -30,7 +30,7 @@ class SamlController extends AbstractController /** * @Template */ - public function consumeAssertionAction(Request $httpRequest) + public function consumeAssertion(Request $httpRequest) { /** @var PostBinding $postBinding */ $postBinding = $this->get('surfnet_saml.http.post_binding'); @@ -44,7 +44,7 @@ public function consumeAssertionAction(Request $httpRequest) return $assertion->getAttributes(); } - public function metadataAction() + public function metadata() { /** @var MetadataFactory $metadataFactory */ $metadataFactory = $this->get('surfnet_saml.metadata_factory'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 8a24f175..f834629d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -41,7 +41,7 @@ final class SecondFactorController extends AbstractController * @Template * @return array|Response */ - public function searchAction(Request $request) + public function search(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -99,7 +99,7 @@ public function searchAction(Request $request) ]; } - public function exportAction(SearchRaSecondFactorsCommand $command) + public function export(SearchRaSecondFactorsCommand $command) { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -113,7 +113,7 @@ public function exportAction(SearchRaSecondFactorsCommand $command) /** * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - public function revokeAction(Request $request) + public function revoke(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -152,7 +152,7 @@ public function revokeAction(Request $request) /** * @return Response */ - public function auditLogAction(Request $request) + public function auditLog(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index b9c860e0..dc69f3ed 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -23,7 +23,7 @@ class SecurityController extends AbstractController { - public function sessionExpiredAction(Request $request) + public function sessionExpired(Request $request) { $redirectToUrl = $this ->get('ra.security.authentication.session.session_storage') diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index f00f40f7..c599b570 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -45,7 +45,7 @@ final class GssfController extends SecondFactorController * @param string $provider * @return array|Response */ - public function initiateAction($procedureId, $provider) + public function initiate($procedureId, $provider) { $this->assertSecondFactorEnabled($provider); @@ -67,7 +67,7 @@ public function initiateAction($procedureId, $provider) * @param string $provider * @return array|Response */ - public function authenticateAction($procedureId, $provider) + public function authenticate($procedureId, $provider) { $this->assertSecondFactorEnabled($provider); @@ -117,7 +117,7 @@ public function authenticateAction($procedureId, $provider) * @param string $provider * @return array|Response */ - public function verifyAction(Request $httpRequest, $provider) + public function verify(Request $httpRequest, $provider) { $this->assertSecondFactorEnabled($provider); @@ -198,7 +198,7 @@ public function verifyAction(Request $httpRequest, $provider) * @param string $provider * @return \Symfony\Component\HttpFoundation\Response */ - public function metadataAction($provider) + public function metadata($provider) { $this->assertSecondFactorEnabled($provider); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index dd82a14f..e67e80e7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -39,7 +39,7 @@ class SmsController extends SecondFactorController * @param string $procedureId * @return array|Response */ - public function sendChallengeAction(Request $request, $procedureId) + public function sendChallenge(Request $request, $procedureId) { $this->assertSecondFactorEnabled('sms'); @@ -103,7 +103,7 @@ public function sendChallengeAction(Request $request, $procedureId) * @param string $procedureId * @return array|Response */ - public function provePossessionAction(Request $request, $procedureId) + public function provePossession(Request $request, $procedureId) { $this->assertSecondFactorEnabled('sms'); $this->denyAccessUnlessGranted('ROLE_RA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 2aaa54fd..cc1e67a0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -34,7 +34,7 @@ class YubikeyController extends SecondFactorController * @param string $procedureId * @return array|Response */ - public function verifyAction(Request $request, $procedureId) + public function verify(Request $request, $procedureId) { $this->assertSecondFactorEnabled('yubikey'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 47c66724..cbbdd9b5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -50,7 +50,7 @@ class VettingController extends AbstractController * @SuppressWarnings(PHPMD.CyclomaticComplexity) https://www.pivotaltracker.com/story/show/135045063 * @SuppressWarnings(PHPMD.NPathComplexity) https://www.pivotaltracker.com/story/show/135045063 */ - public function startProcedureAction(Request $request) + public function startProcedure(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); @@ -165,7 +165,7 @@ public function startProcedureAction(Request $request) } } - public function cancelProcedureAction($procedureId) + public function cancelProcedure($procedureId) { $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); @@ -188,7 +188,7 @@ public function cancelProcedureAction($procedureId) * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function verifyIdentityAction(Request $request, $procedureId) + public function verifyIdentity(Request $request, $procedureId) { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -276,7 +276,7 @@ public function verifyIdentityAction(Request $request, $procedureId) /** * @Template */ - public function vettingCompletedAction() + public function vettingCompleted() { return []; } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index fe6a88d8..cbfea1a8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -48,7 +48,7 @@ public function __construct( /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) Given the two forms being handled in this action, cc is higher. */ - public function vettingTypeHintAction(Request $request): Response + public function vettingTypeHint(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml index c7d22807..c26a5619 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml @@ -31,22 +31,22 @@ ra_location_remove: ra_second_factors_search: path: /second-factors methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::searchAction} + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::search} ra_second_factor_revoke: path: /second-factors/revoke methods: [POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::revokeAction } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::revoke } ra_second_factor_auditlog: path: /second-factors/{identityId}/auditlog methods: [GET] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::auditLogAction } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::auditLog } ra_recovery_tokens_search: path: /recovery-tokens methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RecoveryTokenController::searchAction } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RecoveryTokenController::search } ra_recovery_tokens_revoke: path: /recovery-tokens/revoke @@ -116,7 +116,7 @@ ra_vetting_completed: ra_management_manage: path: /management/ra methods: [GET] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaManagementController::manageAction } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaManagementController::manage } ra_management_ra_candidate_search: path: /management/search-ra-candidate From 6e78353aba0956db8407db0b9fdbb82986b96879 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 09:38:15 +0100 Subject: [PATCH 021/202] Repair controller calls --- .../Controller/RaLocationController.php | 2 +- .../Controller/SecurityController.php | 3 +- .../RaBundle/Resources/config/routing.yml | 58 +++++++++---------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 2c55714d..b05fd087 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -68,7 +68,7 @@ public function manage(Request $request) $institution = $institutionParameter; } - // Only show the form if more than one institutions where found. + // Only show the form if more than one institution where found. if (count($choices) > 1) { $command = new SelectInstitutionCommand(); $command->institution = $institution; diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index dc69f3ed..0728a0b9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -20,10 +20,11 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class SecurityController extends AbstractController { - public function sessionExpired(Request $request) + public function sessionExpired(Request $request): Response { $redirectToUrl = $this ->get('ra.security.authentication.session.session_storage') diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml index c26a5619..a19fec99 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml @@ -1,32 +1,32 @@ ra_saml_metadata: path: /authentication/metadata methods: [GET] - defaults: { _controller: SurfnetStepupRaRaBundle:Saml:metadata } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\SamlController::metadata } ra_serviceprovider_consume_assertion: path: /authentication/consume-assertion methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Saml:consumeAssertion } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\SamlController::consumeAssertion } ra_locations_manage: path: /locations methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaLocation:manage } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::manage } ra_location_create: path: /locations/create/{institution} methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaLocation:create } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::create } ra_location_change: path: /locations/{locationId}/change methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaLocation:change } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::change } ra_location_remove: path: /locations/remove methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaLocation:remove } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::remove } ra_second_factors_search: path: /second-factors @@ -51,109 +51,109 @@ ra_recovery_tokens_search: ra_recovery_tokens_revoke: path: /recovery-tokens/revoke methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RecoveryToken:revoke } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RecoveryTokenController::revoke } ra_recovery_tokens_auditlog: path: /recovery-tokens/{identityId}/auditlog methods: [ GET ] - defaults: { _controller: SurfnetStepupRaRaBundle:SecondFactor:auditLog } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::auditLog } ra_vetting_search: path: / methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting:startProcedure } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\VettingController::startProcedure } ra_vetting_cancel: path: /vetting-procedure/{procedureId}/cancel methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting:cancelProcedure } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\VettingController::cancelProcedure } ra_vetting_yubikey_verify: path: /vetting-procedure/{procedureId}/verify-yubikey methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Yubikey:verify } + defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\Vetting\YubikeyController::verify } ra_vetting_sms_send_challenge: path: /vetting-procedure/{procedureId}/send-sms-challenge methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Sms:sendChallenge } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\SmsController::sendChallenge } ra_vetting_sms_prove_possession: path: /vetting-procedure/{procedureId}/verify-sms-challenge methods: [GET,POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Sms:provePossession } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\SmsController::provePossession} ra_vetting_gssf_initiate: path: /vetting-procedure/{procedureId}/gssf/{provider}/initiate-verification methods: [GET] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Gssf:initiate } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::initiate } ra_vetting_gssf_authenticate: path: /vetting-procedure/{procedureId}/gssf/{provider}/authenticate methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Gssf:authenticate } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::authenticate} ra_vetting_gssf_verify: path: /vetting-procedure/gssf/{provider}/verify methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Gssf:verify } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::verify } ra_vetting_gssf_metadata: path: /vetting-procedure/gssf/{provider}/metadata methods: [GET] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting/Gssf:metadata } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::metadata} ra_vetting_verify_identity: path: /vetting-procedure/{procedureId}/verify-identity methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting:verifyIdentity } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\VettingController::verifyIdentity } ra_vetting_completed: path: /vetting-procedure/{procedureId}/completed methods: [GET] - defaults: { _controller: SurfnetStepupRaRaBundle:Vetting:vettingCompleted } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\VettingController::vettingCompleted} ra_management_manage: path: /management/ra methods: [GET] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaManagementController::manage } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::manage } ra_management_ra_candidate_search: path: /management/search-ra-candidate methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaManagement:raCandidateSearch } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::raCandidateSearch } ra_management_create_ra: path: /management/create-ra/{identityId} methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaManagement:createRa } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::createRa } ra_management_amend_ra_information: path: /management/amend-ra-information/{identityId}/{raInstitution} methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaManagement:amendRaInformation } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::amendRaInformation} ra_management_retract_registration_authority: path: /management/retract-registration-authority/{identityId}/{raInstitution} methods: [GET, POST] - defaults: { _controller: SurfnetStepupRaRaBundle:RaManagement:retractRegistrationAuthority } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::retractRegistrationAuthority } institution-configuration: path: /institution-configuration methods: [GET, POST] defaults: - _controller: SurfnetStepupRaRaBundle:Raa:institutionConfiguration + _controller: \Surfnet\StepupRa\RaBundle\Controller\RaaController::institutionConfiguration vetting_type_hint: path: /vetting-type-hint methods: [GET, POST] defaults: - _controller: SurfnetStepupRaRaBundle:VettingTypeHint:vettingTypeHint + _controller: \Surfnet\StepupRa\RaBundle\Controller\VettingTypeHintController::vettingTypeHint ra_switch_locale: path: /switch-locale methods: [POST] - defaults: { _controller: SurfnetStepupRaRaBundle:Locale:switchLocale } + defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\LocaleController::switchLocale} requirements: 'return-url': '.+' @@ -161,10 +161,10 @@ ra_security_session_expired: path: /authentication/session-expired methods: [GET] defaults: - _controller: SurfnetStepupRaRaBundle:Security:sessionExpired + _controller: \Surfnet\StepupRa\RaBundle\Controller\SecurityController::sessionExpired ra_profile: path: /profile methods: [GET] defaults: - _controller: SurfnetStepupRaRaBundle:Profile:profile + _controller: \Surfnet\StepupRa\RaBundle\Controller\ProfileController::profile From 676397bafdef21298e052a872fdb655548455a65 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 09:48:06 +0100 Subject: [PATCH 022/202] Update quality tools --- composer.json | 3 +- composer.lock | 1064 +++++++++-------- .../Authentication/Token/SamlToken.php | 3 +- symfony.lock | 15 - 4 files changed, 555 insertions(+), 530 deletions(-) diff --git a/composer.json b/composer.json index 96bccfe3..e1a24658 100644 --- a/composer.json +++ b/composer.json @@ -47,10 +47,9 @@ "mockery/mockery": "~1.0", "overtrue/phplint": "^2.3", "phpmd/phpmd": "^2.6", - "phpunit/phpunit": "8.5.*", + "phpunit/phpunit": "^9.5", "rector/rector": "^0.19.5", "slevomat/coding-standard": "^8.13", - "sebastian/exporter": "3.1.*", "squizlabs/php_codesniffer": "^3.4", "symfony/dotenv": "4.4.*", "symfony/maker-bundle": "^1.19", diff --git a/composer.lock b/composer.lock index fcd33614..fdffbc77 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "27059ace1999dcd4abca5b7838c7c501", + "content-hash": "3876e42c927f03ff1a6128b28bbff12c", "packages": [ { "name": "beberlei/assert", @@ -831,30 +831,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -881,7 +881,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -897,7 +897,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "doctrine/lexer", @@ -2040,16 +2040,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.18.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", "shasum": "" }, "require": { @@ -2090,9 +2090,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2023-12-10T21:03:43+00:00" }, { "name": "openconext/monitor-bundle", @@ -7745,16 +7745,16 @@ }, { "name": "twig/extra-bundle", - "version": "v3.4.0", + "version": "v3.7.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "2e58256b0e9fe52f30149347c0547e4633304765" + "reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/2e58256b0e9fe52f30149347c0547e4633304765", - "reference": "2e58256b0e9fe52f30149347c0547e4633304765", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49", + "reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49", "shasum": "" }, "require": { @@ -7775,11 +7775,6 @@ "twig/string-extra": "^2.12|^3.0" }, "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, "autoload": { "psr-4": { "Twig\\Extra\\TwigExtraBundle\\": "" @@ -7808,7 +7803,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.4.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.7.0" }, "funding": [ { @@ -7820,7 +7815,7 @@ "type": "tidelift" } ], - "time": "2022-01-04T13:58:53+00:00" + "time": "2023-05-06T11:11:46+00:00" }, { "name": "twig/twig", @@ -8027,20 +8022,20 @@ "packages-dev": [ { "name": "composer/pcre", - "version": "2.0.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "c8e9d27cfc5ed22643c19c160455b473ffd8aabe" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/c8e9d27cfc5ed22643c19c160455b473ffd8aabe", - "reference": "c8e9d27cfc5ed22643c19c160455b473ffd8aabe", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "phpstan/phpstan": "^1.3", @@ -8050,7 +8045,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -8078,7 +8073,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/2.0.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -8094,7 +8089,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T20:05:29+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "composer/xdebug-handler", @@ -8421,16 +8416,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -8468,7 +8463,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -8476,7 +8471,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "n98/junit-xml", @@ -8590,28 +8585,28 @@ }, { "name": "pdepend/pdepend", - "version": "2.10.3", + "version": "2.16.2", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "da3166a06b4a89915920a42444f707122a1584c9" + "reference": "f942b208dc2a0868454d01b29f0c75bbcfc6ed58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/da3166a06b4a89915920a42444f707122a1584c9", - "reference": "da3166a06b4a89915920a42444f707122a1584c9", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/f942b208dc2a0868454d01b29f0c75bbcfc6ed58", + "reference": "f942b208dc2a0868454d01b29f0c75bbcfc6ed58", "shasum": "" }, "require": { "php": ">=5.3.7", - "symfony/config": "^2.3.0|^3|^4|^5|^6.0", - "symfony/dependency-injection": "^2.3.0|^3|^4|^5|^6.0", - "symfony/filesystem": "^2.3.0|^3|^4|^5|^6.0" + "symfony/config": "^2.3.0|^3|^4|^5|^6.0|^7.0", + "symfony/dependency-injection": "^2.3.0|^3|^4|^5|^6.0|^7.0", + "symfony/filesystem": "^2.3.0|^3|^4|^5|^6.0|^7.0", + "symfony/polyfill-mbstring": "^1.19" }, "require-dev": { "easy-doc/easy-doc": "0.0.0|^1.2.3", "gregwar/rst": "^1.0", - "phpunit/phpunit": "^4.8.36|^5.7.27", "squizlabs/php_codesniffer": "^2.0.0" }, "bin": [ @@ -8633,9 +8628,15 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", + "keywords": [ + "PHP Depend", + "PHP_Depend", + "dev", + "pdepend" + ], "support": { "issues": "https://github.com/pdepend/pdepend/issues", - "source": "https://github.com/pdepend/pdepend/tree/2.10.3" + "source": "https://github.com/pdepend/pdepend/tree/2.16.2" }, "funding": [ { @@ -8643,7 +8644,7 @@ "type": "tidelift" } ], - "time": "2022-02-23T07:53:09+00:00" + "time": "2023-12-17T18:09:59+00:00" }, { "name": "phar-io/manifest", @@ -8756,184 +8757,24 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" - }, - "time": "2022-03-15T21:29:03+00:00" - }, { "name": "phpmd/phpmd", - "version": "2.12.0", + "version": "2.15.0", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "c0b678ba71902f539c27c14332aa0ddcf14388ec" + "reference": "74a1f56e33afad4128b886e334093e98e1b5e7c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/c0b678ba71902f539c27c14332aa0ddcf14388ec", - "reference": "c0b678ba71902f539c27c14332aa0ddcf14388ec", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/74a1f56e33afad4128b886e334093e98e1b5e7c0", + "reference": "74a1f56e33afad4128b886e334093e98e1b5e7c0", "shasum": "" }, "require": { "composer/xdebug-handler": "^1.0 || ^2.0 || ^3.0", "ext-xml": "*", - "pdepend/pdepend": "^2.10.3", + "pdepend/pdepend": "^2.16.1", "php": ">=5.3.9" }, "require-dev": { @@ -8942,8 +8783,7 @@ "ext-simplexml": "*", "gregwar/rst": "^1.0", "mikey179/vfsstream": "^1.6.8", - "phpunit/phpunit": "^4.8.36 || ^5.7.27", - "squizlabs/php_codesniffer": "^2.0" + "squizlabs/php_codesniffer": "^2.9.2 || ^3.7.2" }, "bin": [ "src/bin/phpmd" @@ -8980,6 +8820,7 @@ "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", "homepage": "https://phpmd.org/", "keywords": [ + "dev", "mess detection", "mess detector", "pdepend", @@ -8989,7 +8830,7 @@ "support": { "irc": "irc://irc.freenode.org/phpmd", "issues": "https://github.com/phpmd/phpmd/issues", - "source": "https://github.com/phpmd/phpmd/tree/2.12.0" + "source": "https://github.com/phpmd/phpmd/tree/2.15.0" }, "funding": [ { @@ -8997,74 +8838,7 @@ "type": "tidelift" } ], - "time": "2022-03-24T13:33:01+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2023-12-11T08:22:20+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -9177,40 +8951,44 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.15", + "version": "9.2.30", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "819f92bba8b001d4363065928088de22f25a3a48" + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", - "reference": "819f92bba8b001d4363065928088de22f25a3a48", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": ">=7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.3 || ^4.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -9238,7 +9016,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" }, "funding": [ { @@ -9246,32 +9025,32 @@ "type": "github" } ], - "time": "2021-07-26T12:20:09+00:00" + "time": "2023-12-22T06:47:57+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -9298,7 +9077,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -9306,26 +9085,38 @@ "type": "github" } ], - "time": "2021-12-02T12:42:26+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -9342,41 +9133,47 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "template" + "process" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" }, - "time": "2015-06-21T13:50:34+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "phpunit/php-timer", - "version": "2.1.3", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -9395,14 +9192,14 @@ "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "timer" + "template" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" }, "funding": [ { @@ -9410,33 +9207,32 @@ "type": "github" } ], - "time": "2020-11-30T08:20:02+00:00" + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "3.1.3", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -9451,17 +9247,18 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "tokenizer" + "timer" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, "funding": [ { @@ -9469,54 +9266,54 @@ "type": "github" } ], - "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "8.5.27", + "version": "9.6.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "df70070f2711b8fe8dcca0797c1239ede8c94be6" + "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/df70070f2711b8fe8dcca0797c1239ede8c94be6", - "reference": "df70070f2711b8fe8dcca0797c1239ede8c94be6", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f", + "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.0", + "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.2", - "phpspec/prophecy": "^1.10.3", - "phpunit/php-code-coverage": "^7.0.12", - "phpunit/php-file-iterator": "^2.0.4", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.3", - "sebastian/exporter": "^3.1.2", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.28", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -9524,10 +9321,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -9552,7 +9352,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.27" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16" }, "funding": [ { @@ -9562,9 +9363,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-06-19T12:11:16+00:00" + "time": "2024-01-19T07:03:14+00:00" }, { "name": "rector/rector", @@ -9622,30 +9427,142 @@ ], "time": "2024-01-29T23:53:47+00:00" }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -9667,7 +9584,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" }, "funding": [ { @@ -9675,34 +9592,34 @@ "type": "github" } ], - "time": "2020-11-30T08:15:22+00:00" + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.3", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9741,7 +9658,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -9749,33 +9666,90 @@ "type": "github" } ], - "time": "2020-11-30T08:04:30+00:00" + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9807,7 +9781,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -9815,27 +9789,27 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", - "version": "4.2.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -9843,7 +9817,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -9870,7 +9844,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -9878,34 +9852,34 @@ "type": "github" } ], - "time": "2020-11-30T07:53:42+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9940,14 +9914,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -9955,30 +9929,30 @@ "type": "github" } ], - "time": "2021-11-11T13:51:24+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", - "version": "3.0.2", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", - "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { - "php": ">=7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -9986,7 +9960,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -10011,7 +9985,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, "funding": [ { @@ -10019,34 +9993,91 @@ "type": "github" } ], - "time": "2022-02-10T06:55:38+00:00" + "time": "2023-08-02T09:26:13+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.4", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -10068,7 +10099,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" }, "funding": [ { @@ -10076,32 +10107,32 @@ "type": "github" } ], - "time": "2020-11-30T07:40:27+00:00" + "time": "2020-10-26T13:12:34+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -10123,7 +10154,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" }, "funding": [ { @@ -10131,32 +10162,32 @@ "type": "github" } ], - "time": "2020-11-30T07:37:18+00:00" + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.1", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -10183,10 +10214,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -10194,29 +10225,32 @@ "type": "github" } ], - "time": "2020-11-30T07:34:24+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -10238,7 +10272,7 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" }, "funding": [ { @@ -10246,32 +10280,32 @@ "type": "github" } ], - "time": "2020-11-30T07:30:19+00:00" + "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "1.1.4", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", - "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -10294,7 +10328,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -10302,29 +10336,29 @@ "type": "github" } ], - "time": "2020-11-30T07:25:11+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -10347,9 +10381,15 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/master" + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, - "time": "2016-10-03T07:35:21+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "slevomat/coding-standard", @@ -10916,16 +10956,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -10954,7 +10994,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -10962,7 +11002,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php index 071631a2..1f9fe539 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php @@ -31,7 +31,8 @@ class SamlToken extends AbstractToken */ public $assertion; - public function __construct(private readonly Loa $loa, array $roles = []) + public function __construct( + private Loa $loa, array $roles = []) { parent::__construct($roles); $this->setAuthenticated(count($roles)); diff --git a/symfony.lock b/symfony.lock index 75c71e70..a84440e4 100644 --- a/symfony.lock +++ b/symfony.lock @@ -140,15 +140,6 @@ "phar-io/version": { "version": "2.0.1" }, - "phpdocumentor/reflection-common": { - "version": "2.1.0" - }, - "phpdocumentor/reflection-docblock": { - "version": "5.1.0" - }, - "phpdocumentor/type-resolver": { - "version": "1.2.0" - }, "phpmd/phpmd": { "version": "2.8.2" }, @@ -158,9 +149,6 @@ "phpseclib/phpseclib": { "version": "2.0.27" }, - "phpspec/prophecy": { - "version": "v1.10.3" - }, "phpstan/phpstan": { "version": "1.10", "recipe": { @@ -185,9 +173,6 @@ "phpunit/php-timer": { "version": "2.1.2" }, - "phpunit/php-token-stream": { - "version": "3.1.1" - }, "phpunit/phpunit": { "version": "4.7", "recipe": { From 8e00cb805ef911969aafa323a66705710c7d02d7 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 10:31:34 +0100 Subject: [PATCH 023/202] Migrate to newer schema --- ci/qa/phpunit.xml | 51 +++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/ci/qa/phpunit.xml b/ci/qa/phpunit.xml index c573e74b..8cf38e52 100644 --- a/ci/qa/phpunit.xml +++ b/ci/qa/phpunit.xml @@ -1,33 +1,24 @@ - - - - - - - - - - - - - ../../src - - - - - - ../../src - - - - - - + + + + ../../src + + + + + + + + + + + + ../../src + + + + + From 79ae21154a99b268b342baa9f6195be63280882e Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 10:37:46 +0100 Subject: [PATCH 024/202] Add types --- .../Command/StartVettingProcedureCommand.php | 21 +-- .../Repository/VettingProcedureRepository.php | 24 +-- .../AuthenticatedSessionStateHandler.php | 42 ++--- .../Authentication/Session/SessionStorage.php | 63 +++---- .../RaBundle/Service/VettingService.php | 105 +++--------- .../StepupRa/RaBundle/VettingProcedure.php | 161 ++++-------------- 6 files changed, 114 insertions(+), 302 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php index ff54dd72..d87ae2e5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php @@ -1,5 +1,7 @@ isAuthenticationMomentLogged()) { throw new LogicException('Cannot log authentication moment as an authentication moment is already logged'); } - $this->session->set(self::AUTH_SESSION_KEY . 'authenticated_at', DateTime::now()->format(DateTime::FORMAT)); + $this->requestStack->getSession()->set(self::AUTH_SESSION_KEY . 'authenticated_at', DateTime::now()->format(DateTime::FORMAT)); $this->updateLastInteractionMoment(); } - public function isAuthenticationMomentLogged() + public function isAuthenticationMomentLogged(): bool { - return $this->session->get(self::AUTH_SESSION_KEY . 'authenticated_at', null) !== null; + return $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'authenticated_at', null) !== null; } - public function getAuthenticationMoment() + public function getAuthenticationMoment(): DateTime { if (!$this->isAuthenticationMomentLogged()) { throw new LogicException('Cannot get last authentication moment as no authentication has been set'); } - return DateTime::fromString($this->session->get(self::AUTH_SESSION_KEY . 'authenticated_at')); + return DateTime::fromString($this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'authenticated_at')); } - public function updateLastInteractionMoment() + public function updateLastInteractionMoment(): void { - $this->session->set(self::AUTH_SESSION_KEY . 'last_interaction', DateTime::now()->format(DateTime::FORMAT)); + $this->requestStack->getSession()->set(self::AUTH_SESSION_KEY . 'last_interaction', DateTime::now()->format(DateTime::FORMAT)); } - public function hasSeenInteraction() + public function hasSeenInteraction(): bool { - return $this->session->get(self::AUTH_SESSION_KEY . 'last_interaction', null) !== null; + return $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'last_interaction', null) !== null; } - public function getLastInteractionMoment() + public function getLastInteractionMoment(): DateTime { if (!$this->hasSeenInteraction()) { throw new LogicException('Cannot get last interaction moment as we have not seen any interaction'); } - return DateTime::fromString($this->session->get(self::AUTH_SESSION_KEY . 'last_interaction')); + return DateTime::fromString($this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'last_interaction')); } - public function setCurrentRequestUri($uri) + public function setCurrentRequestUri(string $uri): void { - $this->session->set(self::AUTH_SESSION_KEY . 'current_uri', $uri); + $this->requestStack->getSession()->set(self::AUTH_SESSION_KEY . 'current_uri', $uri); } - public function getCurrentRequestUri() + public function getCurrentRequestUri(): string { - $uri = $this->session->get(self::AUTH_SESSION_KEY . 'current_uri'); - $this->session->remove(self::AUTH_SESSION_KEY . 'current_uri'); + $uri = $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'current_uri'); + $this->requestStack->getSession()->remove(self::AUTH_SESSION_KEY . 'current_uri'); return $uri; } - public function getRequestId() + public function getRequestId(): ?string { - return $this->session->get(self::SAML_SESSION_KEY . 'request_id'); + return $this->requestStack->getSession()->get(self::SAML_SESSION_KEY . 'request_id'); } - public function setRequestId($requestId) + public function setRequestId($requestId): void { - $this->session->set(self::SAML_SESSION_KEY . 'request_id', $requestId); + $this->requestStack->getSession()->set(self::SAML_SESSION_KEY . 'request_id', $requestId); } - public function hasRequestId() + public function hasRequestId(): bool { - return $this->session->has(self::SAML_SESSION_KEY. 'request_id'); + return $this->requestStack->getSession()->has(self::SAML_SESSION_KEY. 'request_id'); } - public function clearRequestId() + public function clearRequestId(): void { - $this->session->remove(self::SAML_SESSION_KEY . 'request_id'); + $this->requestStack->getSession()->remove(self::SAML_SESSION_KEY . 'request_id'); } - public function invalidate() + public function invalidate(): void { - $this->session->invalidate(); + $this->requestStack->getSession()->invalidate(); } - public function migrate() + public function migrate(): void { - $this->session->migrate(); + $this->requestStack->getSession()->migrate(); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index a0ae4aa2..85f3d7dd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -1,5 +1,7 @@ secondFactor->type); @@ -82,10 +80,7 @@ public function isLoaSufficientToStartProcedure(StartVettingProcedureCommand $co ); } - /** - * @return bool - */ - public function isExpiredRegistrationCode(StartVettingProcedureCommand $command) + public function isExpiredRegistrationCode(StartVettingProcedureCommand $command): bool { return DateTime::now()->comesAfter( new DateTime( @@ -96,10 +91,7 @@ public function isExpiredRegistrationCode(StartVettingProcedureCommand $command) ); } - /** - * @return string The procedure ID. - */ - public function startProcedure(StartVettingProcedureCommand $command) + public function startProcedure(StartVettingProcedureCommand $command): string { $this->smsSecondFactorService->clearSmsVerificationState($command->secondFactor->id); @@ -129,15 +121,10 @@ public function startProcedure(StartVettingProcedureCommand $command) } /** - * @param string $procedureId * @throws UnknownVettingProcedureException */ - public function cancelProcedure($procedureId) + public function cancelProcedure(string $procedureId): void { - if (!is_string($procedureId)) { - throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); - } - $procedure = $this->vettingProcedureRepository->retrieve($procedureId); if (!$procedure) { @@ -149,29 +136,21 @@ public function cancelProcedure($procedureId) $this->vettingProcedureRepository->remove($procedureId); } - /** - * @return int - */ - public function getSmsOtpRequestsRemainingCount(string $secondFactorId) + public function getSmsOtpRequestsRemainingCount(string $secondFactorId): int { return $this->smsSecondFactorService->getOtpRequestsRemainingCount($secondFactorId); } - /** - * @return int - */ - public function getSmsMaximumOtpRequestsCount() + public function getSmsMaximumOtpRequestsCount(): int { return $this->smsSecondFactorService->getMaximumOtpRequestsCount(); } /** - * @param string $procedureId - * @return bool * @throws UnknownVettingProcedureException * @throws RuntimeException */ - public function sendSmsChallenge($procedureId, SendSmsChallengeCommand $command) + public function sendSmsChallenge(string $procedureId, SendSmsChallengeCommand $command): bool { $procedure = $this->getProcedure($procedureId); @@ -200,12 +179,10 @@ public function sendSmsChallenge($procedureId, SendSmsChallengeCommand $command) } /** - * @param string $procedureId - * @return OtpVerification * @throws UnknownVettingProcedureException * @throws DomainException */ - public function verifyPhoneNumber($procedureId, VerifyPossessionOfPhoneCommand $command) + public function verifyPhoneNumber(string $procedureId, VerifyPossessionOfPhoneCommand $command): OtpVerification { $procedure = $this->getProcedure($procedureId); $command->secondFactorId = $procedure->getSecondFactor()->id; @@ -222,11 +199,7 @@ public function verifyPhoneNumber($procedureId, VerifyPossessionOfPhoneCommand $ return $verification; } - /** - * @param string $procedureId - * @return YubikeySecondFactor\VerificationResult - */ - public function verifyYubikeyPublicId($procedureId, VerifyYubikeyPublicIdCommand $command) + public function verifyYubikeyPublicId(string $procedureId, VerifyYubikeyPublicIdCommand $command): YubikeySecondFactor\VerificationResult { $procedure = $this->getProcedure($procedureId); @@ -245,21 +218,14 @@ public function verifyYubikeyPublicId($procedureId, VerifyYubikeyPublicIdCommand return $result; } - /** - * @param string $procedureId - */ - public function startGssfVerification($procedureId) + public function startGssfVerification(string $procedureId): void { $procedure = $this->getProcedure($procedureId); $this->gssfService->startVerification($procedure->getSecondFactor()->secondFactorIdentifier, $procedureId); } - /** - * @param string $gssfId - * @return GssfVerificationResult - */ - public function verifyGssfId($gssfId) + public function verifyGssfId(string $gssfId): GssfVerificationResult { $result = $this->gssfService->verify($gssfId); @@ -277,12 +243,10 @@ public function verifyGssfId($gssfId) /** - * @param string $procedureId - * @return void * @throws UnknownVettingProcedureException * @throws DomainException */ - public function verifyIdentity($procedureId, VerifyIdentityCommand $command) + public function verifyIdentity(string $procedureId, VerifyIdentityCommand $command): void { $procedure = $this->getProcedure($procedureId); $procedure->verifyIdentity($command->documentNumber, $command->identityVerified); @@ -291,12 +255,10 @@ public function verifyIdentity($procedureId, VerifyIdentityCommand $command) } /** - * @param string $procedureId - * @return \Surfnet\StepupMiddlewareClient\Service\ExecutionResult * @throws UnknownVettingProcedureException * @throws DomainException */ - public function vet($procedureId) + public function vet(string $procedureId): ExecutionResult { $procedure = $this->getProcedure($procedureId); $procedure->vet(); @@ -322,57 +284,43 @@ public function vet($procedureId) } /** - * @param string $procedureId - * @return string * @throws UnknownVettingProcedureException */ - public function getIdentityCommonName($procedureId) + public function getIdentityCommonName(string $procedureId): string { return $this->getProcedure($procedureId)->getSecondFactor()->commonName; } /** - * @param $procedureId - * @return string * @throws UnknownVettingProcedureException */ - public function isProvePossessionSkippable($procedureId) + public function isProvePossessionSkippable(string $procedureId): string { return $this->getProcedure($procedureId)->isProvePossessionSkippable(); } /** - * @param $procedureId - * @return string * @throws UnknownVettingProcedureException */ - public function getSecondFactorIdentifier($procedureId) + public function getSecondFactorIdentifier(string $procedureId): string { return $this->getProcedure($procedureId)->getSecondFactor()->secondFactorIdentifier; } /** - * @param $procedureId - * @return string * @throws UnknownVettingProcedureException */ - public function getSecondFactorId($procedureId) + public function getSecondFactorId(string $procedureId): string { return $this->getProcedure($procedureId)->getSecondFactor()->id; } /** - * @param string $procedureId - * @return null|VettingProcedure * @throws UnknownVettingProcedureException */ - private function getProcedure($procedureId) + private function getProcedure(string $procedureId): ?VettingProcedure { - if (!is_string($procedureId)) { - throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); - } - $procedure = $this->vettingProcedureRepository->retrieve($procedureId); if (!$procedure) { @@ -384,15 +332,8 @@ private function getProcedure($procedureId) return $procedure; } - /** - * @param string $procedureId - * @return bool - */ - public function hasProcedure($procedureId) + public function hasProcedure(string $procedureId): bool { - if (!is_string($procedureId)) { - throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); - } return $this->vettingProcedureRepository->retrieve($procedureId) !== null; } diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index 2261e118..c9088313 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -1,5 +1,7 @@ id = $id; $procedure->authorityId = $authorityId; @@ -117,11 +64,9 @@ final private function __construct() } /** - * @param string $secondFactorIdentifier - * @return void * @throws DomainException */ - public function verifySecondFactorIdentifier($secondFactorIdentifier) + public function verifySecondFactorIdentifier(string $secondFactorIdentifier): void { if (!$this->isReadyForSecondFactorToBeVerified()) { throw new DomainException( @@ -138,12 +83,9 @@ public function verifySecondFactorIdentifier($secondFactorIdentifier) } /** - * @param string $documentNumber - * @param bool $identityVerified - * @return void * @throws DomainException */ - public function verifyIdentity($documentNumber, $identityVerified) + public function verifyIdentity(string $documentNumber, bool $identityVerified): void { if (!$this->isReadyForIdentityVerification()) { throw new DomainException( @@ -152,10 +94,6 @@ public function verifyIdentity($documentNumber, $identityVerified) ); } - if (!is_string($documentNumber)) { - throw InvalidArgumentException::invalidType('string', 'documentNumber', $documentNumber); - } - if (empty($documentNumber)) { throw new InvalidArgumentException('Document number may not be empty.'); } @@ -169,10 +107,9 @@ public function verifyIdentity($documentNumber, $identityVerified) } /** - * @return void * @throws DomainException */ - public function vet() + public function vet(): void { if (!$this->isReadyForVetting()) { throw new DomainException( @@ -185,90 +122,57 @@ public function vet() $this->vetted = true; } - /** - * @return string - */ - public function getId() + public function getId(): string { return $this->id; } - /** - * @return VerifiedSecondFactor - */ - public function getSecondFactor() + public function getSecondFactor(): VerifiedSecondFactor { return $this->secondFactor; } - /** - * @return string - */ - public function getAuthorityId() + public function getAuthorityId(): string { return $this->authorityId; } - /** - * @return null|string - */ - public function getRegistrationCode() + public function getRegistrationCode(): ?string { return $this->registrationCode; } - /** - * @return null|string - */ - public function getInputSecondFactorIdentifier() + public function getInputSecondFactorIdentifier(): ?string { return $this->inputSecondFactorIdentifier; } - /** - * @return null|string - */ - public function getDocumentNumber() + public function getDocumentNumber(): ?string { return $this->documentNumber; } - /** - * @return bool|null - */ - public function isIdentityVerified() + public function isIdentityVerified(): ?bool { return $this->identityVerified; } - /** - * @return bool|null - */ - public function isProvePossessionSkippable() + public function isProvePossessionSkippable(): ?bool { return $this->skipProvePossession; } - /** - * @return bool - */ - private function isReadyForSecondFactorToBeVerified() + private function isReadyForSecondFactorToBeVerified(): bool { return !empty($this->registrationCode); } - /** - * @return bool - */ - private function isReadyForIdentityVerification() + private function isReadyForIdentityVerification(): bool { return $this->isPossessionProvenOrCanItBeSkipped() && !empty($this->registrationCode); } - /** - * @return bool - */ - private function isReadyForVetting() + private function isReadyForVetting(): bool { return $this->isPossessionProvenOrCanItBeSkipped() && !empty($this->registrationCode) @@ -276,10 +180,7 @@ private function isReadyForVetting() && $this->identityVerified === true; } - /** - * @return bool - */ - private function isPossessionProvenOrCanItBeSkipped() + private function isPossessionProvenOrCanItBeSkipped(): bool { return ($this->inputSecondFactorIdentifier === $this->secondFactor->secondFactorIdentifier || $this->skipProvePossession); } From 216a0c7e5b25aeba2677878194a456e881711c22 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 10:52:31 +0100 Subject: [PATCH 025/202] Remove obsolete var --- .../StepupRa/RaBundle/VettingProcedure.php | 58 +++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index c9088313..0d8d826a 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -1,6 +1,6 @@ inputSecondFactorIdentifier = $secondFactorIdentifier; } + private function isReadyForSecondFactorToBeVerified(): bool + { + return !empty($this->registrationCode); + } + /** * @throws DomainException */ @@ -106,6 +111,16 @@ public function verifyIdentity(string $documentNumber, bool $identityVerified): $this->identityVerified = true; } + private function isReadyForIdentityVerification(): bool + { + return $this->isPossessionProvenOrCanItBeSkipped() && !empty($this->registrationCode); + } + + private function isPossessionProvenOrCanItBeSkipped(): bool + { + return ($this->inputSecondFactorIdentifier === $this->secondFactor->secondFactorIdentifier || $this->skipProvePossession); + } + /** * @throws DomainException */ @@ -114,12 +129,18 @@ public function vet(): void if (!$this->isReadyForVetting()) { throw new DomainException( 'Second factor is not yet ready for verification of its Identity; ' . - 'verify the registrant has the same second factor as used during the registration process, '. + 'verify the registrant has the same second factor as used during the registration process, ' . "and verify the registrant's identity.", ); } + } - $this->vetted = true; + private function isReadyForVetting(): bool + { + return $this->isPossessionProvenOrCanItBeSkipped() + && !empty($this->registrationCode) + && !empty($this->documentNumber) + && $this->identityVerified === true; } public function getId(): string @@ -161,27 +182,4 @@ public function isProvePossessionSkippable(): ?bool { return $this->skipProvePossession; } - - private function isReadyForSecondFactorToBeVerified(): bool - { - return !empty($this->registrationCode); - } - - private function isReadyForIdentityVerification(): bool - { - return $this->isPossessionProvenOrCanItBeSkipped() && !empty($this->registrationCode); - } - - private function isReadyForVetting(): bool - { - return $this->isPossessionProvenOrCanItBeSkipped() - && !empty($this->registrationCode) - && !empty($this->documentNumber) - && $this->identityVerified === true; - } - - private function isPossessionProvenOrCanItBeSkipped(): bool - { - return ($this->inputSecondFactorIdentifier === $this->secondFactor->secondFactorIdentifier || $this->skipProvePossession); - } } From e927c376c23f82723d4c002f05a05a7c55dd56d8 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 11:04:15 +0100 Subject: [PATCH 026/202] Replace session with requeststack --- .../SessionVettingProcedureRepository.php | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php index c5ba379a..059cdbb1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php +++ b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php @@ -1,5 +1,7 @@ namespace = $namespace; } - public function store(VettingProcedure $vettingProcedure) + public function store(VettingProcedure $vettingProcedure): void { - $this->session->set(sprintf('%s:%s', $this->namespace, $vettingProcedure->getId()), $vettingProcedure); + $this->requestStack->getSession()->set(sprintf('%s:%s', $this->namespace, $vettingProcedure->getId()), $vettingProcedure); } - public function retrieve($id) + public function retrieve(string $id): ?VettingProcedure { - if (!is_string($id)) { - throw InvalidArgumentException::invalidType('string', 'uuid', $id); - } - - return $this->session->get(sprintf('%s:%s', $this->namespace, $id)); + return $this->requestStack->getSession()->get(sprintf('%s:%s', $this->namespace, $id)); } - /** - * @param string $id - * @return void - */ - public function remove($id) + public function remove(string $id): mixed { - if (!is_string($id)) { - throw InvalidArgumentException::invalidType('string', 'uuid', $id); - } - - return $this->session->remove(sprintf('%s:%s', $this->namespace, $id)); + return $this->requestStack->getSession()->remove(sprintf('%s:%s', $this->namespace, $id)); } } From b42f032fc05d82c7f1360eea523aabed58652cfd Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 11:47:45 +0100 Subject: [PATCH 027/202] Replace legacy with openconext --- .gitignore | 6 +++--- .../global_view_parameters.yaml.dist | 0 .../{legacy => openconext}/parameters.yaml.dist | 0 .../samlstepupproviders.yaml | 0 .../samlstepupproviders_parameters.yaml.dist | 0 config/services.yaml | 16 ++++++++++------ 6 files changed, 13 insertions(+), 9 deletions(-) rename config/{legacy => openconext}/global_view_parameters.yaml.dist (100%) rename config/{legacy => openconext}/parameters.yaml.dist (100%) rename config/{legacy => openconext}/samlstepupproviders.yaml (100%) rename config/{legacy => openconext}/samlstepupproviders_parameters.yaml.dist (100%) diff --git a/.gitignore b/.gitignore index 5510e3d4..6f7ab102 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,9 @@ /config/*.key /config/keys /app/cache/* -/config/legacy/parameters.yaml -/config/legacy/samlstepupproviders_parameters.yaml -/config/legacy/global_view_parameters.yaml +/config/openconext/parameters.yaml +/config/openconext/samlstepupproviders_parameters.yaml +/config/openconext/global_view_parameters.yaml /app/logs/* !app/cache/.gitkeep !app/logs/.gitkeep diff --git a/config/legacy/global_view_parameters.yaml.dist b/config/openconext/global_view_parameters.yaml.dist similarity index 100% rename from config/legacy/global_view_parameters.yaml.dist rename to config/openconext/global_view_parameters.yaml.dist diff --git a/config/legacy/parameters.yaml.dist b/config/openconext/parameters.yaml.dist similarity index 100% rename from config/legacy/parameters.yaml.dist rename to config/openconext/parameters.yaml.dist diff --git a/config/legacy/samlstepupproviders.yaml b/config/openconext/samlstepupproviders.yaml similarity index 100% rename from config/legacy/samlstepupproviders.yaml rename to config/openconext/samlstepupproviders.yaml diff --git a/config/legacy/samlstepupproviders_parameters.yaml.dist b/config/openconext/samlstepupproviders_parameters.yaml.dist similarity index 100% rename from config/legacy/samlstepupproviders_parameters.yaml.dist rename to config/openconext/samlstepupproviders_parameters.yaml.dist diff --git a/config/services.yaml b/config/services.yaml index 682be6e3..95f234a0 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,12 +1,16 @@ imports: - - { resource: 'legacy/samlstepupproviders_parameters.yaml' } - - { resource: 'legacy/global_view_parameters.yaml' } - - { resource: 'legacy/parameters.yaml' } - - { resource: 'legacy/samlstepupproviders.yaml' } - - + - { resource: 'openconext/samlstepupproviders_parameters.yaml' } + - { resource: 'openconext/global_view_parameters.yaml' } + - { resource: 'openconext/parameters.yaml' } + - { resource: 'openconext/samlstepupproviders.yaml' } services: + # default configuration for services in *this* file + _defaults: + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + public: true + twig.extension.text: # Required by JMSTranslationBundle class: Twig_Extensions_Extension_Text tags: [{ name: twig.extension }] From 4ca7e8508437e0a3955c7e76728ec12b4050e87b Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 14:37:06 +0100 Subject: [PATCH 028/202] Move twig files --- composer.json | 26 ++-- composer.lock | 134 ++++++++++-------- config/packages/knp_paginator.yaml | 4 +- config/packages/twig.yaml | 4 +- .../RaBundle/Controller/ProfileController.php | 2 +- .../Controller/RaLocationController.php | 4 +- .../Controller/RaManagementController.php | 10 +- .../RaBundle/Controller/RaaController.php | 2 +- .../Controller/RecoveryTokenController.php | 2 +- .../Controller/SecondFactorController.php | 2 +- .../Controller/SecurityController.php | 2 +- .../Controller/Vetting/GssfController.php | 2 +- .../RaBundle/Controller/VettingController.php | 2 +- .../Controller/VettingTypeHintController.php | 2 +- .../RaBundle/Resources/config/security.yml | 2 +- .../Authentication/Token/SamlToken.php | 18 +-- .../views => templates}/form/fields.html.twig | 0 .../overview.html.twig | 2 +- .../pagination/sliding.html.twig | 0 .../pagination/sliding_item.html.twig | 0 .../pagination/sortable_link.html.twig | 0 .../partial/language_switcher.html.twig | 0 .../profile/profile.html.twig | 0 .../ra_location/change.html.twig | 0 .../ra_location/create.html.twig | 0 .../ra_location/manage.html.twig | 2 +- .../amend_ra_information.html.twig | 0 .../ra_management/change_ra_role.html.twig | 0 .../confirm_retract_ra.html.twig | 0 .../ra_management/create_ra.html.twig | 0 .../ra_management/manage.html.twig | 0 .../ra_candidate_overview.html.twig | 0 .../recovery_token/search.html.twig | 0 .../saml/consume_assertion.html.twig | 0 .../second_factor/audit_log.html.twig | 0 .../second_factor/search.html.twig | 0 .../security/session_expired.html.twig | 0 .../translations.html.twig | 0 .../vetting/gssf/initiate.html.twig | 6 +- .../cancel_vetting_procedure.html.twig | 0 .../vetting/partial/progress_bar.html.twig | 0 .../second_factor_type_disabled.html.twig | 0 .../vetting/sms/prove_possession.html.twig | 4 +- .../vetting/sms/send_challenge.html.twig | 4 +- .../vetting/start_procedure.html.twig | 0 .../vetting/verify_identity.html.twig | 2 +- .../vetting/vetting_completed.html.twig | 2 +- .../vetting/yubikey/verify.html.twig | 6 +- .../vetting_type_hint/overview.html.twig | 2 +- 49 files changed, 130 insertions(+), 118 deletions(-) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/form/fields.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/institution_configuration/overview.html.twig (97%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/pagination/sliding.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/pagination/sliding_item.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/pagination/sortable_link.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/partial/language_switcher.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/profile/profile.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_location/change.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_location/create.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_location/manage.html.twig (97%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_management/amend_ra_information.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_management/change_ra_role.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_management/confirm_retract_ra.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_management/create_ra.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_management/manage.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/ra_management/ra_candidate_overview.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/recovery_token/search.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/saml/consume_assertion.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/second_factor/audit_log.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/second_factor/search.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/security/session_expired.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/translations.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/gssf/initiate.html.twig (58%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/partial/cancel_vetting_procedure.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/partial/progress_bar.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/second_factor_type_disabled.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/sms/prove_possession.html.twig (91%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/sms/send_challenge.html.twig (92%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/start_procedure.html.twig (100%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/verify_identity.html.twig (94%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/vetting_completed.html.twig (79%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting/yubikey/verify.html.twig (66%) rename {src/Surfnet/StepupRa/RaBundle/Resources/views => templates}/vetting_type_hint/overview.html.twig (83%) diff --git a/composer.json b/composer.json index e1a24658..3788759e 100644 --- a/composer.json +++ b/composer.json @@ -26,16 +26,16 @@ "surfnet/stepup-bundle": "^5.0", "surfnet/stepup-middleware-client-bundle": "^4.1", "surfnet/stepup-saml-bundle": "^4.3.2", - "symfony/asset": "4.4.*", - "symfony/expression-language": "4.4.*", + "symfony/asset": "4.4.* || ^5.1", + "symfony/expression-language": "4.4.* || ^5.1", "symfony/flex": "^v2.4.3", "symfony/form": "4.4.* || ^5.1", "symfony/http-foundation": "^5.0", "symfony/monolog-bundle": "^3.5", - "symfony/security-bundle": "4.4.*", - "symfony/translation": "4.4.*", + "symfony/security-bundle": "4.4.* || ^5.1", + "symfony/translation": "4.4.* || ^5.1", "symfony/twig-bundle": "4.4.* |^5.1", - "symfony/validator": "4.4.*", + "symfony/validator": "4.4.* || ^5.1", "symfony/webpack-encore-bundle": "^1.7", "twbs/bootstrap": "~3.3.0", "twig/extensions": "~1.5", @@ -44,18 +44,18 @@ }, "require-dev": { "matthiasnoback/symfony-config-test": "^4.0", - "mockery/mockery": "~1.0", + "mockery/mockery": "^1.0", "overtrue/phplint": "^2.3", "phpmd/phpmd": "^2.6", "phpunit/phpunit": "^9.5", "rector/rector": "^0.19.5", "slevomat/coding-standard": "^8.13", "squizlabs/php_codesniffer": "^3.4", - "symfony/dotenv": "4.4.*", + "symfony/dotenv": "^5.1", "symfony/maker-bundle": "^1.19", - "symfony/phpunit-bridge": "^3.0", - "symfony/stopwatch": "4.4.*", - "symfony/web-profiler-bundle": "4.4.*" + "symfony/phpunit-bridge": "^6.0", + "symfony/stopwatch": "^5.1", + "symfony/web-profiler-bundle": "4.4.* || ^5.1" }, "conflict": { "symfony/symfony": "*" @@ -133,13 +133,13 @@ "src-dir": "src/Surfnet", "incenteev-parameters": [ { - "file": "config/legacy/parameters.yaml" + "file": "config/openconext/parameters.yaml" }, { - "file": "config/legacy/samlstepupproviders_parameters.yaml" + "file": "config/openconext/samlstepupproviders_parameters.yaml" }, { - "file": "config/legacy/global_view_parameters.yaml" + "file": "config/openconext/global_view_parameters.yaml" } ] } diff --git a/composer.lock b/composer.lock index fdffbc77..ab45686b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3876e42c927f03ff1a6128b28bbff12c", + "content-hash": "00d61017570ae3b9df32eb5b2b7abf74", "packages": [ { "name": "beberlei/assert", @@ -3207,25 +3207,30 @@ }, { "name": "symfony/asset", - "version": "v4.4.46", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "6ef0f9f352f90c469e8b363ebc038d81a7198873" + "reference": "0e98032106d18e57f57176d616e3fae80db7a845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/6ef0f9f352f90c469e8b363ebc038d81a7198873", - "reference": "6ef0f9f352f90c469e8b363ebc038d81a7198873", + "url": "https://api.github.com/repos/symfony/asset/zipball/0e98032106d18e57f57176d616e3fae80db7a845", + "reference": "0e98032106d18e57f57176d616e3fae80db7a845", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php80": "^1.16" }, + "conflict": { + "symfony/http-foundation": "<5.3" + }, "require-dev": { - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/http-kernel": "^3.4|^4.0|^5.0" + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/http-foundation": "" @@ -3256,7 +3261,7 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v4.4.46" + "source": "https://github.com/symfony/asset/tree/v5.4.35" }, "funding": [ { @@ -3272,7 +3277,7 @@ "type": "tidelift" } ], - "time": "2022-08-30T22:05:24+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/cache", @@ -8347,35 +8352,38 @@ }, { "name": "mockery/mockery", - "version": "1.3.5", + "version": "1.6.7", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": ">=7.3" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpunit/phpunit": "^8.5 || ^9.6.10", + "symplify/easy-coding-standard": "^12.0.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, "autoload": { - "psr-0": { - "Mockery": "library/" + "files": [ + "library/helpers.php", + "library/Mockery.php" + ], + "psr-4": { + "Mockery\\": "library/Mockery" } }, "notification-url": "https://packagist.org/downloads/", @@ -8386,12 +8394,20 @@ { "name": "Pádraic Brady", "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "homepage": "https://github.com/padraic", + "role": "Author" }, { "name": "Dave Marshall", "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], "description": "Mockery is a simple yet flexible PHP mock object framework", @@ -8409,10 +8425,13 @@ "testing" ], "support": { + "docs": "https://docs.mockery.io/", "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.3.5" + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories", + "source": "https://github.com/mockery/mockery" }, - "time": "2021-09-13T15:33:03+00:00" + "time": "2023-12-10T02:24:34+00:00" }, { "name": "myclabs/deep-copy", @@ -10514,23 +10533,25 @@ }, { "name": "symfony/dotenv", - "version": "v4.4.37", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf" + "reference": "4de488440104b99d2e7c0717ee432e760b061e32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf", - "reference": "fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/4de488440104b99d2e7c0717ee432e760b061e32", + "reference": "4de488440104b99d2e7c0717ee432e760b061e32", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3" }, "require-dev": { - "symfony/process": "^3.4.2|^4.0|^5.0" + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -10563,7 +10584,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v4.4.37" + "source": "https://github.com/symfony/dotenv/tree/v5.4.35" }, "funding": [ { @@ -10579,7 +10600,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/maker-bundle", @@ -10671,26 +10692,28 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v3.4.47", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "120273ad5d03a8deee08ca9260e2598f288f2bac" + "reference": "d49b4f6dc4690cf2c194311bb498abf0cf4f7485" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/120273ad5d03a8deee08ca9260e2598f288f2bac", - "reference": "120273ad5d03a8deee08ca9260e2598f288f2bac", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/d49b4f6dc4690cf2c194311bb498abf0cf4f7485", + "reference": "d49b4f6dc4690cf2c194311bb498abf0cf4f7485", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1.3" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0|9.1.2" + "phpunit/phpunit": "<7.5|9.1.2" }, - "suggest": { - "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + "require-dev": { + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/polyfill-php81": "^1.27" }, "bin": [ "bin/simple-phpunit" @@ -10727,10 +10750,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony PHPUnit Bridge", + "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v3.4.47" + "source": "https://github.com/symfony/phpunit-bridge/tree/v6.4.3" }, "funding": [ { @@ -10746,7 +10769,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T16:28:59+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/process", @@ -10812,24 +10835,21 @@ }, { "name": "symfony/stopwatch", - "version": "v4.4.46", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "757660703fbd139eea0001b759c6c3bf5bc3ea52" + "reference": "887762aa99ff16f65dc8b48aafead415f942d407" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/757660703fbd139eea0001b759c6c3bf5bc3ea52", - "reference": "757660703fbd139eea0001b759c6c3bf5bc3ea52", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/887762aa99ff16f65dc8b48aafead415f942d407", + "reference": "887762aa99ff16f65dc8b48aafead415f942d407", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/service-contracts": "^1.0|^2" - }, - "require-dev": { - "symfony/polyfill-php72": "~1.5" + "php": ">=7.2.5", + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", "autoload": { @@ -10857,7 +10877,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v4.4.46" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.35" }, "funding": [ { @@ -10873,7 +10893,7 @@ "type": "tidelift" } ], - "time": "2022-09-28T12:53:24+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/web-profiler-bundle", diff --git a/config/packages/knp_paginator.yaml b/config/packages/knp_paginator.yaml index 219e2b30..8a76fe37 100644 --- a/config/packages/knp_paginator.yaml +++ b/config/packages/knp_paginator.yaml @@ -5,5 +5,5 @@ knp_paginator: sort_field_name: orderBy sort_direction_name: orderDirection template: - pagination: SurfnetStepupRaRaBundle:pagination:sliding.html.twig - sortable: SurfnetStepupRaRaBundle:pagination:sortable_link.html.twig \ No newline at end of file + pagination: pagination/sliding.html.twig + sortable: pagination/sortable_link.html.twig diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 2a5ee248..7b64fce8 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,4 +1,6 @@ twig: + paths: + '%kernel.project_dir%/templates': SurfnetStepupRaRa debug: "%kernel.debug%" strict_variables: "%kernel.debug%" exception_controller: SurfnetStepupRaRaBundle:Exception:show @@ -7,4 +9,4 @@ twig: timezone: "%date_timezone%" globals: global_view_parameters: "@ra.service.global_view_parameters" - form_themes: ['bootstrap_3_horizontal_layout.html.twig', '@SurfnetStepupRaRa/form/fields.html.twig'] + form_themes: ['bootstrap_3_horizontal_layout.html.twig', 'form/fields.html.twig'] diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index f7de0ea8..7c4e58b3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -31,7 +31,7 @@ public function profile() $identity = $this->getUser(); $profile = $this->getProfileService()->findByIdentityId($identity->id); - return $this->render('SurfnetStepupRaRaBundle:profile:profile.html.twig', ['profile' => $profile]); + return $this->render('profile/profile.html.twig', ['profile' => $profile]); } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index b05fd087..7748c3b1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -141,7 +141,7 @@ public function create(Request $request) $this->addFlash('error', 'ra.create_ra_location.error.middleware_command_failed'); } - return $this->render('SurfnetStepupRaRaBundle:ra_location:create.html.twig', [ + return $this->render('ra_location/create.html.twig', [ 'form' => $form->createView() ]); } @@ -190,7 +190,7 @@ public function change(Request $request) $this->addFlash('error', 'ra.create_ra_location.error.middleware_command_failed'); } - return $this->render('SurfnetStepupRaRaBundle:ra_location:change.html.twig', [ + return $this->render('ra_location/change.html.twig', [ 'form' => $form->createView() ]); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index ed0ba00b..3c380537 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -89,7 +89,7 @@ public function manage(Request $request): Response $raListings = $raList->getElements(); return $this->render( - 'SurfnetStepupRaRaBundle:ra_management:manage.html.twig', + 'ra_management/manage.html.twig', [ 'form' => $form->createView(), 'raList' => $raListings, @@ -147,7 +147,7 @@ public function raCandidateSearch(Request $request) )); return $this->render( - 'SurfnetStepupRaRaBundle:ra_management:ra_candidate_overview.html.twig', + 'ra_management/ra_candidate_overview.html.twig', [ 'form' => $form->createView(), 'raCandidates' => $raCandidateList, @@ -205,7 +205,7 @@ public function createRa(Request $request) $this->addFlash('error', 'ra.management.create_ra.error.middleware_command_failed'); } - return $this->render('SurfnetStepupRaRaBundle:ra_management:create_ra.html.twig', [ + return $this->render('ra_management/create_ra.html.twig', [ 'raCandidate' => $raCandidate->raCandidate, 'form' => $form->createView() ]); @@ -252,7 +252,7 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution $this->addFlash('error', 'ra.management.amend_ra_info.error.middleware_command_failed'); } - return $this->render('SurfnetStepupRaRaBundle:ra_management:amend_ra_information.html.twig', [ + return $this->render('ra_management/amend_ra_information.html.twig', [ 'raListing' => $raListing, 'form' => $form->createView(), ]); @@ -304,7 +304,7 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI $this->addFlash('error', 'ra.management.retract_ra.middleware_command_failed'); } - return $this->render('SurfnetStepupRaRaBundle:ra_management:confirm_retract_ra.html.twig', [ + return $this->render('ra_management/confirm_retract_ra.html.twig', [ 'raListing' => $raListing, 'form' => $form->createView() ]); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index cbce14bb..906220a8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -74,7 +74,7 @@ public function institutionConfiguration(Request $request) } return $this->render( - '@SurfnetStepupRaRa/institution_configuration/overview.html.twig', + 'institution_configuration/overview.html.twig', [ 'configuration' => (array)$configuration, 'form' => isset($form) ? $form->createView() : null, diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index f21f6c3d..1a33882b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -84,7 +84,7 @@ public function search(Request $request): Response )); return $this->render( - '@SurfnetStepupRaRa/recovery_token/search.html.twig', + 'recovery_token/search.html.twig', [ 'form' => $form->createView(), 'revocationForm' => $revocationForm->createView(), diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index f834629d..1c6a2b8a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -192,7 +192,7 @@ public function auditLog(Request $request) $logger->notice(sprintf('Audit log yielded "%d" results, rendering page', $auditLog->getTotalItems())); return $this->render( - 'SurfnetStepupRaRaBundle:second_factor:audit_log.html.twig', + 'second_factor/audit_log.html.twig', [ 'pagination' => $pagination, 'auditLog' => $auditLog, diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index 0728a0b9..1e763978 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -31,7 +31,7 @@ public function sessionExpired(Request $request): Response ->getCurrentRequestUri(); return $this->render( - '@SurfnetStepupRaRa/security/session_expired.html.twig', + 'security/session_expired.html.twig', ['redirect_to_url' => $redirectToUrl], ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index c599b570..df0ce587 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -276,6 +276,6 @@ private function renderInitiateForm($procedureId, $provider, array $parameters = ], ); - return $this->render('SurfnetStepupRaRaBundle:vetting/gssf:initiate.html.twig', $templateParameters); + return $this->render('vetting/gssf/initiate.html.twig', $templateParameters); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index cbbdd9b5..50c3ac7f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -90,7 +90,7 @@ public function startProcedure(Request $request) return $this ->render( - 'SurfnetStepupRaRaBundle:vetting:second_factor_type_disabled.html.twig', + 'vetting/second_factor_type_disabled.html.twig', ['secondFactorType' => $secondFactor->type], ) ->setStatusCode(Response::HTTP_BAD_REQUEST); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index cbfea1a8..3af98461 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -108,7 +108,7 @@ public function vettingTypeHint(Request $request): Response } return $this->render( - '@SurfnetStepupRaRa/vetting_type_hint/overview.html.twig', + 'vetting_type_hint/overview.html.twig', [ 'form' => isset($form) ? $form->createView() : null, 'hintForm' => $hintForm->createView(), diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index e4faab5b..438a7066 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -91,7 +91,7 @@ services: public: true class: Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionStorage arguments: - - "@session" + - "@request_stack" ra.security.authentication.session.session_lifetime_guard: public: false diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php index 1f9fe539..4ea9bbc9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php @@ -18,18 +18,13 @@ namespace Surfnet\StepupRa\RaBundle\Security\Authentication\Token; +use SAML2\Assertion; use Surfnet\StepupBundle\Value\Loa; -use Surfnet\StepupRa\RaBundle\Exception\LogicException; -use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; -use Symfony\Component\Security\Core\Role\RoleInterface; class SamlToken extends AbstractToken { - /** - * @var \SAML2\Assertion - */ - public $assertion; + public Assertion $assertion; public function __construct( private Loa $loa, array $roles = []) @@ -40,18 +35,13 @@ public function __construct( /** * Returns the user credentials. - * - * @return mixed The user credentials */ - public function getCredentials() + public function getCredentials(): string { return ''; } - /** - * @return Loa - */ - public function getLoa() + public function getLoa(): Loa { return $this->loa; } diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/form/fields.html.twig b/templates/form/fields.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/form/fields.html.twig rename to templates/form/fields.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/institution_configuration/overview.html.twig b/templates/institution_configuration/overview.html.twig similarity index 97% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/institution_configuration/overview.html.twig rename to templates/institution_configuration/overview.html.twig index 5af38af3..800ec5e5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/institution_configuration/overview.html.twig +++ b/templates/institution_configuration/overview.html.twig @@ -5,7 +5,7 @@ {% block content %}
- {% include 'SurfnetStepupRaRaBundle:partial:language_switcher.html.twig' with {'form': form} only %} + {% include 'partial/language_switcher.html.twig' with {'form': form} only %}
diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/pagination/sliding.html.twig b/templates/pagination/sliding.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/pagination/sliding.html.twig rename to templates/pagination/sliding.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/pagination/sliding_item.html.twig b/templates/pagination/sliding_item.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/pagination/sliding_item.html.twig rename to templates/pagination/sliding_item.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/pagination/sortable_link.html.twig b/templates/pagination/sortable_link.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/pagination/sortable_link.html.twig rename to templates/pagination/sortable_link.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/partial/language_switcher.html.twig b/templates/partial/language_switcher.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/partial/language_switcher.html.twig rename to templates/partial/language_switcher.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/profile/profile.html.twig b/templates/profile/profile.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/profile/profile.html.twig rename to templates/profile/profile.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/change.html.twig b/templates/ra_location/change.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/change.html.twig rename to templates/ra_location/change.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/create.html.twig b/templates/ra_location/create.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/create.html.twig rename to templates/ra_location/create.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/manage.html.twig b/templates/ra_location/manage.html.twig similarity index 97% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/manage.html.twig rename to templates/ra_location/manage.html.twig index b700ff84..c5e0ad50 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/manage.html.twig +++ b/templates/ra_location/manage.html.twig @@ -5,7 +5,7 @@ {% block content %}
- {% include 'SurfnetStepupRaRaBundle:partial:language_switcher.html.twig' with {'form': form} only %} + {% include 'partial/language_switcher.html.twig' with {'form': form} only %}
diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/amend_ra_information.html.twig b/templates/ra_management/amend_ra_information.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/amend_ra_information.html.twig rename to templates/ra_management/amend_ra_information.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/change_ra_role.html.twig b/templates/ra_management/change_ra_role.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/change_ra_role.html.twig rename to templates/ra_management/change_ra_role.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/confirm_retract_ra.html.twig b/templates/ra_management/confirm_retract_ra.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/confirm_retract_ra.html.twig rename to templates/ra_management/confirm_retract_ra.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/create_ra.html.twig b/templates/ra_management/create_ra.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/create_ra.html.twig rename to templates/ra_management/create_ra.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/manage.html.twig b/templates/ra_management/manage.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/manage.html.twig rename to templates/ra_management/manage.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/ra_candidate_overview.html.twig b/templates/ra_management/ra_candidate_overview.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/ra_candidate_overview.html.twig rename to templates/ra_management/ra_candidate_overview.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/recovery_token/search.html.twig b/templates/recovery_token/search.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/recovery_token/search.html.twig rename to templates/recovery_token/search.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/saml/consume_assertion.html.twig b/templates/saml/consume_assertion.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/saml/consume_assertion.html.twig rename to templates/saml/consume_assertion.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/second_factor/audit_log.html.twig b/templates/second_factor/audit_log.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/second_factor/audit_log.html.twig rename to templates/second_factor/audit_log.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/second_factor/search.html.twig b/templates/second_factor/search.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/second_factor/search.html.twig rename to templates/second_factor/search.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/security/session_expired.html.twig b/templates/security/session_expired.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/security/session_expired.html.twig rename to templates/security/session_expired.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig b/templates/translations.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig rename to templates/translations.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/gssf/initiate.html.twig b/templates/vetting/gssf/initiate.html.twig similarity index 58% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/gssf/initiate.html.twig rename to templates/vetting/gssf/initiate.html.twig index 3a7b23af..2eff98ae 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/gssf/initiate.html.twig +++ b/templates/vetting/gssf/initiate.html.twig @@ -1,11 +1,11 @@ -{% extends "base.html.twig" %} +{% extends "../../base.html.twig" %} {% block page_title %}{{ secondFactorConfig.getPageTitle() }}{% endblock %} {% block page_header %} {{ parent() }} - {% include 'SurfnetStepupRaRaBundle:vetting/partial:progress_bar.html.twig' with {'progress': 25, 'step': 2} only %} + {% include 'vetting/partial/progress_bar.html.twig' with {'progress': 25, 'step': 2} only %} {% endblock %} {% block content %} @@ -22,6 +22,6 @@
- {% include 'SurfnetStepupRaRaBundle:vetting/partial:cancel_vetting_procedure.html.twig' with { 'procedureId': app.request.attributes.get('procedureId') } only %} + {% include 'vetting/partial/cancel_vetting_procedure.html.twig' with { 'procedureId': app.request.attributes.get('procedureId') } only %} {% endblock %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/partial/cancel_vetting_procedure.html.twig b/templates/vetting/partial/cancel_vetting_procedure.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/partial/cancel_vetting_procedure.html.twig rename to templates/vetting/partial/cancel_vetting_procedure.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/partial/progress_bar.html.twig b/templates/vetting/partial/progress_bar.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/partial/progress_bar.html.twig rename to templates/vetting/partial/progress_bar.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/second_factor_type_disabled.html.twig b/templates/vetting/second_factor_type_disabled.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/second_factor_type_disabled.html.twig rename to templates/vetting/second_factor_type_disabled.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/prove_possession.html.twig b/templates/vetting/sms/prove_possession.html.twig similarity index 91% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/prove_possession.html.twig rename to templates/vetting/sms/prove_possession.html.twig index 2efdfda7..c9a29b46 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/prove_possession.html.twig +++ b/templates/vetting/sms/prove_possession.html.twig @@ -1,11 +1,11 @@ -{% extends "base.html.twig" %} +{% extends "../../base.html.twig" %} {% block page_title %}{{ 'ra.vetting.sms.prove_possession.title.page'|trans }}{% endblock %} {% block page_header %} {{ parent() }} - {% include 'SurfnetStepupRaRaBundle:vetting/partial:progress_bar.html.twig' with {'progress': 35, 'step': 2} only %} + {% include 'vetting/partial/progress_bar.html.twig' with {'progress': 35, 'step': 2} only %} {% endblock %} {% block content %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/send_challenge.html.twig b/templates/vetting/sms/send_challenge.html.twig similarity index 92% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/send_challenge.html.twig rename to templates/vetting/sms/send_challenge.html.twig index 1687bb0b..c9616eb6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/send_challenge.html.twig +++ b/templates/vetting/sms/send_challenge.html.twig @@ -1,11 +1,11 @@ -{% extends "base.html.twig" %} +{% extends "../../base.html.twig" %} {% block page_title %}{{ 'ra.vetting.sms.send_challenge.title.page'|trans }}{% endblock %} {% block page_header %} {{ parent() }} - {% include 'SurfnetStepupRaRaBundle:vetting/partial:progress_bar.html.twig' with {'progress': 25, 'step': 2} only %} + {% include 'vetting/partial/progress_bar.html.twig' with {'progress': 25, 'step': 2} only %} {% endblock %} {% block content %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/start_procedure.html.twig b/templates/vetting/start_procedure.html.twig similarity index 100% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/start_procedure.html.twig rename to templates/vetting/start_procedure.html.twig diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/verify_identity.html.twig b/templates/vetting/verify_identity.html.twig similarity index 94% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/verify_identity.html.twig rename to templates/vetting/verify_identity.html.twig index 1b3fb19d..ed36a617 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/verify_identity.html.twig +++ b/templates/vetting/verify_identity.html.twig @@ -5,7 +5,7 @@ {% block page_header %} {{ parent() }} - {% include 'SurfnetStepupRaRaBundle:vetting/partial:progress_bar.html.twig' with {'progress': 60, 'step': 3} only %} + {% include 'vetting/partial/progress_bar.html.twig' with {'progress': 60, 'step': 3} only %} {% endblock %} {% block content %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/vetting_completed.html.twig b/templates/vetting/vetting_completed.html.twig similarity index 79% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/vetting_completed.html.twig rename to templates/vetting/vetting_completed.html.twig index 9e1e5671..654cda97 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/vetting_completed.html.twig +++ b/templates/vetting/vetting_completed.html.twig @@ -5,7 +5,7 @@ {% block page_header %} {{ parent() }} - {% include 'SurfnetStepupRaRaBundle:vetting/partial:progress_bar.html.twig' with {'progress': 100, 'step': 4} only %} + {% include 'vetting/partial/progress_bar.html.twig' with {'progress': 100, 'step': 4} only %} {% endblock %} {% block content %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/yubikey/verify.html.twig b/templates/vetting/yubikey/verify.html.twig similarity index 66% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/yubikey/verify.html.twig rename to templates/vetting/yubikey/verify.html.twig index fd719664..d3671f76 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/yubikey/verify.html.twig +++ b/templates/vetting/yubikey/verify.html.twig @@ -1,11 +1,11 @@ -{% extends "base.html.twig" %} +{% extends "../../base.html.twig" %} {% block page_title %}{{ 'ra.registration.yubikey.title.enter_challenge'|trans }}{% endblock %} {% block page_header %} {{ parent() }} - {% include 'SurfnetStepupRaRaBundle:vetting/partial:progress_bar.html.twig' with {'progress': 25, 'step': 2} only %} + {% include 'vetting/partial/progress_bar.html.twig' with {'progress': 25, 'step': 2} only %} {% endblock %} {% block content %} @@ -28,6 +28,6 @@
- {% include 'SurfnetStepupRaRaBundle:vetting/partial:cancel_vetting_procedure.html.twig' with { 'procedureId': app.request.attributes.get('procedureId') } only %} + {% include 'vetting/partial/cancel_vetting_procedure.html.twig' with { 'procedureId': app.request.attributes.get('procedureId') } only %} {% endblock %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting_type_hint/overview.html.twig b/templates/vetting_type_hint/overview.html.twig similarity index 83% rename from src/Surfnet/StepupRa/RaBundle/Resources/views/vetting_type_hint/overview.html.twig rename to templates/vetting_type_hint/overview.html.twig index ab519b71..ebf3b113 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/vetting_type_hint/overview.html.twig +++ b/templates/vetting_type_hint/overview.html.twig @@ -5,7 +5,7 @@ {% block content %}
- {% include 'SurfnetStepupRaRaBundle:partial:language_switcher.html.twig' with {'form': form} only %} + {% include 'partial/language_switcher.html.twig' with {'form': form} only %}
From 173515f18d8a9b4b6554d46fb1694b6f1060a761 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 15:02:31 +0100 Subject: [PATCH 029/202] Fix test with requestStack --- .../Security/Session/FakeRequestStack.php | 36 ++++++++++++++ .../Security/Session/SessionStorageTest.php | 49 ++++++++++++------- 2 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php new file mode 100644 index 00000000..d7d6c1e5 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php @@ -0,0 +1,36 @@ +session; + } +} diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php index 04dbf9d5..41632d17 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php @@ -44,7 +44,8 @@ public function tearDown(): void */ public function the_authentication_moment_can_be_logged() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $sessionStorage->logAuthenticationMoment(); @@ -59,8 +60,8 @@ public function the_authentication_moment_can_be_logged() public function the_authentication_moment_cannot_be_logged_twice() { $this->expectException(LogicException::class); - - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $sessionStorage->logAuthenticationMoment(); $sessionStorage->logAuthenticationMoment(); @@ -73,7 +74,8 @@ public function the_authentication_moment_cannot_be_logged_twice() */ public function whether_or_not_an_authentication_moment_is_logged_can_be_queried() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $this->assertFalse($sessionStorage->isAuthenticationMomentLogged()); @@ -89,7 +91,8 @@ public function whether_or_not_an_authentication_moment_is_logged_can_be_queried */ public function a_logged_authentication_moment_can_be_retrieved() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $now = new DateTime(new CoreDateTime('@1000')); $this->setCurrentTime($now); @@ -109,7 +112,8 @@ public function attempting_to_retrieve_an_authentication_moment_when_not_yet_log { $this->expectException(LogicException::class); - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $sessionStorage->getAuthenticationMoment(); } @@ -121,7 +125,8 @@ public function attempting_to_retrieve_an_authentication_moment_when_not_yet_log */ public function an_interaction_can_be_logged() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $sessionStorage->updateLastInteractionMoment(); @@ -135,7 +140,8 @@ public function an_interaction_can_be_logged() */ public function the_moment_of_interaction_can_be_retrieved() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $now = new DateTime(new CoreDateTime('@1000')); $this->setCurrentTime($now); @@ -153,7 +159,8 @@ public function the_moment_of_interaction_can_be_retrieved() */ public function an_interaction_is_logged_when_an_authentication_is_logged() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); // fixate time, just to be sure when comparing the moments... $now = new DateTime(new CoreDateTime('@1000')); $this->setCurrentTime($now); @@ -177,7 +184,8 @@ public function an_interaction_is_logged_when_an_authentication_is_logged() */ public function the_moment_of_interaction_can_be_updated() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $now = new DateTime(new CoreDateTime('@1000')); $later = new DateTime(new CoreDateTime('@2000')); @@ -203,7 +211,8 @@ public function the_moment_of_interaction_can_be_updated() */ public function the_existence_of_a_moment_interaction_can_be_queried() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $this->assertFalse($sessionStorage->hasSeenInteraction()); @@ -219,7 +228,8 @@ public function the_existence_of_a_moment_interaction_can_be_queried() */ public function the_current_uri_can_be_stored_in_the_session() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $originalUri = 'https://ra.stepup.test/some/path?with=param#hashvalue'; $sessionStorage->setCurrentRequestUri($originalUri); @@ -235,7 +245,8 @@ public function the_current_uri_can_be_stored_in_the_session() */ public function a_request_id_can_be_stored_in_the_session() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $originalRequestId = '_' . bin2hex(openssl_random_pseudo_bytes(32)); $sessionStorage->setRequestId($originalRequestId); @@ -251,7 +262,8 @@ public function a_request_id_can_be_stored_in_the_session() */ public function the_presence_of_a_request_id_can_be_queried() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $originalRequestId = '_' . bin2hex(openssl_random_pseudo_bytes(32)); $this->assertFalse($sessionStorage->hasRequestId()); @@ -268,7 +280,8 @@ public function the_presence_of_a_request_id_can_be_queried() */ public function a_stored_request_id_can_be_cleared() { - $sessionStorage = new SessionStorage(new FakeSession()); + $fakeRequestStack = new FakeRequestStack(); + $sessionStorage = new SessionStorage($fakeRequestStack); $originalRequestId = '_' . bin2hex(openssl_random_pseudo_bytes(32)); $this->assertFalse($sessionStorage->hasRequestId()); @@ -294,7 +307,8 @@ public function a_session_can_be_invalidated() ->shouldReceive('invalidate') ->once() ->getMock(); - $sessionStorage = new SessionStorage($session); + $fakeRequestStack = new FakeRequestStack($session); + $sessionStorage = new SessionStorage($fakeRequestStack); $sessionStorage->invalidate(); @@ -312,7 +326,8 @@ public function a_session_can_be_migrated() ->shouldReceive('migrate') ->once() ->getMock(); - $sessionStorage = new SessionStorage($session); + $fakeRequestStack = new FakeRequestStack($session); + $sessionStorage = new SessionStorage($fakeRequestStack); $sessionStorage->migrate(); From 0580333b3186e16b81de7742b2f0de647bb8a7ad Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 15:15:13 +0100 Subject: [PATCH 030/202] Solve PHPStan error --- .../Exception/UnknownProviderException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php index f15a599a..38ff1005 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php @@ -18,7 +18,7 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle\Exception; -class UnknownProviderException extends RuntimeException +final class UnknownProviderException extends RuntimeException { public static function create($unknownProvider, array $knownProviders) { From a9834fa1c457225cc77dd44acf37170b84f217e1 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 15:19:33 +0100 Subject: [PATCH 031/202] Solve PHPStan error --- ...netStepupRaSamlStepupProviderExtension.php | 14 ++++++------- .../Provider/ProviderRepository.php | 20 +++++++------------ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index fbe756e0..a70b80bf 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -42,7 +42,7 @@ class SurfnetStepupRaSamlStepupProviderExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); @@ -66,7 +66,8 @@ private function loadProviderConfiguration( array $configuration, array $routes, ContainerBuilder $container, - ) { + ): void + { if ($container->has('gssp.provider.' . $provider)) { throw new InvalidConfigurationException(sprintf('Cannot create the same provider "%s" twice', $provider)); } @@ -178,16 +179,13 @@ private function createRemoteDefinition($provider, array $configuration, Contain $container->setDefinition('gssp.provider.' . $provider . '.remote.idp', $definition); } - /** - * @param string $provider - * @return Definition - */ private function createMetadataDefinition( - $provider, + string $provider, array $configuration, array $routes, ContainerBuilder $container, - ) { + ): void + { $metadataConfiguration = new Definition(MetadataConfiguration::class); $propertyMap = [ diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php index 1ef110cd..5c32ec02 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php @@ -1,5 +1,7 @@ providers = []; } - public function addProvider(Provider $provider) + public function addProvider(Provider $provider): void { if ($this->has($provider->getName())) { throw new InvalidConfigurationException(sprintf( @@ -45,20 +47,12 @@ public function addProvider(Provider $provider) $this->providers[$provider->getName()] = $provider; } - /** - * @param string $providerName - * @return bool - */ - public function has($providerName) + public function has(string $providerName): bool { return array_key_exists($providerName, $this->providers); } - /** - * @param string $providerName - * @return Provider - */ - public function get($providerName) + public function get(string $providerName): Provider { if (!$this->has($providerName)) { throw UnknownProviderException::create($providerName, array_keys($this->providers)); From a79a2c8eb4d6112c6fa24c2f2748532bd41f40dc Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 15:37:41 +0100 Subject: [PATCH 032/202] PHPstan extensions --- composer.json | 5 ++- composer.lock | 118 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3788759e..ea506781 100644 --- a/composer.json +++ b/composer.json @@ -47,6 +47,8 @@ "mockery/mockery": "^1.0", "overtrue/phplint": "^2.3", "phpmd/phpmd": "^2.6", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan-symfony": "^1.3", "phpunit/phpunit": "^9.5", "rector/rector": "^0.19.5", "slevomat/coding-standard": "^8.13", @@ -113,7 +115,8 @@ "config": { "allow-plugins": { "symfony/flex": true, - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "phpstan/extension-installer": true }, "optimize-autoloader": true, "sort-packages": true, diff --git a/composer.lock b/composer.lock index ab45686b..460a10e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "00d61017570ae3b9df32eb5b2b7abf74", + "content-hash": "28a31f3c078fbca70f85b1281fad3804", "packages": [ { "name": "beberlei/assert", @@ -8859,6 +8859,50 @@ ], "time": "2023-12-11T08:22:20+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "f45734bfb9984c6c56c4486b71230355f066a58a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f45734bfb9984c6c56c4486b71230355f066a58a", + "reference": "f45734bfb9984c6c56c4486b71230355f066a58a", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.3.1" + }, + "time": "2023-05-24T08:59:17+00:00" + }, { "name": "phpstan/phpdoc-parser", "version": "1.25.0", @@ -8968,6 +9012,78 @@ ], "time": "2024-01-24T11:51:34+00:00" }, + { + "name": "phpstan/phpstan-symfony", + "version": "1.3.7", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-symfony.git", + "reference": "ef7db637be9b85fa00278fc3477ac66abe8eb7d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/ef7db637be9b85fa00278fc3477ac66abe8eb7d1", + "reference": "ef7db637be9b85fa00278fc3477ac66abe8eb7d1", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.10.36" + }, + "conflict": { + "symfony/framework-bundle": "<3.0" + }, + "require-dev": { + "nikic/php-parser": "^4.13.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^1.3.11", + "phpstan/phpstan-strict-rules": "^1.5.1", + "phpunit/phpunit": "^8.5.29 || ^9.5", + "psr/container": "1.0 || 1.1.1", + "symfony/config": "^5.4 || ^6.1", + "symfony/console": "^5.4 || ^6.1", + "symfony/dependency-injection": "^5.4 || ^6.1", + "symfony/form": "^5.4 || ^6.1", + "symfony/framework-bundle": "^5.4 || ^6.1", + "symfony/http-foundation": "^5.4 || ^6.1", + "symfony/messenger": "^5.4", + "symfony/polyfill-php80": "^1.24", + "symfony/serializer": "^5.4", + "symfony/service-contracts": "^2.2.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lukáš Unger", + "email": "looky.msc@gmail.com", + "homepage": "https://lookyman.net" + } + ], + "description": "Symfony Framework extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-symfony/issues", + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.7" + }, + "time": "2024-01-10T21:54:42+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.30", From 8e329493771c71fd257fc992efebb4604d3ab566 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 15:40:53 +0100 Subject: [PATCH 033/202] Remove obsolete phpdoc --- .../RaBundle/Service/SecondFactorService.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php index 7659c6e0..cd8e036e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php @@ -1,5 +1,7 @@ setActorId($actorId); From 952983c58523199bad4921cad01a1fc6335f4fa2 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 16:22:26 +0100 Subject: [PATCH 034/202] Add types --- .../Command/SearchRaCandidatesCommand.php | 44 ++++------------- .../Controller/RaLocationController.php | 48 ++++++------------- .../Controller/RaManagementController.php | 22 +++------ .../RaBundle/Controller/SamlController.php | 13 ++--- .../Controller/SecondFactorController.php | 25 ++++------ .../Form/Type/SearchRaCandidatesType.php | 8 ++-- .../Service/InstitutionListingService.php | 5 +- .../Service/RaSecondFactorService.php | 14 ++---- .../Authentication/Token/SamlTokenTest.php | 1 - 9 files changed, 56 insertions(+), 124 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php index 8089bab3..3a338b79 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php @@ -18,65 +18,41 @@ namespace Surfnet\StepupRa\RaBundle\Command; +use AllowDynamicProperties; use Symfony\Component\Validator\Constraints as Assert; class SearchRaCandidatesCommand { /** * @Assert\NotBlank(message="ra.search_ra_candidates.actor_id.blank") - * @Assert\Type("string", message="ra.search_ra_candidates.actor_id.type") - * - * @var string */ - public $actorId; + public string $actorId; - /** - * @var string - */ - public $institution; + public string $institution; - /** - * @var string|null - */ - public $name; + public ?string $name; - /** - * @var string|null - */ - public $email; + public ?string $email; - /** - * @var string - */ - public $raInstitution; + public string $raInstitution; /** * @Assert\Choice( * {"name", "email"}, * message="ra.search_ra_candidates.order_by.invalid_choice" * ) - * - * @var string|null */ - public $orderBy; + public ?string $orderBy; /** * @Assert\Choice({"asc", "desc"}, message="ra.search_ra_candidates.order_direction.invalid_choice") - * - * @var string|null */ - public $orderDirection; + public ?string $orderDirection; /** - * @Assert\Type("integer", message="ra.search_ra_candidates.page_number.type") * @Assert\GreaterThan(0, message="ra.search_ra_candidates.page_number.greater_than_zero") - * - * @var int */ - public $pageNumber; + public int $pageNumber; - /** - * @var array - */ - public $institutionFilterOptions; + public array $institutionFilterOptions; } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 7748c3b1..13008f45 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -18,7 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\ChangeRaLocationCommand; use Surfnet\StepupRa\RaBundle\Command\CreateRaLocationCommand; use Surfnet\StepupRa\RaBundle\Command\RemoveRaLocationCommand; @@ -28,24 +28,22 @@ use Surfnet\StepupRa\RaBundle\Form\Type\CreateRaLocationType; use Surfnet\StepupRa\RaBundle\Form\Type\RemoveRaLocationType; use Surfnet\StepupRa\RaBundle\Form\Type\SelectInstitutionType; +use Surfnet\StepupRa\RaBundle\Service\InstitutionListingService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; +use Surfnet\StepupRa\RaBundle\Service\RaLocationService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\Form\FormError; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) By making the Form Type classes explicit, MD now realizes couping - * is to high. + * is too high. */ final class RaLocationController extends AbstractController { - /** - * @Template - * @return array|Response - */ - public function manage(Request $request) + public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -82,7 +80,6 @@ public function manage(Request $request) } } - $command = new SearchRaLocationsCommand(); $command->institution = $institution; $command->orderBy = $request->get('orderBy'); @@ -97,7 +94,7 @@ public function manage(Request $request) $locations->getTotalItems(), )); - return [ + return $this->render('ra_location/manage.html.twig', [ 'form' => isset($form) ? $form->createView() : null, 'institution' => $institution, 'locations' => $locations, @@ -105,10 +102,10 @@ public function manage(Request $request) 'orderBy' => $command->orderBy, 'orderDirection' => $command->orderDirection ?: 'asc', 'inverseOrderDirection' => $command->orderDirection === 'asc' ? 'desc' : 'asc', - ]; + ]); } - public function create(Request $request) + public function create(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); @@ -146,7 +143,7 @@ public function create(Request $request) ]); } - public function change(Request $request) + public function change(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); @@ -195,10 +192,7 @@ public function change(Request $request) ]); } - /** - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - public function remove(Request $request) + public function remove(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -234,34 +228,22 @@ public function remove(Request $request) return $this->redirectToRoute('ra_locations_manage', ['institution' => $command->institution]); } - /** - * @return \Surfnet\StepupRa\RaBundle\Service\RaLocationService - */ - private function getRaLocationService() + private function getRaLocationService(): RaLocationService { return $this->get('ra.service.ra_location'); } - /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity - */ - private function getCurrentUser() + private function getCurrentUser(): Identity { return $this->get('security.token_storage')->getToken()->getUser(); } - /** - * @return ProfileService - */ - private function getProfileService() + private function getProfileService(): ProfileService { return $this->get('ra.service.profile'); } - /** - * @return InstitutionListingService - */ - private function getInstitutionListingService() + private function getInstitutionListingService(): InstitutionListingService { return $this->get('ra.service.institution_listing'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 3c380537..187be971 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -19,6 +19,7 @@ namespace Surfnet\StepupRa\RaBundle\Controller; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateInstitution; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListing; use Surfnet\StepupRa\RaBundle\Command\AccreditCandidateCommand; use Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand; use Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand; @@ -32,6 +33,7 @@ use Surfnet\StepupRa\RaBundle\Service\RaListingService; use Surfnet\StepupRa\RaBundle\Value\RoleAtInstitution; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -41,9 +43,6 @@ */ class RaManagementController extends AbstractController { - /** - * @return Response - */ public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -85,7 +84,7 @@ public function manage(Request $request): Response $raList->getTotalItems(), )); - /** @var \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListing[] $raListings */ + /** @var RaListing[] $raListings */ $raListings = $raList->getElements(); return $this->render( @@ -99,10 +98,7 @@ public function manage(Request $request): Response ); } - /** - * @return Response - */ - public function raCandidateSearch(Request $request) + public function raCandidateSearch(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -156,10 +152,7 @@ public function raCandidateSearch(Request $request) ); } - /** - * @return Response - */ - public function createRa(Request $request) + public function createRa(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -214,9 +207,8 @@ public function createRa(Request $request) /** * @param $identityId * @param $raInstitution - * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response */ - public function amendRaInformation(Request $request, $identityId, $raInstitution) + public function amendRaInformation(Request $request, $identityId, $raInstitution): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -261,7 +253,7 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution /** * @param $identityId * @param $raInstitution - * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response + * @return RedirectResponse|Response */ public function retractRegistrationAuthority(Request $request, $identityId, $raInstitution) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 96a60a78..4496e781 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -18,19 +18,16 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Surfnet\SamlBundle\Http\PostBinding; use Surfnet\SamlBundle\Http\XMLResponse; use Surfnet\SamlBundle\Metadata\MetadataFactory; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class SamlController extends AbstractController { - /** - * @Template - */ - public function consumeAssertion(Request $httpRequest) + public function consumeAssertion(Request $httpRequest): Response { /** @var PostBinding $postBinding */ $postBinding = $this->get('surfnet_saml.http.post_binding'); @@ -40,11 +37,11 @@ public function consumeAssertion(Request $httpRequest) $this->get('surfnet_saml.remote.idp'), $this->get('surfnet_saml.hosted.service_provider'), ); - - return $assertion->getAttributes(); + return $this->render('saml/consume_assertion.html.twig', + ['assertion' => $assertion]); } - public function metadata() + public function metadata(): XMLResponse { /** @var MetadataFactory $metadataFactory */ $metadataFactory = $this->get('surfnet_saml.metadata_factory'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 1c6a2b8a..0a60b44c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -27,6 +27,7 @@ use Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaSecondFactorsType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -37,11 +38,7 @@ */ final class SecondFactorController extends AbstractController { - /** - * @Template - * @return array|Response - */ - public function search(Request $request) + public function search(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -70,7 +67,7 @@ public function search(Request $request) if ($form->isSubmitted() && $form->getClickedButton()->getName() == 'export') { $this->get('logger')->notice('Forwarding to export second factors action'); - return $this->forward('SurfnetStepupRaRaBundle:SecondFactor:export', ['command' => $command]); + return $this->forward('\Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::export', ['command' => $command]); } $pagination = $this->getPaginator()->paginate( @@ -87,7 +84,7 @@ public function search(Request $request) $secondFactors->getTotalItems(), )); - return [ + return $this->render('second_factor/search.html.twig', [ 'form' => $form->createView(), 'revocationForm' => $revocationForm->createView(), 'secondFactors' => $secondFactors, @@ -96,10 +93,10 @@ public function search(Request $request) 'orderBy' => $command->orderBy, 'orderDirection' => $command->orderDirection ?: 'asc', 'inverseOrderDirection' => $command->orderDirection === 'asc' ? 'desc' : 'asc', - ]; + ]); } - public function export(SearchRaSecondFactorsCommand $command) + public function export(SearchRaSecondFactorsCommand $command): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -110,10 +107,7 @@ public function export(SearchRaSecondFactorsCommand $command) return $this->getSecondFactorService()->export($exportCommand); } - /** - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - public function revoke(Request $request) + public function revoke(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -149,10 +143,7 @@ public function revoke(Request $request) return $this->redirectToRoute('ra_second_factors_search'); } - /** - * @return Response - */ - public function auditLog(Request $request) + public function auditLog(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->get('logger'); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php index 0185f236..c7dc2db9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php @@ -1,5 +1,7 @@ getData(); @@ -51,14 +53,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SearchRaCandidatesCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_search_ra_candidates'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php index 4c8dff6a..7704d1a3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php @@ -25,10 +25,7 @@ public function __construct(private readonly ApiInstitutionListingService $insti { } - /** - * @return array - */ - public function getAll() + public function getAll(): array { $collection = $this->institutionListingService->getAll(); $listings = $collection->getElements(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php index 10a3b81e..457342d4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php @@ -27,6 +27,7 @@ use Surfnet\StepupRa\RaBundle\Command\ExportRaSecondFactorsCommand; use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; use Surfnet\StepupRa\RaBundle\Command\SearchRaSecondFactorsCommand; +use Symfony\Component\HttpFoundation\Response; /** * @SuppressWarnings(PHPMD.NPathComplexity) -- The command to query mapping in search and export exceed the @@ -42,7 +43,7 @@ public function __construct( ) { } - public function revoke(RevokeSecondFactorCommand $command) + public function revoke(RevokeSecondFactorCommand $command): bool { $middlewareCommand = new RevokeRegistrantsSecondFactorCommand(); $middlewareCommand->secondFactorId = $command->secondFactorId; @@ -64,10 +65,7 @@ public function revoke(RevokeSecondFactorCommand $command) return $result->isSuccessful(); } - /** - * @return RaSecondFactorCollection - */ - public function search(SearchRaSecondFactorsCommand $command) + public function search(SearchRaSecondFactorsCommand $command): RaSecondFactorCollection { $query = new RaSecondFactorSearchQuery($command->pageNumber, $command->actorId); $this->buildQuery($command, $query); @@ -77,10 +75,8 @@ public function search(SearchRaSecondFactorsCommand $command) /** * Searches for a collection of second factor tokens and returns a Http response with an attachment * Content-Disposition. - * - * @return \Symfony\Component\HttpFoundation\Response */ - public function export(ExportRaSecondFactorsCommand $command) + public function export(ExportRaSecondFactorsCommand $command): Response { $query = new RaSecondFactorExportQuery($command->actorId); $this->buildQuery($command, $query); @@ -88,7 +84,7 @@ public function export(ExportRaSecondFactorsCommand $command) return $this->exporter->export($collection, $query->getFileName()); } - private function buildQuery($command, $query) + private function buildQuery($command, $query): void { if ($command->name) { $query->setName($command->name); diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php index 01b59f9d..93e97b0e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php @@ -40,7 +40,6 @@ public function saml_token_is_correctly_serialized_and_unserialized() $samlToken = new SamlToken( new Loa(Loa::LOA_1, 'http://some.url.tld/authentication/loa1'), ['ROLE_RAA'], - $institutionConfigurationOptions ); $serialized = $samlToken->serialize(); From 9077c660433011a2645346cdfff84713378ce2cb Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 16:52:00 +0100 Subject: [PATCH 035/202] Add types and DI --- .../Controller/Vetting/GssfController.php | 149 +++++++----------- 1 file changed, 56 insertions(+), 93 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index df0ce587..fb115d7e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -19,13 +19,21 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting; use Exception; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use JMS\TranslationBundle\Annotation\Ignore; +use Psr\Log\LoggerInterface; +use Surfnet\SamlBundle\Http\PostBinding; +use Surfnet\SamlBundle\Http\RedirectBinding; use Surfnet\SamlBundle\Http\XMLResponse; +use Surfnet\SamlBundle\Metadata\MetadataFactory; +use Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary; use Surfnet\SamlBundle\SAML2\AuthnRequestFactory; use Surfnet\SamlBundle\SAML2\Response\Assertion\InResponseTo; +use Surfnet\StepupBundle\Value\Provider\ViewConfigCollection; use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; use Surfnet\StepupRa\RaBundle\Form\Type\InitiateGssfType; use Surfnet\StepupRa\RaBundle\Service\VettingService; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -37,47 +45,48 @@ */ final class GssfController extends SecondFactorController { + public function __construct( + private readonly ProviderRepository $providerRepository, + private readonly VettingService $vettingService, + private readonly LoggerInterface $logger, + private readonly RedirectBinding $redirectBinding, + private readonly PostBinding $postBinding, + private readonly AttributeDictionary $attributeDictionary, + private readonly ViewConfigCollection $collection, + ) { + } + /** * Initiates verification of a GSSF. - * - * @Template - * @param string $procedureId - * @param string $provider - * @return array|Response */ - public function initiate($procedureId, $provider) + public function initiate(string $procedureId, string $provider): Response { $this->assertSecondFactorEnabled($provider); $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); - $logger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); + $procedureLogger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $procedureLogger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); - if (!$this->getVettingService()->hasProcedure($procedureId)) { - $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); + if (!$this->vettingService->hasProcedure($procedureId)) { + $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); } return $this->renderInitiateForm($procedureId, $this->getProvider($provider)->getName()); } - /** - * @param string $procedureId - * @param string $provider - * @return array|Response - */ - public function authenticate($procedureId, $provider) + public function authenticate(string $procedureId, string $provider): Response { $this->assertSecondFactorEnabled($provider); $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); - $logger->notice('Generating GSSF verification request', ['provider' => $provider]); + $procedureLogger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $procedureLogger->notice('Generating GSSF verification request', ['provider' => $provider]); - if (!$this->getVettingService()->hasProcedure($procedureId)) { - $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); + if (!$this->vettingService->hasProcedure($procedureId)) { + $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); } @@ -88,17 +97,12 @@ public function authenticate($procedureId, $provider) $provider->getRemoteIdentityProvider(), ); - /** @var \Surfnet\StepupRa\RaBundle\Service\VettingService $vettingService */ - $vettingService = $this->get('ra.service.vetting'); - $authnRequest->setSubject($vettingService->getSecondFactorIdentifier($procedureId)); + $authnRequest->setSubject($this->vettingService->getSecondFactorIdentifier($procedureId)); $stateHandler = $provider->getStateHandler(); $stateHandler->setRequestId($authnRequest->getRequestId()); - /** @var \Surfnet\SamlBundle\Http\RedirectBinding $redirectBinding */ - $redirectBinding = $this->get('surfnet_saml.http.redirect_binding'); - - $logger->notice( + $procedureLogger->notice( sprintf( 'Sending AuthnRequest with request ID: "%s" to GSSP "%s" at "%s"', $authnRequest->getRequestId(), @@ -108,36 +112,30 @@ public function authenticate($procedureId, $provider) ['provider' => $provider], ); - $vettingService->startGssfVerification($procedureId); + $this->vettingService->startGssfVerification($procedureId); - return $redirectBinding->createRedirectResponseFor($authnRequest); + return $this->redirectBinding->createResponseFor($authnRequest); } - /** - * @param string $provider - * @return array|Response - */ - public function verify(Request $httpRequest, $provider) + public function verify(Request $httpRequest, string $provider): Response { $this->assertSecondFactorEnabled($provider); $provider = $this->getProvider($provider); - $this->get('logger')->notice( + $this->logger->notice( sprintf('Received GSSP "%s" SAMLResponse through Gateway, attempting to process', $provider->getName()), ); try { - /** @var \Surfnet\SamlBundle\Http\PostBinding $postBinding */ - $postBinding = $this->get('surfnet_saml.http.post_binding'); - $assertion = $postBinding->processResponse( + $assertion = $this->postBinding->processResponse( $httpRequest, $provider->getRemoteIdentityProvider(), $provider->getServiceProvider(), ); } catch (Exception $exception) { $provider->getStateHandler()->clear(); - $this->getLogger()->error( + $this->logger->error( sprintf('Could not process received Response, error: "%s"', $exception->getMessage()), ); @@ -150,7 +148,7 @@ public function verify(Request $httpRequest, $provider) $provider->getStateHandler()->clear(); if (!InResponseTo::assertEquals($assertion, $expectedResponseTo)) { - $this->getLogger()->critical(sprintf( + $this->logger->critical(sprintf( 'Received Response with unexpected InResponseTo: %s', ($expectedResponseTo ? 'expected "' . $expectedResponseTo . '"' : ' no response expected'), )); @@ -158,20 +156,16 @@ public function verify(Request $httpRequest, $provider) throw new BadRequestHttpException('Received unexpected SAML response, cannot return to vetting procedure'); } - $this->get('logger')->notice( + $this->logger->notice( sprintf('Processed GSSP "%s" SAMLResponse received through Gateway successfully', $provider->getName()), ); + + $gssfId = $this->attributeDictionary->translate($assertion)->getNameID(); - /** @var \Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary $attributeDictionary */ - $attributeDictionary = $this->get('surfnet_saml.saml.attribute_dictionary'); - $gssfId = $attributeDictionary->translate($assertion)->getNameID(); - - /** @var \Surfnet\StepupRa\RaBundle\Service\VettingService $vettingService */ - $vettingService = $this->get('ra.service.vetting'); - $result = $vettingService->verifyGssfId($gssfId); + $result = $this->vettingService->verifyGssfId($gssfId); if ($result->isSuccess()) { - $this->getLogger()->notice('GSSP possession proven successfully'); + $this->logger->notice('GSSP possession proven successfully'); return $this->redirectToRoute('ra_vetting_verify_identity', ['procedureId' => $result->getProcedureId()]); } @@ -182,7 +176,7 @@ public function verify(Request $httpRequest, $provider) throw new RuntimeException('Procedure ID for GSSF verification procedure could not be recovered.'); } - $this->getLogger()->notice( + $this->logger->notice( 'Unable to prove possession of correct GSSF: ' . 'GSSF ID registered in Self-Service does not match current GSSF ID', ); @@ -194,66 +188,35 @@ public function verify(Request $httpRequest, $provider) ); } - /** - * @param string $provider - * @return \Symfony\Component\HttpFoundation\Response - */ - public function metadata($provider) + public function metadata(string $provider): XMLResponse { $this->assertSecondFactorEnabled($provider); $provider = $this->getProvider($provider); - /** @var \Surfnet\SamlBundle\Metadata\MetadataFactory $factory */ - $factory = $this->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); + /** @var MetadataFactory $factory */ + $factory = $this->container->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); return new XMLResponse($factory->generate()); } /** - * @param string $provider - * @return \Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider - * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + * @throws NotFoundHttpException */ - private function getProvider($provider) + private function getProvider(string $provider): Provider { - /** @var \Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository $providerRepository */ - $providerRepository = $this->get('gssp.provider_repository'); - - if (!$providerRepository->has($provider)) { - $this->get('logger')->info(sprintf('Requested GSSP "%s" does not exist or is not registered', $provider)); + if (!$this->providerRepository->has($provider)) { + $this->logger->info(sprintf('Requested GSSP "%s" does not exist or is not registered', $provider)); throw new NotFoundHttpException('Requested provider does not exist'); } - return $providerRepository->get($provider); + return $this->providerRepository->get($provider); } - - /** - * @return \Psr\Log\LoggerInterface - */ - private function getLogger() - { - return $this->get('logger'); - } - - /** - * @return VettingService - */ - private function getVettingService() - { - return $this->get('ra.service.vetting'); - } - - /** - * @param string $procedureId - * @param string $provider - * @return Response - */ - private function renderInitiateForm($procedureId, $provider, array $parameters = []) + private function renderInitiateForm(string $procedureId, string $provider, array $parameters = []): Response { - $collection = $this->get("surfnet_stepup.provider.collection"); - $secondFactorConfig = $collection->getByIdentifier($provider); + + $secondFactorConfig = $this->collection->getByIdentifier($provider); $form = $this->createForm( InitiateGssfType::class, From d09d6266eaf7ec24d66cada208f59efd4aaf763e Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 16:54:56 +0100 Subject: [PATCH 036/202] Replace get with container->get --- .../RaBundle/Controller/LocaleController.php | 12 ++++---- .../RaBundle/Controller/ProfileController.php | 4 +-- .../Controller/RaLocationController.php | 26 ++++++++--------- .../Controller/RaManagementController.php | 28 +++++++++---------- .../RaBundle/Controller/RaaController.php | 8 +++--- .../Controller/RecoveryTokenController.php | 2 +- .../RaBundle/Controller/SamlController.php | 8 +++--- .../Controller/SecondFactorController.php | 26 ++++++++--------- .../Vetting/SecondFactorController.php | 2 +- .../Controller/Vetting/SmsController.php | 8 +++--- .../Controller/Vetting/YubikeyController.php | 4 +-- .../RaBundle/Controller/VettingController.php | 28 +++++++++---------- 12 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 7623cb72..6832a9be 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -36,7 +36,7 @@ public function switchLocale(Request $request) // @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878 $domain = $request->getSchemeAndHttpHost() . '/'; if (!str_starts_with($returnUrl, $domain)) { - $this->get('logger')->error(sprintf( + $this->container->get('logger')->error(sprintf( 'Identity "%s" used illegal return-url for redirection after changing locale, aborting request', $this->getIdentity()->id, )); @@ -45,7 +45,7 @@ public function switchLocale(Request $request) } /** @var LoggerInterface $logger */ - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->info('Switching locale...'); $identity = $this->getIdentity(); @@ -64,14 +64,14 @@ public function switchLocale(Request $request) $form->handleRequest($request); if ($form->isSubmitted() && !$form->isValid()) { - $this->addFlash('error', $this->get('translator')->trans('ra.flash.invalid_switch_locale_form')); + $this->addFlash('error', $this->container->get('translator')->trans('ra.flash.invalid_switch_locale_form')); $logger->error('The switch locale form unexpectedly contained invalid data'); return $this->redirect($returnUrl); } - $service = $this->get('ra.service.identity'); + $service = $this->container->get('ra.service.identity'); if (!$service->switchLocale($command)) { - $this->addFlash('error', $this->get('translator')->trans('ra.flash.error_while_switching_locale')); + $this->addFlash('error', $this->container->get('translator')->trans('ra.flash.error_while_switching_locale')); $logger->error('An error occurred while switching locales'); return $this->redirect($returnUrl); } @@ -86,6 +86,6 @@ public function switchLocale(Request $request) */ private function getIdentity() { - return $this->get('security.token_storage')->getToken()->getUser(); + return $this->container->get('security.token_storage')->getToken()->getUser(); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index 7c4e58b3..a2282e8d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -25,7 +25,7 @@ final class ProfileController extends AbstractController { public function profile() { - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->notice('Opening profile page'); @@ -39,6 +39,6 @@ public function profile() */ private function getProfileService() { - return $this->get('ra.service.profile'); + return $this->container->get('ra.service.profile'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 13008f45..e2d5f71e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -50,7 +50,7 @@ public function manage(Request $request): Response $institutionParameter = $request->get('institution'); $identity = $this->getCurrentUser(); - $this->get('logger')->notice('Starting search for locations'); + $this->container->get('logger')->notice('Starting search for locations'); $profile = $this->getProfileService()->findByIdentityId($identity->id); @@ -89,7 +89,7 @@ public function manage(Request $request): Response $removalForm = $this->createForm(RemoveRaLocationType::class, new RemoveRaLocationCommand()); - $this->get('logger')->notice(sprintf( + $this->container->get('logger')->notice(sprintf( 'Searching for RA locations yielded "%d" results', $locations->getTotalItems(), )); @@ -108,7 +108,7 @@ public function manage(Request $request): Response public function create(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $institution = $request->get('institution'); @@ -127,7 +127,7 @@ public function create(Request $request): Response if ($success) { $this->addFlash( 'success', - $this->get('translator')->trans('ra.create_ra_location.created'), + $this->container->get('translator')->trans('ra.create_ra_location.created'), ); $logger->debug('RA Location added, redirecting to the RA location overview'); @@ -146,7 +146,7 @@ public function create(Request $request): Response public function change(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $requestedLocationId = $request->get('locationId'); $raLocation = $this->getRaLocationService()->find($requestedLocationId); @@ -176,7 +176,7 @@ public function change(Request $request): Response if ($success) { $this->addFlash( 'success', - $this->get('translator')->trans('ra.create_ra_location.changed'), + $this->container->get('translator')->trans('ra.create_ra_location.changed'), ); $logger->debug('RA Location added, redirecting to the RA location overview'); @@ -196,7 +196,7 @@ public function remove(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->notice('Received request to remove RA location'); @@ -213,8 +213,8 @@ public function remove(Request $request): RedirectResponse $command->currentUserId, )); - $translator = $this->get('translator'); - $flashBag = $this->get('session')->getFlashBag(); + $translator = $this->container->get('translator'); + $flashBag = $this->container->get('session')->getFlashBag(); if ($this->getRaLocationService()->remove($command)) { $logger->notice('RA Location removal Succeeded'); $flashBag->add('success', $translator->trans('ra.ra_location.revocation.removed')); @@ -230,21 +230,21 @@ public function remove(Request $request): RedirectResponse private function getRaLocationService(): RaLocationService { - return $this->get('ra.service.ra_location'); + return $this->container->get('ra.service.ra_location'); } private function getCurrentUser(): Identity { - return $this->get('security.token_storage')->getToken()->getUser(); + return $this->container->get('security.token_storage')->getToken()->getUser(); } private function getProfileService(): ProfileService { - return $this->get('ra.service.profile'); + return $this->container->get('ra.service.profile'); } private function getInstitutionListingService(): InstitutionListingService { - return $this->get('ra.service.institution_listing'); + return $this->container->get('ra.service.institution_listing'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 187be971..d881a97b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -48,7 +48,7 @@ public function manage(Request $request): Response $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $institution = $this->getUser()->institution; $logger->notice(sprintf('Loading overview of RA(A)s for institution "%s"', $institution)); @@ -103,7 +103,7 @@ public function raCandidateSearch(Request $request): Response $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $identity = $this->getCurrentUser(); $institution = $identity->institution; @@ -156,7 +156,7 @@ public function createRa(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->notice('Page for Accreditation of Identity to Ra or Raa requested'); $identityId = $request->get('identityId'); @@ -187,7 +187,7 @@ public function createRa(Request $request): Response if ($success) { $this->addFlash( 'success', - $this->get('translator')->trans('ra.management.create_ra.identity_accredited'), + $this->container->get('translator')->trans('ra.management.create_ra.identity_accredited'), ); $logger->debug('Identity Accredited, redirecting to candidate overview'); @@ -213,7 +213,7 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->notice(sprintf("Loading information amendment form for RA(A) '%s'", $identityId)); $raListing = $this->getRaListingService()->get($identityId, $raInstitution, $this->getUser()->id); @@ -233,8 +233,8 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution if ($form->isSubmitted() && $form->isValid()) { $logger->notice(sprintf("RA(A) '%s' information amendment form submitted, processing", $identityId)); - if ($this->get('ra.service.ra')->amendRegistrationAuthorityInformation($command)) { - $this->addFlash('success', $this->get('translator')->trans('ra.management.amend_ra_info.info_amended')); + if ($this->container->get('ra.service.ra')->amendRegistrationAuthorityInformation($command)) { + $this->addFlash('success', $this->container->get('translator')->trans('ra.management.amend_ra_info.info_amended')); $logger->notice(sprintf("RA(A) '%s' information successfully amended", $identityId)); return $this->redirectToRoute('ra_management_manage'); @@ -259,7 +259,7 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->notice(sprintf("Loading retract registration authority form for RA(A) '%s'", $identityId)); @@ -282,10 +282,10 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI $logger->notice(sprintf('Confirmed retraction of RA credentials for identity "%s"', $identityId)); - if ($this->get('ra.service.ra')->retractRegistrationAuthority($command)) { + if ($this->container->get('ra.service.ra')->retractRegistrationAuthority($command)) { $logger->notice(sprintf('Registration authority for identity "%s" retracted', $identityId)); - $this->addFlash('success', $this->get('translator')->trans('ra.management.retract_ra.success')); + $this->addFlash('success', $this->container->get('translator')->trans('ra.management.retract_ra.success')); return $this->redirectToRoute('ra_management_manage'); } @@ -307,7 +307,7 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI */ private function getRaListingService() { - return $this->get('ra.service.ra_listing'); + return $this->container->get('ra.service.ra_listing'); } /** @@ -315,7 +315,7 @@ private function getRaListingService() */ private function getRaCandidateService() { - return $this->get('ra.service.ra_candidate'); + return $this->container->get('ra.service.ra_candidate'); } /** @@ -323,7 +323,7 @@ private function getRaCandidateService() */ private function getCurrentUser() { - return $this->get('security.token_storage')->getToken()->getUser(); + return $this->container->get('security.token_storage')->getToken()->getUser(); } /** @@ -331,6 +331,6 @@ private function getCurrentUser() */ private function getPaginator() { - return $this->get('knp_paginator'); + return $this->container->get('knp_paginator'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index 906220a8..25ec2737 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -34,7 +34,7 @@ public function institutionConfiguration(Request $request) $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); /** @var Identity $identity */ $identity = $this->getUser(); @@ -88,7 +88,7 @@ public function institutionConfiguration(Request $request) */ private function getInstitutionConfigurationOptionsService() { - return $this->get('ra.service.institution_configuration_options'); + return $this->container->get('ra.service.institution_configuration_options'); } /** @@ -96,7 +96,7 @@ private function getInstitutionConfigurationOptionsService() */ private function getProfileService() { - return $this->get('ra.service.profile'); + return $this->container->get('ra.service.profile'); } /** @@ -104,6 +104,6 @@ private function getProfileService() */ private function getInstitutionListingService() { - return $this->get('ra.service.institution_listing'); + return $this->container->get('ra.service.institution_listing'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 1a33882b..5c2ad1bd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -49,7 +49,7 @@ public function search(Request $request): Response $this->denyAccessUnlessGranted('ROLE_RA'); $identity = $this->getCurrentUser(); - $this->get('logger')->notice('Starting search for recovery tokens'); + $this->container->get('logger')->notice('Starting search for recovery tokens'); $command = new SearchRecoveryTokensCommand(); $command->actorId = $identity->id; diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 4496e781..1dc3ddd1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -30,12 +30,12 @@ class SamlController extends AbstractController public function consumeAssertion(Request $httpRequest): Response { /** @var PostBinding $postBinding */ - $postBinding = $this->get('surfnet_saml.http.post_binding'); + $postBinding = $this->container->get('surfnet_saml.http.post_binding'); $assertion = $postBinding->processResponse( $httpRequest, - $this->get('surfnet_saml.remote.idp'), - $this->get('surfnet_saml.hosted.service_provider'), + $this->container->get('surfnet_saml.remote.idp'), + $this->container->get('surfnet_saml.hosted.service_provider'), ); return $this->render('saml/consume_assertion.html.twig', ['assertion' => $assertion]); @@ -44,7 +44,7 @@ public function consumeAssertion(Request $httpRequest): Response public function metadata(): XMLResponse { /** @var MetadataFactory $metadataFactory */ - $metadataFactory = $this->get('surfnet_saml.metadata_factory'); + $metadataFactory = $this->container->get('surfnet_saml.metadata_factory'); return new XMLResponse($metadataFactory->generate()); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 0a60b44c..230c8088 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -43,7 +43,7 @@ public function search(Request $request): Response $this->denyAccessUnlessGranted('ROLE_RA'); $identity = $this->getCurrentUser(); - $this->get('logger')->notice('Starting search for second factors'); + $this->container->get('logger')->notice('Starting search for second factors'); $command = new SearchRaSecondFactorsCommand(); $command->actorId = $identity->id; @@ -66,7 +66,7 @@ public function search(Request $request): Response $secondFactorCount = $secondFactors->getTotalItems(); if ($form->isSubmitted() && $form->getClickedButton()->getName() == 'export') { - $this->get('logger')->notice('Forwarding to export second factors action'); + $this->container->get('logger')->notice('Forwarding to export second factors action'); return $this->forward('\Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::export', ['command' => $command]); } @@ -79,7 +79,7 @@ public function search(Request $request): Response $revocationForm = $this->createForm(RevokeSecondFactorType::class, new RevokeSecondFactorCommand()); - $this->get('logger')->notice(sprintf( + $this->container->get('logger')->notice(sprintf( 'Searching for second factors yielded "%d" results', $secondFactors->getTotalItems(), )); @@ -100,7 +100,7 @@ public function export(SearchRaSecondFactorsCommand $command): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->get('logger')->notice('Starting export of searched second factors'); + $this->container->get('logger')->notice('Starting export of searched second factors'); $exportCommand = ExportRaSecondFactorsCommand::fromSearchCommand($command); @@ -111,7 +111,7 @@ public function revoke(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $logger->notice('Received request to revoke Second Factor'); @@ -128,8 +128,8 @@ public function revoke(Request $request): RedirectResponse $command->currentUserId, )); - $translator = $this->get('translator'); - $flashBag = $this->get('session')->getFlashBag(); + $translator = $this->container->get('translator'); + $flashBag = $this->container->get('session')->getFlashBag(); if ($this->getSecondFactorService()->revoke($command)) { $logger->notice('Second Factor revocation Succeeded'); $flashBag->add('success', $translator->trans('ra.second_factor.revocation.revoked')); @@ -146,7 +146,7 @@ public function revoke(Request $request): RedirectResponse public function auditLog(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $identityId = $request->get('identityId'); @@ -197,7 +197,7 @@ public function auditLog(Request $request): Response */ private function getSecondFactorService() { - return $this->get('ra.service.ra_second_factor'); + return $this->container->get('ra.service.ra_second_factor'); } /** @@ -205,7 +205,7 @@ private function getSecondFactorService() */ private function getIdentityService() { - return $this->get('ra.service.identity'); + return $this->container->get('ra.service.identity'); } /** @@ -213,7 +213,7 @@ private function getIdentityService() */ private function getAuditLogService() { - return $this->get('ra.service.audit_log'); + return $this->container->get('ra.service.audit_log'); } /** @@ -221,7 +221,7 @@ private function getAuditLogService() */ private function getCurrentUser() { - return $this->get('security.token_storage')->getToken()->getUser(); + return $this->container->get('security.token_storage')->getToken()->getUser(); } /** @@ -229,6 +229,6 @@ private function getCurrentUser() */ private function getPaginator() { - return $this->get('knp_paginator'); + return $this->container->get('knp_paginator'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php index a261b238..b1df74ea 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php @@ -28,7 +28,7 @@ abstract class SecondFactorController extends AbstractController protected function assertSecondFactorEnabled($type) { if (!in_array($type, $this->getParameter('surfnet_stepup_ra.enabled_second_factors'))) { - $this->get('logger')->warning('A controller action was called for a disabled second factor'); + $this->container->get('logger')->warning('A controller action was called for a disabled second factor'); throw $this->createNotFoundException(); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index e67e80e7..941a258c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -45,7 +45,7 @@ public function sendChallenge(Request $request, $procedureId) $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Received request for Send SMS Challenge page'); if (!$this->getVettingService()->hasProcedure($procedureId)) { @@ -107,7 +107,7 @@ public function provePossession(Request $request, $procedureId) { $this->assertSecondFactorEnabled('sms'); $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Received request for Proof of Possession of SMS Second Factor page'); $vettingService = $this->getVettingService(); @@ -122,7 +122,7 @@ public function provePossession(Request $request, $procedureId) if ($cancelButton->isClicked()) { $vettingService->cancelProcedure($procedureId); - $this->addFlash('info', $this->get('translator')->trans('ra.vetting.flash.cancelled')); + $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } @@ -162,6 +162,6 @@ public function provePossession(Request $request, $procedureId) */ private function getVettingService() { - return $this->get('ra.service.vetting'); + return $this->container->get('ra.service.vetting'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index cc1e67a0..4e5cf8f3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -40,7 +40,7 @@ public function verify(Request $request, $procedureId) $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Requested Yubikey Verfication'); if (!$this->getVettingService()->hasProcedure($procedureId)) { @@ -81,6 +81,6 @@ public function verify(Request $request, $procedureId) */ private function getVettingService() { - return $this->get('ra.service.vetting'); + return $this->container->get('ra.service.vetting'); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 50c3ac7f..a0f24627 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -53,7 +53,7 @@ class VettingController extends AbstractController public function startProcedure(Request $request) { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('logger'); + $logger = $this->container->get('logger'); $identity = $this->getIdentity(); $logger->notice('Vetting Procedure Search started'); @@ -97,7 +97,7 @@ public function startProcedure(Request $request) } /** @var SamlToken $token */ - $token = $this->get('security.token_storage')->getToken(); + $token = $this->container->get('security.token_storage')->getToken(); $command->authorityId = $this->getIdentity()->id; $command->authorityLoa = $token->getLoa(); $command->secondFactor = $secondFactor; @@ -132,13 +132,13 @@ public function startProcedure(Request $request) $procedureId = $this->getVettingService()->startProcedure($command); - $this->get('ra.procedure_logger') + $this->container->get('ra.procedure_logger') ->forProcedure($procedureId) ->notice(sprintf('Starting new Vetting Procedure for second factor of type "%s"', $secondFactor->type)); if ($this->getVettingService()->isProvePossessionSkippable($procedureId)) { - $this->get('ra.procedure_logger') + $this->container->get('ra.procedure_logger') ->forProcedure($procedureId) ->notice(sprintf('Vetting Procedure for second factor of type "%s" skips the possession proven step', $secondFactor->type)); @@ -167,7 +167,7 @@ public function startProcedure(Request $request) public function cancelProcedure($procedureId) { - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); if (!$this->getVettingService()->hasProcedure($procedureId)) { $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); @@ -175,7 +175,7 @@ public function cancelProcedure($procedureId) } $this->getVettingService()->cancelProcedure($procedureId); - $this->addFlash('info', $this->get('translator')->trans('ra.vetting.flash.cancelled')); + $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } @@ -192,7 +192,7 @@ public function verifyIdentity(Request $request, $procedureId) { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Verify Identity Form requested'); if (!$this->getVettingService()->hasProcedure($procedureId)) { @@ -207,7 +207,7 @@ public function verifyIdentity(Request $request, $procedureId) $cancelButton = $form->get('cancel'); if ($cancelButton->isClicked()) { $this->getVettingService()->cancelProcedure($procedureId); - $this->addFlash('info', $this->get('translator')->trans('ra.vetting.flash.cancelled')); + $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } @@ -232,7 +232,7 @@ public function verifyIdentity(Request $request, $procedureId) try { $vettingService->verifyIdentity($procedureId, $command); } catch (DomainException $e) { - $this->get('logger')->error( + $this->container->get('logger')->error( "RA attempted to verify identity, but the vetting procedure does not allow it", ['exception' => $e, 'procedure' => $procedureId], ); @@ -286,7 +286,7 @@ public function vettingCompleted() */ private function getSecondFactorService() { - return $this->get('ra.service.second_factor'); + return $this->container->get('ra.service.second_factor'); } /** @@ -294,7 +294,7 @@ private function getSecondFactorService() */ private function getSecondFactorTypeService() { - return $this->get('surfnet_stepup.service.second_factor_type'); + return $this->container->get('surfnet_stepup.service.second_factor_type'); } /** @@ -302,7 +302,7 @@ private function getSecondFactorTypeService() */ private function getVettingService() { - return $this->get('ra.service.vetting'); + return $this->container->get('ra.service.vetting'); } /** @@ -310,7 +310,7 @@ private function getVettingService() */ private function getIdentity() { - return $this->get('security.token_storage')->getToken()->getUser(); + return $this->container->get('security.token_storage')->getToken()->getUser(); } /** @@ -318,6 +318,6 @@ private function getIdentity() */ private function getTranslator() { - return $this->get('translator'); + return $this->container->get('translator'); } } From 600d9f6d3fde24e871ab61847ac3ff3904155cf4 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 17:15:05 +0100 Subject: [PATCH 037/202] Add types and DI --- .../Controller/Vetting/YubikeyController.php | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 4e5cf8f3..49984f39 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -1,5 +1,7 @@ assertSecondFactorEnabled('yubikey'); $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); - $logger->notice('Requested Yubikey Verfication'); + $procedureLogger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $procedureLogger->notice('Requested Yubikey Verfication'); - if (!$this->getVettingService()->hasProcedure($procedureId)) { - $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); + if (!$this->vettingService->hasProcedure($procedureId)) { + $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); } @@ -52,10 +53,10 @@ public function verify(Request $request, $procedureId) $form = $this->createForm(VerifyYubikeyPublicIdType::class, $command)->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $result = $this->getVettingService()->verifyYubikeyPublicId($procedureId, $command); + $result = $this->vettingService->verifyYubikeyPublicId($procedureId, $command); if ($result->didPublicIdMatch()) { - $logger->notice('Yubikey Verified, redirecting to verify identity'); + $procedureLogger->notice('Yubikey Verified, redirecting to verify identity'); return $this->redirectToRoute('ra_vetting_verify_identity', ['procedureId' => $procedureId]); } @@ -68,19 +69,16 @@ public function verify(Request $request, $procedureId) $this->addFlash('error', 'ra.prove_yubikey_possession.different_yubikey_used'); } - $logger->notice('Yubikey could not be verified, added error to form'); + $procedureLogger->notice('Yubikey could not be verified, added error to form'); } - $logger->notice('Rendering Yubikey Verification Form'); + $procedureLogger->notice('Rendering Yubikey Verification Form'); // OTP field is rendered empty in the template. - return ['form' => $form->createView()]; - } - /** - * @return VettingService - */ - private function getVettingService() - { - return $this->container->get('ra.service.vetting'); + return $this->render( + view: 'vetting/yubikey/verify.html.twig', + parameters: ['form' => $form->createView()], + ); } + } From e67f589cc94b008ec200d064ae003d1aeeb9a447 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 1 Feb 2024 17:24:23 +0100 Subject: [PATCH 038/202] Ran phpcbf --- .../RaBundle/Controller/SamlController.php | 6 +- .../Controller/Vetting/SmsController.php | 76 ++++++++++--------- .../Controller/Vetting/YubikeyController.php | 1 - .../SessionVettingProcedureRepository.php | 4 +- .../Repository/VettingProcedureRepository.php | 2 +- .../Authentication/Token/SamlToken.php | 5 +- .../RaBundle/Service/SecondFactorService.php | 3 +- .../RaBundle/Service/VettingService.php | 7 +- .../StepupRa/RaBundle/VettingProcedure.php | 3 +- ...netStepupRaSamlStepupProviderExtension.php | 6 +- 10 files changed, 58 insertions(+), 55 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 1dc3ddd1..a9215565 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -37,8 +37,10 @@ public function consumeAssertion(Request $httpRequest): Response $this->container->get('surfnet_saml.remote.idp'), $this->container->get('surfnet_saml.hosted.service_provider'), ); - return $this->render('saml/consume_assertion.html.twig', - ['assertion' => $assertion]); + return $this->render( + 'saml/consume_assertion.html.twig', + ['assertion' => $assertion], + ); } public function metadata(): XMLResponse diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 941a258c..c0efcd6b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -18,15 +18,14 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use Surfnet\StepupBundle\Command\SendSmsChallengeCommand; -use Surfnet\StepupBundle\Command\VerifyPhoneNumberCommand; use Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand; use Surfnet\StepupBundle\Value\PhoneNumber\InternationalPhoneNumber; use Surfnet\StepupRa\RaBundle\Form\Type\SendSmsChallengeType; use Surfnet\StepupRa\RaBundle\Form\Type\VerifyPhoneNumberType; use Surfnet\StepupRa\RaBundle\Service\VettingService; -use Symfony\Component\Form\FormError; use Symfony\Component\Form\SubmitButton; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -34,12 +33,13 @@ class SmsController extends SecondFactorController { - /** - * @Template - * @param string $procedureId - * @return array|Response - */ - public function sendChallenge(Request $request, $procedureId) + + public function __construct( + private readonly VettingService $vettingService, + ) { + } + + public function sendChallenge(Request $request, string $procedureId): Response { $this->assertSecondFactorEnabled('sms'); @@ -48,7 +48,7 @@ public function sendChallenge(Request $request, $procedureId) $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Received request for Send SMS Challenge page'); - if (!$this->getVettingService()->hasProcedure($procedureId)) { + if (!$this->vettingService->hasProcedure($procedureId)) { $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); } @@ -56,29 +56,31 @@ public function sendChallenge(Request $request, $procedureId) $command = new SendSmsChallengeCommand(); $form = $this->createForm(SendSmsChallengeType::class, $command)->handleRequest($request); - $vettingService = $this->getVettingService(); // Identifier = phone number as it is stored in the verified second factor event - $secondFactorIdentifier = $vettingService->getSecondFactorIdentifier($procedureId); + $secondFactorIdentifier = $this->vettingService->getSecondFactorIdentifier($procedureId); // Id = the UUID identifier of the second factor token - $secondFactorId = $vettingService->getSecondFactorId($procedureId); + $secondFactorId = $this->vettingService->getSecondFactorId($procedureId); $phoneNumber = InternationalPhoneNumber::fromStringFormat($secondFactorIdentifier); - $otpRequestsRemaining = $vettingService->getSmsOtpRequestsRemainingCount($secondFactorId); - $maximumOtpRequests = $vettingService->getSmsMaximumOtpRequestsCount(); + $otpRequestsRemaining = $this->vettingService->getSmsOtpRequestsRemainingCount($secondFactorId); + $maximumOtpRequests = $this->vettingService->getSmsMaximumOtpRequestsCount(); $viewVariables = ['otpRequestsRemaining' => $otpRequestsRemaining, 'maximumOtpRequests' => $maximumOtpRequests]; if (!$form->isSubmitted() || !$form->isValid()) { $logger->notice('Form has not been submitted, not sending SMS, rendering Send SMS Challenge page'); - return array_merge( - $viewVariables, - ['phoneNumber' => $phoneNumber, 'form' => $form->createView()], + $this->render( + 'vetting/sms/send_challenge.html.twig', + array_merge( + $viewVariables, + ['phoneNumber' => $phoneNumber, 'form' => $form->createView()], + ), ); } $logger->notice('Sending of SMS Challenge has been requested, sending OTP via SMS'); - if ($vettingService->sendSmsChallenge($procedureId, $command)) { + if ($this->vettingService->sendSmsChallenge($procedureId, $command)) { $logger->notice( 'SMS Challenge successfully sent, redirecting to Proof of Possession page to verify challenge', ); @@ -92,25 +94,27 @@ public function sendChallenge(Request $request, $procedureId) 'SMS Challenge could not be sent, added error to page to notify user and re-rendering send challenge page', ); - return array_merge( - $viewVariables, - ['phoneNumber' => $phoneNumber, 'form' => $form->createView()], + return $this->render( + 'vetting/sms/send_challenge.html.twig', + array_merge( + $viewVariables, + ['phoneNumber' => $phoneNumber, 'form' => $form->createView()], + ), ); } /** - * @Template - * @param string $procedureId - * @return array|Response + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ - public function provePossession(Request $request, $procedureId) + public function provePossession(Request $request, string $procedureId): Response { $this->assertSecondFactorEnabled('sms'); $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Received request for Proof of Possession of SMS Second Factor page'); - $vettingService = $this->getVettingService(); + $vettingService = $this->vettingService; $command = new VerifyPossessionOfPhoneCommand(); $command->secondFactorId = $vettingService->getSecondFactorId($procedureId); $form = $this @@ -132,7 +136,10 @@ public function provePossession(Request $request, $procedureId) 'SMS OTP was not submitted through form, rendering Proof of Possession of SMS Second Factor page', ); - return ['form' => $form->createView()]; + return $this->render( + 'vetting/sms/prove_possession.html.twig', + ['form' => $form->createView()], + ); } $logger->notice('SMS OTP has been entered, attempting to verify Proof of Possession'); @@ -154,14 +161,9 @@ public function provePossession(Request $request, $procedureId) $logger->notice('SMS OTP verification failed - Proof of Possession denied, added error to form'); - return ['form' => $form->createView()]; - } - - /** - * @return VettingService - */ - private function getVettingService() - { - return $this->container->get('ra.service.vetting'); + return $this->render( + 'vetting/sms/prove_possession.html.twig', + ['form' => $form->createView()], + ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 49984f39..caac7f89 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -80,5 +80,4 @@ public function verify(Request $request, string $procedureId): Response parameters: ['form' => $form->createView()], ); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php index 059cdbb1..87482f21 100644 --- a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php +++ b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php @@ -27,8 +27,8 @@ class SessionVettingProcedureRepository implements VettingProcedureRepository { public function __construct( private readonly RequestStack $requestStack, - private readonly string $namespace) - { + private readonly string $namespace, + ) { } public function store(VettingProcedure $vettingProcedure): void diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php index 24f0cdfd..d43dc379 100644 --- a/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php +++ b/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php @@ -24,7 +24,7 @@ interface VettingProcedureRepository { - public function store(VettingProcedure $vettingProcedure); + public function store(VettingProcedure $vettingProcedure); public function retrieve(string $id): ?VettingProcedure; diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php index 4ea9bbc9..fd62ebd3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php @@ -27,8 +27,9 @@ class SamlToken extends AbstractToken public Assertion $assertion; public function __construct( - private Loa $loa, array $roles = []) - { + private Loa $loa, + array $roles = [], + ) { parent::__construct($roles); $this->setAuthenticated(count($roles)); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php index cd8e036e..7392d7ea 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php @@ -38,8 +38,7 @@ public function __construct( public function findVerifiedSecondFactorByRegistrationCode( string $registrationCode, string $actorId, - ): ?VerifiedSecondFactor - { + ): ?VerifiedSecondFactor { $query = new VerifiedSecondFactorSearchQuery(); $query->setActorId($actorId); $query->setRegistrationCode($registrationCode); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index 85f3d7dd..0522d610 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -44,6 +44,7 @@ use Surfnet\StepupRa\RaBundle\Value\DateTime; use Surfnet\StepupRa\RaBundle\VettingProcedure; use Symfony\Contracts\Translation\TranslatorInterface; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyPublicMethods) @@ -199,8 +200,10 @@ public function verifyPhoneNumber(string $procedureId, VerifyPossessionOfPhoneCo return $verification; } - public function verifyYubikeyPublicId(string $procedureId, VerifyYubikeyPublicIdCommand $command): YubikeySecondFactor\VerificationResult - { + public function verifyYubikeyPublicId( + string $procedureId, + VerifyYubikeyPublicIdCommand $command, + ): YubikeySecondFactor\VerificationResult { $procedure = $this->getProcedure($procedureId); $command->expectedPublicId = $procedure->getSecondFactor()->secondFactorIdentifier; diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index 0d8d826a..5d6d0b1e 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -51,8 +51,7 @@ public static function start( string $registrationCode, VerifiedSecondFactor $secondFactor, bool $skipProvePossession, - ): VettingProcedure - { + ): VettingProcedure { $procedure = new self(); $procedure->id = $id; $procedure->authorityId = $authorityId; diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index a70b80bf..90395d1c 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -66,8 +66,7 @@ private function loadProviderConfiguration( array $configuration, array $routes, ContainerBuilder $container, - ): void - { + ): void { if ($container->has('gssp.provider.' . $provider)) { throw new InvalidConfigurationException(sprintf('Cannot create the same provider "%s" twice', $provider)); } @@ -184,8 +183,7 @@ private function createMetadataDefinition( array $configuration, array $routes, ContainerBuilder $container, - ): void - { + ): void { $metadataConfiguration = new Definition(MetadataConfiguration::class); $propertyMap = [ From 147628c00d37f97b4de17102ead201458f69e286 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 10:36:19 +0100 Subject: [PATCH 039/202] DI and removed @Template --- .../RaBundle/Controller/VettingController.php | 124 +++++++----------- 1 file changed, 45 insertions(+), 79 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index a0f24627..537081ac 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -18,9 +18,10 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Service\SecondFactorTypeService; use Surfnet\StepupBundle\Value\SecondFactorType; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand; use Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand; use Surfnet\StepupRa\RaBundle\Exception\DomainException; @@ -32,10 +33,11 @@ use Surfnet\StepupRa\RaBundle\Service\VettingService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\SubmitButton; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -43,44 +45,50 @@ */ class VettingController extends AbstractController { + public function __construct( + private readonly VettingService $vettingService, + private readonly SecondFactorService $secondFactorService, + private readonly SecondFactorTypeService $secondFactorTypeService, + private readonly LoggerInterface $logger, + private readonly TranslatorInterface $translator, + ) { + } + + /** - * @Template - * @return array|Response - * * @SuppressWarnings(PHPMD.CyclomaticComplexity) https://www.pivotaltracker.com/story/show/135045063 * @SuppressWarnings(PHPMD.NPathComplexity) https://www.pivotaltracker.com/story/show/135045063 */ - public function startProcedure(Request $request) + public function startProcedure(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('logger'); $identity = $this->getIdentity(); - $logger->notice('Vetting Procedure Search started'); + $this->logger->notice('Vetting Procedure Search started'); $command = new StartVettingProcedureCommand(); $form = $this->createForm(StartVettingProcedureType::class, $command)->handleRequest($request); if (!$form->isSubmitted() || !$form->isValid()) { - $logger->notice('No search submitted, displaying search by registration code form'); + $this->logger->notice('No search submitted, displaying search by registration code form'); - return ['form' => $form->createView()]; + return $this->render('vetting/start_procedure.html.twig', ['form' => $form->createView()]); } - $secondFactor = $this->getSecondFactorService() + $secondFactor = $this->secondFactorService ->findVerifiedSecondFactorByRegistrationCode($command->registrationCode, $identity->id); if ($secondFactor === null) { $this->addFlash('error', 'ra.form.start_vetting_procedure.unknown_registration_code'); - $logger->notice('Cannot start new vetting procedure, no second factor found'); + $this->logger->notice('Cannot start new vetting procedure, no second factor found'); - return ['form' => $form->createView()]; + return $this->render('vetting/start_procedure.html.twig', ['form' => $form->createView()]); } $enabledSecondFactors = $this->container->getParameter('surfnet_stepup_ra.enabled_second_factors'); if (!in_array($secondFactor->type, $enabledSecondFactors, true)) { - $logger->warning( + $this->logger->warning( sprintf( 'An RA attempted vetting of disabled second factor "%s" of type "%s"', $secondFactor->id, @@ -102,10 +110,10 @@ public function startProcedure(Request $request) $command->authorityLoa = $token->getLoa(); $command->secondFactor = $secondFactor; - if ($this->getVettingService()->isExpiredRegistrationCode($command)) { + if ($this->vettingService->isExpiredRegistrationCode($command)) { $this->addFlash( 'error', - $this->getTranslator() + $this->translator ->trans( 'ra.verify_identity.registration_code_expired', [ @@ -114,30 +122,30 @@ public function startProcedure(Request $request) ), ); - $logger->notice( + $this->logger->notice( 'Second factor registration code is expired', ['registration_requested_at' => $secondFactor->registrationRequestedAt->format('Y-m-d')], ); - return ['form' => $form->createView()]; + return $this->render('vetting/start_procedure.html.twig', ['form' => $form->createView()]); } - if (!$this->getVettingService()->isLoaSufficientToStartProcedure($command)) { + if (!$this->vettingService->isLoaSufficientToStartProcedure($command)) { $this->addFlash('error', 'ra.form.start_vetting_procedure.loa_insufficient'); - $logger->notice('Cannot start new vetting procedure, Authority LoA is insufficient'); + $this->logger->notice('Cannot start new vetting procedure, Authority LoA is insufficient'); - return ['form' => $form->createView()]; + return $this->render('vetting/start_procedure.html.twig', ['form' => $form->createView()]); } - $procedureId = $this->getVettingService()->startProcedure($command); + $procedureId = $this->vettingService->startProcedure($command); $this->container->get('ra.procedure_logger') ->forProcedure($procedureId) ->notice(sprintf('Starting new Vetting Procedure for second factor of type "%s"', $secondFactor->type)); - if ($this->getVettingService()->isProvePossessionSkippable($procedureId)) { + if ($this->vettingService->isProvePossessionSkippable($procedureId)) { $this->container->get('ra.procedure_logger') ->forProcedure($procedureId) ->notice(sprintf('Vetting Procedure for second factor of type "%s" skips the possession proven step', $secondFactor->type)); @@ -150,7 +158,7 @@ public function startProcedure(Request $request) return $this->redirectToRoute('ra_vetting_yubikey_verify', ['procedureId' => $procedureId]); } elseif ($secondFactorType->isSms()) { return $this->redirectToRoute('ra_vetting_sms_send_challenge', ['procedureId' => $procedureId]); - } elseif ($this->getSecondFactorTypeService()->isGssf($secondFactorType)) { + } elseif ($this->secondFactorTypeService->isGssf($secondFactorType)) { return $this->redirectToRoute( 'ra_vetting_gssf_initiate', [ @@ -165,37 +173,33 @@ public function startProcedure(Request $request) } } - public function cancelProcedure($procedureId) + public function cancelProcedure($procedureId): RedirectResponse { $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); - if (!$this->getVettingService()->hasProcedure($procedureId)) { + if (!$this->vettingService->hasProcedure($procedureId)) { $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); } - $this->getVettingService()->cancelProcedure($procedureId); + $this->vettingService->cancelProcedure($procedureId); $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } /** - * @Template - * @param string $procedureId - * @return array|Response - * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function verifyIdentity(Request $request, $procedureId) + public function verifyIdentity(Request $request, string $procedureId): Response { $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); $logger->notice('Verify Identity Form requested'); - if (!$this->getVettingService()->hasProcedure($procedureId)) { + if (!$this->vettingService->hasProcedure($procedureId)) { $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); } @@ -206,13 +210,13 @@ public function verifyIdentity(Request $request, $procedureId) /** @var SubmitButton $cancelButton */ $cancelButton = $form->get('cancel'); if ($cancelButton->isClicked()) { - $this->getVettingService()->cancelProcedure($procedureId); + $this->vettingService->cancelProcedure($procedureId); $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } - $vettingService = $this->getVettingService(); + $vettingService = $this->vettingService; $commonName = $vettingService->getIdentityCommonName($procedureId); $showForm = function ($error = null) use ($form, $commonName) { @@ -220,7 +224,7 @@ public function verifyIdentity(Request $request, $procedureId) $this->addFlash('error', $error); } - return ['commonName' => $commonName, 'form' => $form->createView()]; + return $this->render('vetting/verify_identity.html.twig', ['commonName' => $commonName, 'form' => $form->createView()]); }; if (!$form->isSubmitted() || !$form->isValid()) { @@ -232,7 +236,7 @@ public function verifyIdentity(Request $request, $procedureId) try { $vettingService->verifyIdentity($procedureId, $command); } catch (DomainException $e) { - $this->container->get('logger')->error( + $this->logger->error( "RA attempted to verify identity, but the vetting procedure does not allow it", ['exception' => $e, 'procedure' => $procedureId], ); @@ -251,7 +255,7 @@ public function verifyIdentity(Request $request, $procedureId) $logger->error('RA attempted to vet second factor, but the command failed'); if (in_array(VettingService::REGISTRATION_CODE_EXPIRED_ERROR, $vetting->getErrors())) { - $registrationCodeExpiredError = $this->getTranslator() + $registrationCodeExpiredError = $this->translator ->trans( 'ra.verify_identity.registration_code_expired', [ @@ -273,51 +277,13 @@ public function verifyIdentity(Request $request, $procedureId) } } - /** - * @Template - */ - public function vettingCompleted() - { - return []; - } - - /** - * @return SecondFactorService - */ - private function getSecondFactorService() + public function vettingCompleted(): Response { - return $this->container->get('ra.service.second_factor'); + return $this->render('vetting/vetting_completed.html.twig'); } - /** - * @return SecondFactorTypeService - */ - private function getSecondFactorTypeService() - { - return $this->container->get('surfnet_stepup.service.second_factor_type'); - } - - /** - * @return VettingService - */ - private function getVettingService() - { - return $this->container->get('ra.service.vetting'); - } - - /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity - */ - private function getIdentity() + private function getIdentity(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } - - /** - * @return TranslatorInterface - */ - private function getTranslator() - { - return $this->container->get('translator'); - } } From 4be8acb09945537181674ee701ba583397f6a62f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:01:50 +0100 Subject: [PATCH 040/202] DI and types --- config/services.yaml | 4 + .../Controller/ExceptionController.php | 2 +- .../Controller/RecoveryTokenController.php | 6 +- .../Controller/SecondFactorController.php | 99 ++++++++----------- .../Controller/Vetting/SmsController.php | 1 - .../Controller/VettingTypeHintController.php | 10 +- .../RaBundle/EventListener/LocaleListener.php | 2 +- .../RaBundle/Resources/config/services.yml | 14 ++- .../RaBundle/Service/GlobalViewParameters.php | 2 +- .../Resources/config/services.yml | 7 ++ 10 files changed, 75 insertions(+), 72 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 95f234a0..f932a96d 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -11,6 +11,10 @@ services: autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. public: true + Surfnet\StepupRa\RaBundle\Controller\: + resource: '../src/Surfnet/StepupRa/RaBundle/Controller/*' + tags: [ 'controller.service_arguments' ] + twig.extension.text: # Required by JMSTranslationBundle class: Twig_Extensions_Extension_Text tags: [{ name: twig.extension }] diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php index 1903538a..8b6645b6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php @@ -31,7 +31,7 @@ final class ExceptionController extends BaseExceptionController * @param Exception $exception * @return array View parameters 'title' and 'description' */ - protected function getPageTitleAndDescription(Exception $exception) + protected function getPageTitleAndDescription(Exception $exception): array { $translator = $this->getTranslator(); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 5c2ad1bd..9b9d4b2e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -18,14 +18,12 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Knp\Component\Pager\Paginator; +use Knp\Component\Pager\PaginatorInterface; use Psr\Log\LoggerInterface; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\RevokeRecoveryTokenCommand; -use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; use Surfnet\StepupRa\RaBundle\Command\SearchRecoveryTokensCommand; use Surfnet\StepupRa\RaBundle\Form\Type\RevokeRecoveryTokenType; -use Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRecoveryTokensType; use Surfnet\StepupRa\RaBundle\Service\RecoveryTokenService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -38,7 +36,7 @@ final class RecoveryTokenController extends AbstractController { public function __construct( private readonly RecoveryTokenService $recoveryTokenService, - private readonly Paginator $paginator, + private readonly PaginatorInterface $paginator, private readonly TokenStorageInterface $tokenStorage, private readonly LoggerInterface $logger, ) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 230c8088..dc39f7ba 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -18,19 +18,24 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Knp\Component\Pager\Paginator; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Knp\Component\Pager\PaginatorInterface; +use Psr\Log\LoggerInterface; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\ExportRaSecondFactorsCommand; use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; use Surfnet\StepupRa\RaBundle\Command\SearchRaSecondFactorsCommand; use Surfnet\StepupRa\RaBundle\Command\SearchSecondFactorAuditLogCommand; use Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaSecondFactorsType; +use Surfnet\StepupRa\RaBundle\Service\AuditLogService; +use Surfnet\StepupRa\RaBundle\Service\IdentityService; +use Surfnet\StepupRa\RaBundle\Service\RaSecondFactorService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Security\Core\User\UserProviderInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) By making the Form Type classes explicit, MD now realizes couping @@ -38,12 +43,22 @@ */ final class SecondFactorController extends AbstractController { + public function __construct( + private readonly PaginatorInterface $paginator, + private readonly LoggerInterface $logger, + private readonly RaSecondFactorService $secondFactorService, + private readonly UserProviderInterface $identityService, + private readonly AuditLogService $auditLogService, + ) + { + } + public function search(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); $identity = $this->getCurrentUser(); - $this->container->get('logger')->notice('Starting search for second factors'); + $this->logger->notice('Starting search for second factors'); $command = new SearchRaSecondFactorsCommand(); $command->actorId = $identity->id; @@ -51,7 +66,7 @@ public function search(Request $request): Response $command->orderBy = $request->get('orderBy'); $command->orderDirection = $request->get('orderDirection'); - $secondFactors = $this->getSecondFactorService()->search($command); + $secondFactors = $this->secondFactorService->search($command); // The options that will populate the institution filter choice list. $command->institutionFilterOptions = $secondFactors->getFilterOption('institution'); @@ -62,15 +77,15 @@ public function search(Request $request): Response ]); $form->handleRequest($request); - $secondFactors = $this->getSecondFactorService()->search($command); + $secondFactors = $this->secondFactorService->search($command); $secondFactorCount = $secondFactors->getTotalItems(); if ($form->isSubmitted() && $form->getClickedButton()->getName() == 'export') { - $this->container->get('logger')->notice('Forwarding to export second factors action'); + $this->logger->notice('Forwarding to export second factors action'); return $this->forward('\Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::export', ['command' => $command]); } - $pagination = $this->getPaginator()->paginate( + $pagination = $this->paginator->paginate( $secondFactors->getElements(), $secondFactors->getCurrentPage(), $secondFactors->getItemsPerPage(), @@ -79,7 +94,7 @@ public function search(Request $request): Response $revocationForm = $this->createForm(RevokeSecondFactorType::class, new RevokeSecondFactorCommand()); - $this->container->get('logger')->notice(sprintf( + $this->logger->notice(sprintf( 'Searching for second factors yielded "%d" results', $secondFactors->getTotalItems(), )); @@ -100,20 +115,18 @@ public function export(SearchRaSecondFactorsCommand $command): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->container->get('logger')->notice('Starting export of searched second factors'); + $this->logger->notice('Starting export of searched second factors'); $exportCommand = ExportRaSecondFactorsCommand::fromSearchCommand($command); - return $this->getSecondFactorService()->export($exportCommand); + return $this->secondFactorService->export($exportCommand); } public function revoke(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('logger'); - - $logger->notice('Received request to revoke Second Factor'); + $this->logger->notice('Received request to revoke Second Factor'); $command = new RevokeSecondFactorCommand(); $command->currentUserId = $this->getCurrentUser()->id; @@ -121,7 +134,7 @@ public function revoke(Request $request): RedirectResponse $form = $this->createForm(RevokeSecondFactorType::class, $command); $form->handleRequest($request); - $logger->info(sprintf( + $this->logger->info(sprintf( 'Sending middleware request to revoke Second Factor "%s" belonging to "%s" on behalf of "%s"', $command->secondFactorId, $command->identityId, @@ -130,15 +143,15 @@ public function revoke(Request $request): RedirectResponse $translator = $this->container->get('translator'); $flashBag = $this->container->get('session')->getFlashBag(); - if ($this->getSecondFactorService()->revoke($command)) { - $logger->notice('Second Factor revocation Succeeded'); + if ($this->secondFactorService->revoke($command)) { + $this->logger->notice('Second Factor revocation Succeeded'); $flashBag->add('success', $translator->trans('ra.second_factor.revocation.revoked')); } else { - $logger->notice('Second Factor revocation Failed'); + $this->logger->notice('Second Factor revocation Failed'); $flashBag->add('error', $translator->trans('ra.second_factor.revocation.could_not_revoke')); } - $logger->notice('Redirecting back to Second Factor Search Page'); + $this->logger->notice('Redirecting back to Second Factor Search Page'); return $this->redirectToRoute('ra_second_factors_search'); } @@ -146,15 +159,14 @@ public function revoke(Request $request): RedirectResponse public function auditLog(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('logger'); $identityId = $request->get('identityId'); - $logger->notice(sprintf('Requested AuditLog for SecondFactors of identity "%s"', $identityId)); + $this->logger->notice(sprintf('Requested AuditLog for SecondFactors of identity "%s"', $identityId)); - $identity = $this->getIdentityService()->findById($identityId); + $identity = $this->identityService->findById($identityId); if (!$identity) { - $logger->notice(sprintf( + $this->logger->notice(sprintf( 'User with Identity "%s" requested non-existent identity "%s"', $this->getCurrentUser()->id, $identityId, @@ -163,7 +175,7 @@ public function auditLog(Request $request): Response throw new NotFoundHttpException(); } - $logger->info(sprintf('Retrieving audit log for Identity "%s"', $identity->id)); + $this->logger->info(sprintf('Retrieving audit log for Identity "%s"', $identity->id)); $command = new SearchSecondFactorAuditLogCommand(); $command->identityId = $identity->id; @@ -172,15 +184,15 @@ public function auditLog(Request $request): Response $command->orderBy = $request->get('orderBy', 'recordedOn'); $command->orderDirection = $request->get('orderDirection', 'desc'); - $auditLog = $this->getAuditLogService()->getAuditlog($command); - $pagination = $this->getPaginator()->paginate( + $auditLog = $this->auditLogService->getAuditlog($command); + $pagination = $this->paginator->paginate( $auditLog->getElements(), $auditLog->getCurrentPage(), $auditLog->getItemsPerPage(), ); $pagination->setTotalItemCount($auditLog->getTotalItems()); - $logger->notice(sprintf('Audit log yielded "%d" results, rendering page', $auditLog->getTotalItems())); + $this->logger->notice(sprintf('Audit log yielded "%d" results, rendering page', $auditLog->getTotalItems())); return $this->render( 'second_factor/audit_log.html.twig', @@ -193,42 +205,11 @@ public function auditLog(Request $request): Response } /** - * @return \Surfnet\StepupRa\RaBundle\Service\RaSecondFactorService - */ - private function getSecondFactorService() - { - return $this->container->get('ra.service.ra_second_factor'); - } - - /** - * @return \Surfnet\StepupRa\RaBundle\Service\IdentityService + * @return Identity */ - private function getIdentityService() - { - return $this->container->get('ra.service.identity'); - } - - /** - * @return \Surfnet\StepupRa\RaBundle\Service\AuditLogService - */ - private function getAuditLogService() - { - return $this->container->get('ra.service.audit_log'); - } - - /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity - */ - private function getCurrentUser() + private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } - /** - * @return Paginator - */ - private function getPaginator() - { - return $this->container->get('knp_paginator'); - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index c0efcd6b..1041d81e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -33,7 +33,6 @@ class SmsController extends SecondFactorController { - public function __construct( private readonly VettingService $vettingService, ) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index 3af98461..faa846fa 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -33,15 +33,17 @@ class VettingTypeHintController extends AbstractController { +// private readonly array $locales; + public function __construct( - private readonly LoggerInterface $logger, + private readonly LoggerInterface $logger, private readonly InstitutionListingService $institutionListingService, - private readonly ProfileService $profileService, - private readonly VettingTypeHintService $vettingTypeHintService, + private readonly ProfileService $profileService, + private readonly VettingTypeHintService $vettingTypeHintService, /** * @var string[] */ - private array $locales, + private readonly array $locales = [], ) { } diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php index 7d9e1a68..077e79f7 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php @@ -23,7 +23,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use InvalidArgumentException; final readonly class LocaleListener implements EventSubscriberInterface diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index faae871b..6280b78b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -122,6 +122,8 @@ services: - "@ra.service.identity" - "@surfnet_stepup.service.second_factor_type" - "@surfnet_stepup_middleware_client.identity.service.second_factor" + Surfnet\StepupRa\RaBundle\Service\VettingService: + alias: ra.service.vetting ra.service.yubikey: public: false @@ -161,6 +163,8 @@ services: arguments: - "@surfnet_stepup_middleware_client.identity.service.audit_log" - "@logger" + Surfnet\StepupRa\RaBundle\Service\AuditLogService: + alias: ra.service.audit_log ra.service.identity: class: Surfnet\StepupRa\RaBundle\Service\IdentityService @@ -213,6 +217,8 @@ services: - "@ra.service.command" - "@ra.service.ra_second_factor_exporter" - "@logger" + Surfnet\StepupRa\RaBundle\Service\RaSecondFactorService: + alias: ra.service.ra_second_factor ra.service.ra: class: Surfnet\StepupRa\RaBundle\Service\RaService @@ -225,6 +231,8 @@ services: arguments: - "@surfnet_stepup_middleware_client.identity.service.second_factor" - "@logger" + Surfnet\StepupRa\RaBundle\Service\SecondFactorService: + alias: ra.service.second_factor ra.service.global_view_parameters: class: Surfnet\StepupRa\RaBundle\Service\GlobalViewParameters @@ -238,11 +246,15 @@ services: arguments: - "@surfnet_stepup_middleware_client.identity.service.profile" - "@logger" + Surfnet\StepupRa\RaBundle\Service\ProfileService: + alias: ra.service.profile ra.service.institution_listing: class: Surfnet\StepupRa\RaBundle\Service\InstitutionListingService arguments: - "@surfnet_stepup_middleware_client.identity.service.institution_listing" + Surfnet\StepupRa\RaBundle\Service\InstitutionListingService: + alias: ra.service.institution_listing Surfnet\StepupRa\RaBundle\Service\RecoveryTokenService: arguments: @@ -260,7 +272,7 @@ services: ra.repository.vetting_procedure: class: Surfnet\StepupRa\RaBundle\Repository\SessionVettingProcedureRepository arguments: - - "@session" + - "@request_stack" - 'Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository' #Logger diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php index 0816d820..2775c63f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php @@ -19,7 +19,7 @@ namespace Surfnet\StepupRa\RaBundle\Service; use Surfnet\StepupRa\RaBundle\Assert; -use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; final class GlobalViewParameters { diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index 8d6aa8cc..07008d2a 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -1,7 +1,14 @@ services: + _defaults: + autowire: true + autoconfigure: true + public: true + gssp.provider_repository: public: true class: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository + Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository: + alias: gssp.provider_repository gssp.sessionbag: class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag From 611787ce3000231bf2b8e11ecb9f0b58008d1e0f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:16:04 +0100 Subject: [PATCH 041/202] DI and types --- .../Controller/RaManagementController.php | 106 +++++++----------- 1 file changed, 43 insertions(+), 63 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index d881a97b..77edd0fd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -18,6 +18,8 @@ namespace Surfnet\StepupRa\RaBundle\Controller; +use Knp\Component\Pager\PaginatorInterface; +use Psr\Log\LoggerInterface; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateInstitution; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListing; use Surfnet\StepupRa\RaBundle\Command\AccreditCandidateCommand; @@ -30,6 +32,7 @@ use Surfnet\StepupRa\RaBundle\Form\Type\RetractRegistrationAuthorityType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaCandidatesType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaListingType; +use Surfnet\StepupRa\RaBundle\Service\RaCandidateService; use Surfnet\StepupRa\RaBundle\Service\RaListingService; use Surfnet\StepupRa\RaBundle\Value\RoleAtInstitution; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -43,19 +46,25 @@ */ class RaManagementController extends AbstractController { + public function __construct( + private readonly LoggerInterface $logger, + private readonly RaListingService $raListingService, + private readonly RaCandidateService $raCandidateService, + private readonly PaginatorInterface $paginator, + ) + { + } + public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->container->get('logger'); $institution = $this->getUser()->institution; - $logger->notice(sprintf('Loading overview of RA(A)s for institution "%s"', $institution)); + $this->logger->notice(sprintf('Loading overview of RA(A)s for institution "%s"', $institution)); $identity = $this->getCurrentUser(); - $service = $this->getRaListingService(); - $command = new SearchRaListingCommand(); $command->actorId = $identity->id; $command->pageNumber = (int) $request->get('p', 1); @@ -63,23 +72,23 @@ public function manage(Request $request): Response $command->orderDirection = $request->get('orderDirection'); // The options that will populate the institution filter choice list. - $raList = $service->search($command); + $raList = $this->raListingService->search($command); $command->institutionFilterOptions = $raList->getFilterOption('institution'); $command->raInstitutionFilterOptions = $raList->getFilterOption('raInstitution'); $form = $this->createForm(SearchRaListingType::class, $command, ['method' => 'get']); $form->handleRequest($request); - $raList = $service->search($command); + $raList = $this->raListingService->search($command); - $pagination = $this->getPaginator()->paginate( + $pagination = $this->paginator->paginate( $raList->getTotalItems() > 0 ? $raList->getElements() : [], $raList->getCurrentPage(), $raList->getItemsPerPage(), ); $pagination->setTotalItemCount($raList->getTotalItems()); - $logger->notice(sprintf( + $this->logger->notice(sprintf( 'Searching for RA(A)s yielded "%d" results', $raList->getTotalItems(), )); @@ -102,14 +111,11 @@ public function raCandidateSearch(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - - $logger = $this->container->get('logger'); + $identity = $this->getCurrentUser(); $institution = $identity->institution; - $logger->notice(sprintf('Searching for RaCandidates within institution "%s"', $institution)); - - $service = $this->getRaCandidateService(); + $this->logger->notice(sprintf('Searching for RaCandidates within institution "%s"', $institution)); $command = new SearchRaCandidatesCommand(); $command->actorId = $identity->id; @@ -119,7 +125,7 @@ public function raCandidateSearch(Request $request): Response $command->orderBy = $request->get('orderBy'); $command->orderDirection = $request->get('orderDirection'); - $raCandidateList = $service->search($command); + $raCandidateList = $this->raCandidateService->search($command); // The options that will populate the institution filter choice list. $command->institutionFilterOptions = $raCandidateList->getFilterOption('institution'); @@ -127,16 +133,16 @@ public function raCandidateSearch(Request $request): Response $form = $this->createForm(SearchRaCandidatesType::class, $command, ['method' => 'get']); $form->handleRequest($request); - $raCandidateList = $service->search($command); + $raCandidateList = $this->raCandidateService->search($command); - $pagination = $this->getPaginator()->paginate( + $pagination = $this->paginator->paginate( $raCandidateList->getTotalItems() > 0 ? $raCandidateList->getElements() : [], $raCandidateList->getCurrentPage(), $raCandidateList->getItemsPerPage(), ); $pagination->setTotalItemCount($raCandidateList->getTotalItems()); - $logger->notice(sprintf( + $this->logger->notice(sprintf( 'Searching for RaCandidates within institution "%s" yielded "%s" results', $institution, $raCandidateList->getTotalItems(), @@ -156,15 +162,14 @@ public function createRa(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->container->get('logger'); - $logger->notice('Page for Accreditation of Identity to Ra or Raa requested'); + $this->logger->notice('Page for Accreditation of Identity to Ra or Raa requested'); $identityId = $request->get('identityId'); - $raCandidate = $this->getRaCandidateService()->getRaCandidate($identityId, $this->getUser()->id); + $raCandidate = $this->raCandidateService->getRaCandidate($identityId, $this->getUser()->id); if (!$raCandidate->raCandidate) { - $logger->warning(sprintf('RaCandidate based on identity "%s" not found', $identityId)); + $this->logger->warning(sprintf('RaCandidate based on identity "%s" not found', $identityId)); throw new NotFoundHttpException(); } @@ -180,9 +185,9 @@ public function createRa(Request $request): Response $form = $this->createForm(CreateRaType::class, $command)->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $logger->debug('Accreditation form submitted, start processing command'); + $this->logger->debug('Accreditation form submitted, start processing command'); - $success = $this->getRaCandidateService()->accreditCandidate($command); + $success = $this->raCandidateService->accreditCandidate($command); if ($success) { $this->addFlash( @@ -190,11 +195,11 @@ public function createRa(Request $request): Response $this->container->get('translator')->trans('ra.management.create_ra.identity_accredited'), ); - $logger->debug('Identity Accredited, redirecting to candidate overview'); + $this->logger->debug('Identity Accredited, redirecting to candidate overview'); return $this->redirectToRoute('ra_management_ra_candidate_search'); } - $logger->debug('Identity Accreditation failed, adding error to form'); + $this->logger->debug('Identity Accreditation failed, adding error to form'); $this->addFlash('error', 'ra.management.create_ra.error.middleware_command_failed'); } @@ -213,13 +218,12 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->container->get('logger'); - $logger->notice(sprintf("Loading information amendment form for RA(A) '%s'", $identityId)); + $this->logger->notice(sprintf("Loading information amendment form for RA(A) '%s'", $identityId)); - $raListing = $this->getRaListingService()->get($identityId, $raInstitution, $this->getUser()->id); + $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->id); if (!$raListing) { - $logger->warning(sprintf("RA listing for identity ID '%s' not found", $identityId)); + $this->logger->warning(sprintf("RA listing for identity ID '%s' not found", $identityId)); throw new NotFoundHttpException(sprintf("RA listing for identity ID '%s' not found", $identityId)); } @@ -231,16 +235,16 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution $form = $this->createForm(AmendRegistrationAuthorityInformationType::class, $command)->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $logger->notice(sprintf("RA(A) '%s' information amendment form submitted, processing", $identityId)); + $this->logger->notice(sprintf("RA(A) '%s' information amendment form submitted, processing", $identityId)); if ($this->container->get('ra.service.ra')->amendRegistrationAuthorityInformation($command)) { $this->addFlash('success', $this->container->get('translator')->trans('ra.management.amend_ra_info.info_amended')); - $logger->notice(sprintf("RA(A) '%s' information successfully amended", $identityId)); + $this->logger->notice(sprintf("RA(A) '%s' information successfully amended", $identityId)); return $this->redirectToRoute('ra_management_manage'); } - $logger->notice(sprintf("Information of RA(A) '%s' failed to be amended, informing user", $identityId)); + $this->logger->notice(sprintf("Information of RA(A) '%s' failed to be amended, informing user", $identityId)); $this->addFlash('error', 'ra.management.amend_ra_info.error.middleware_command_failed'); } @@ -259,13 +263,12 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->container->get('logger'); - $logger->notice(sprintf("Loading retract registration authority form for RA(A) '%s'", $identityId)); + $this->logger->notice(sprintf("Loading retract registration authority form for RA(A) '%s'", $identityId)); - $raListing = $this->getRaListingService()->get($identityId, $raInstitution, $this->getUser()->id); + $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->id); if (!$raListing) { - $logger->warning(sprintf("RA listing for identity ID '%s@%s' not found", $identityId, $this->getUser()->institution)); + $this->logger->warning(sprintf("RA listing for identity ID '%s@%s' not found", $identityId, $this->getUser()->institution)); throw new NotFoundHttpException(sprintf("RA listing for identity ID '%s' not found", $identityId)); } @@ -276,20 +279,20 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI $form = $this->createForm(RetractRegistrationAuthorityType::class, $command)->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { if ($form->get('button-group')->get('cancel')->isClicked()) { - $logger->notice('Retraction of registration authority cancelled'); + $this->logger->notice('Retraction of registration authority cancelled'); return $this->redirectToRoute('ra_management_manage'); } - $logger->notice(sprintf('Confirmed retraction of RA credentials for identity "%s"', $identityId)); + $this->logger->notice(sprintf('Confirmed retraction of RA credentials for identity "%s"', $identityId)); if ($this->container->get('ra.service.ra')->retractRegistrationAuthority($command)) { - $logger->notice(sprintf('Registration authority for identity "%s" retracted', $identityId)); + $this->logger->notice(sprintf('Registration authority for identity "%s" retracted', $identityId)); $this->addFlash('success', $this->container->get('translator')->trans('ra.management.retract_ra.success')); return $this->redirectToRoute('ra_management_manage'); } - $logger->notice(sprintf( + $this->logger->notice(sprintf( 'Could not retract Registration Authority credentials for identity "%s"', $identityId, )); @@ -302,22 +305,6 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI ]); } - /** - * @return RaListingService - */ - private function getRaListingService() - { - return $this->container->get('ra.service.ra_listing'); - } - - /** - * @return \Surfnet\StepupRa\RaBundle\Service\RaCandidateService - */ - private function getRaCandidateService() - { - return $this->container->get('ra.service.ra_candidate'); - } - /** * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity */ @@ -326,11 +313,4 @@ private function getCurrentUser() return $this->container->get('security.token_storage')->getToken()->getUser(); } - /** - * @return \Knp\Component\Pager\Paginator - */ - private function getPaginator() - { - return $this->container->get('knp_paginator'); - } } From 2281de931cf43a15f284a589ba4ec1c9229b1668 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:16:39 +0100 Subject: [PATCH 042/202] DI and types --- .../StepupRa/RaBundle/Controller/RecoveryTokenController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 9b9d4b2e..90bc812f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -47,7 +47,7 @@ public function search(Request $request): Response $this->denyAccessUnlessGranted('ROLE_RA'); $identity = $this->getCurrentUser(); - $this->container->get('logger')->notice('Starting search for recovery tokens'); + $this->logger->notice('Starting search for recovery tokens'); $command = new SearchRecoveryTokensCommand(); $command->actorId = $identity->id; From d6de1a90b25f6c61777e44a4f18a36aaff8246ff Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:16:43 +0100 Subject: [PATCH 043/202] DI and types --- src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index 6280b78b..5b551a4c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -191,6 +191,8 @@ services: - "@ra.service.command" - "@logger" - "@surfnet_stepup.service.second_factor_type" + Surfnet\StepupRa\RaBundle\Service\RaCandidateService: + alias: ra.service.ra_candidate ra.service.ra_location: class: Surfnet\StepupRa\RaBundle\Service\RaLocationService @@ -198,12 +200,16 @@ services: - "@surfnet_stepup_middleware_client.configuration.service.ra_location" - "@ra.service.command" - "@logger" + Surfnet\StepupRa\RaBundle\Service\RaLocationService: + alias: ra.service.ra_location ra.service.ra_listing: class: Surfnet\StepupRa\RaBundle\Service\RaListingService arguments: - "@surfnet_stepup_middleware_client.identity.service.ra_listing" - "@logger" + Surfnet\StepupRa\RaBundle\Service\RaListingService: + alias: ra.service.ra_listing ra.service.ra_second_factor_exporter: class: Surfnet\StepupRa\RaBundle\Service\RaSecondFactorExport From aa3fe53371b88dd5cb76bf311c74ccb71b0143d3 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:23:10 +0100 Subject: [PATCH 044/202] DI and types --- .../Controller/RaLocationController.php | 72 +++++++++---------- 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index e2d5f71e..399d0cff 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -18,6 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Controller; +use Psr\Log\LoggerInterface; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\ChangeRaLocationCommand; use Surfnet\StepupRa\RaBundle\Command\CreateRaLocationCommand; @@ -43,6 +44,15 @@ */ final class RaLocationController extends AbstractController { + public function __construct( + private readonly RaLocationService $raLocationService, + private readonly InstitutionListingService $institutionListingService, + private readonly ProfileService $profileService, + private readonly LoggerInterface $logger, + ) + { + } + public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -50,13 +60,13 @@ public function manage(Request $request): Response $institutionParameter = $request->get('institution'); $identity = $this->getCurrentUser(); - $this->container->get('logger')->notice('Starting search for locations'); + $this->logger->notice('Starting search for locations'); - $profile = $this->getProfileService()->findByIdentityId($identity->id); + $profile = $this->profileService->findByIdentityId($identity->id); if ($this->isGranted('ROLE_SRAA')) { $institution = $identity->institution; - $choices = $this->getInstitutionListingService()->getAll(); + $choices = $this->institutionListingService->getAll(); } else { $choices = $profile->getRaaInstitutions(); $institution = reset($choices); @@ -85,11 +95,11 @@ public function manage(Request $request): Response $command->orderBy = $request->get('orderBy'); $command->orderDirection = $request->get('orderDirection'); - $locations = $this->getRaLocationService()->search($command); + $locations = $this->raLocationService->search($command); $removalForm = $this->createForm(RemoveRaLocationType::class, new RemoveRaLocationCommand()); - $this->container->get('logger')->notice(sprintf( + $this->logger->notice(sprintf( 'Searching for RA locations yielded "%d" results', $locations->getTotalItems(), )); @@ -108,7 +118,6 @@ public function manage(Request $request): Response public function create(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('logger'); $institution = $request->get('institution'); @@ -120,9 +129,9 @@ public function create(Request $request): Response $form = $this->createForm(CreateRaLocationType::class, $command)->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $logger->debug('RA Location form submitted, start processing command'); + $this->logger->debug('RA Location form submitted, start processing command'); - $success = $this->getRaLocationService()->create($command); + $success = $this->raLocationService->create($command); if ($success) { $this->addFlash( @@ -130,11 +139,11 @@ public function create(Request $request): Response $this->container->get('translator')->trans('ra.create_ra_location.created'), ); - $logger->debug('RA Location added, redirecting to the RA location overview'); + $this->logger->debug('RA Location added, redirecting to the RA location overview'); return $this->redirectToRoute('ra_locations_manage', ['institution' => $command->institution]); } - $logger->debug('RA Location creation failed, adding error to form'); + $this->logger->debug('RA Location creation failed, adding error to form'); $this->addFlash('error', 'ra.create_ra_location.error.middleware_command_failed'); } @@ -146,13 +155,12 @@ public function create(Request $request): Response public function change(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('logger'); $requestedLocationId = $request->get('locationId'); - $raLocation = $this->getRaLocationService()->find($requestedLocationId); + $raLocation = $this->raLocationService->find($requestedLocationId); if (!$raLocation) { - $logger->warning(sprintf('RaLocation for id "%s" not found', $requestedLocationId)); + $this->logger->warning(sprintf('RaLocation for id "%s" not found', $requestedLocationId)); throw new NotFoundHttpException(); } @@ -169,9 +177,9 @@ public function change(Request $request): Response $form = $this->createForm(ChangeRaLocationType::class, $command)->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $logger->debug('RA Location form submitted, start processing command'); + $this->logger->debug('RA Location form submitted, start processing command'); - $success = $this->getRaLocationService()->change($command); + $success = $this->raLocationService->change($command); if ($success) { $this->addFlash( @@ -179,11 +187,11 @@ public function change(Request $request): Response $this->container->get('translator')->trans('ra.create_ra_location.changed'), ); - $logger->debug('RA Location added, redirecting to the RA location overview'); + $this->logger->debug('RA Location added, redirecting to the RA location overview'); return $this->redirectToRoute('ra_locations_manage', ['institution' => $command->institution]); } - $logger->debug('RA Location creation failed, adding error to form'); + $this->logger->debug('RA Location creation failed, adding error to form'); $this->addFlash('error', 'ra.create_ra_location.error.middleware_command_failed'); } @@ -196,9 +204,7 @@ public function remove(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('logger'); - - $logger->notice('Received request to remove RA location'); + $this->logger->notice('Received request to remove RA location'); $command = new RemoveRaLocationCommand(); $command->currentUserId = $this->getCurrentUser()->id; @@ -206,7 +212,7 @@ public function remove(Request $request): RedirectResponse $form = $this->createForm(RemoveRaLocationType::class, $command); $form->handleRequest($request); - $logger->info(sprintf( + $this->logger->info(sprintf( 'Sending middleware request to remove RA location "%s" belonging to "%s" on behalf of "%s"', $command->locationId, $command->institution, @@ -215,36 +221,22 @@ public function remove(Request $request): RedirectResponse $translator = $this->container->get('translator'); $flashBag = $this->container->get('session')->getFlashBag(); - if ($this->getRaLocationService()->remove($command)) { - $logger->notice('RA Location removal Succeeded'); - $flashBag->add('success', $translator->trans('ra.ra_location.revocation.removed')); + if ($this->raLocationService->remove($command)) { + $this->logger->notice('RA Location removal Succeeded'); + $this->addFlash('success', $translator->trans('ra.ra_location.revocation.removed')); } else { - $logger->notice('RA Location removal Failed'); + $this->logger->notice('RA Location removal Failed'); $flashBag->add('error', $translator->trans('ra.ra_location.revocation.could_not_remove')); } - $logger->notice('Redirecting back to RA Location Manage Page'); + $this->logger->notice('Redirecting back to RA Location Manage Page'); return $this->redirectToRoute('ra_locations_manage', ['institution' => $command->institution]); } - private function getRaLocationService(): RaLocationService - { - return $this->container->get('ra.service.ra_location'); - } - private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } - private function getProfileService(): ProfileService - { - return $this->container->get('ra.service.profile'); - } - - private function getInstitutionListingService(): InstitutionListingService - { - return $this->container->get('ra.service.institution_listing'); - } } From 7ba92f1ddd3ea1985db2d5470f5368c825553e31 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:24:44 +0100 Subject: [PATCH 045/202] DI and types --- .../RaBundle/Controller/ProfileController.php | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index a2282e8d..03812441 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -18,27 +18,26 @@ namespace Surfnet\StepupRa\RaBundle\Controller; +use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Service\ProfileService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; final class ProfileController extends AbstractController { - public function profile() + public function __construct( + private readonly ProfileService $profileService, + private readonly LoggerInterface $logger, + ) { - $logger = $this->container->get('logger'); + } - $logger->notice('Opening profile page'); + public function profile() + { + $this->logger->notice('Opening profile page'); $identity = $this->getUser(); - $profile = $this->getProfileService()->findByIdentityId($identity->id); + $profile = $this->profileService->findByIdentityId($identity->id); return $this->render('profile/profile.html.twig', ['profile' => $profile]); } - /** - * @return ProfileService - */ - private function getProfileService() - { - return $this->container->get('ra.service.profile'); - } } From 22f7d448d55db5473d11e135423e46c06f684713 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:30:44 +0100 Subject: [PATCH 046/202] DI and types --- .../RaBundle/Controller/RaaController.php | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index 25ec2737..ac2ab452 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -18,6 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Controller; +use Psr\Log\LoggerInterface; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Service\InstitutionListingService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; @@ -26,23 +27,33 @@ use Surfnet\StepupRa\RaBundle\Service\InstitutionConfigurationOptionsService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class RaaController extends AbstractController { - public function institutionConfiguration(Request $request) + public function __construct( + private readonly InstitutionConfigurationOptionsService $institutionConfigurationOptionsService, + private readonly ProfileService $profileService, + private readonly InstitutionListingService $institutionListingService, + private readonly LoggerInterface $logger, + ) + { + } + + public function institutionConfiguration(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); - $logger = $this->container->get('logger'); /** @var Identity $identity */ $identity = $this->getUser(); - $profile = $this->getProfileService()->findByIdentityId($identity->id); + $profile = $this->profileService->findByIdentityId($identity->id); if ($this->isGranted('ROLE_SRAA')) { $institution = $identity->institution; - $choices = $this->getInstitutionListingService()->getAll(); + $choices = $this->institutionListingService->getAll(); } else { $choices = $profile->getRaaInstitutions(); $institution = reset($choices); @@ -62,15 +73,15 @@ public function institutionConfiguration(Request $request) } } - $logger->notice(sprintf('Opening the institution configuration for "%s"', $institution)); + $this->logger->notice(sprintf('Opening the institution configuration for "%s"', $institution)); // Load the configuration for the institution that was selected. - $configuration = $this->getInstitutionConfigurationOptionsService() + $configuration = $this->institutionConfigurationOptionsService ->getInstitutionConfigurationOptionsFor($institution); if (!$configuration) { - $logger->warning(sprintf('Unable to find the institution configuration for "%s"', $institution)); - return $this->createNotFoundException('The institution configuration could not be found'); + $this->logger->warning(sprintf('Unable to find the institution configuration for "%s"', $institution)); + throw new NotFoundHttpException('The institution configuration could not be found'); } return $this->render( @@ -82,28 +93,4 @@ public function institutionConfiguration(Request $request) ], ); } - - /** - * @return InstitutionConfigurationOptionsService - */ - private function getInstitutionConfigurationOptionsService() - { - return $this->container->get('ra.service.institution_configuration_options'); - } - - /** - * @return ProfileService - */ - private function getProfileService() - { - return $this->container->get('ra.service.profile'); - } - - /** - * @return InstitutionListingService - */ - private function getInstitutionListingService() - { - return $this->container->get('ra.service.institution_listing'); - } } From 2827c2ca25aded325904ffcad38cef2bc78c848f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:31:13 +0100 Subject: [PATCH 047/202] DI and types --- src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php | 3 ++- src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index 03812441..3ea0f8f5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -21,6 +21,7 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Service\ProfileService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Response; final class ProfileController extends AbstractController { @@ -31,7 +32,7 @@ public function __construct( { } - public function profile() + public function profile(): Response { $this->logger->notice('Opening profile page'); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index 5b551a4c..b32b709d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -178,6 +178,8 @@ services: class: Surfnet\StepupRa\RaBundle\Service\InstitutionConfigurationOptionsService arguments: - "@surfnet_stepup_middleware_client.configuration.service.institution_configuration_options" + Surfnet\StepupRa\RaBundle\Service\InstitutionConfigurationOptionsService: + alias: ra.service.institution_configuration_options ra.service.locale_provider: class: Surfnet\StepupRa\RaBundle\Service\LocaleProviderService From d5055aae0025bac5d3d9e6fcf42cd26f75f0f238 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:36:53 +0100 Subject: [PATCH 048/202] DI and types --- .../RaBundle/Controller/LocaleController.php | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 6832a9be..c4940abc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -21,14 +21,25 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Command\SwitchLocaleCommand; use Surfnet\StepupBundle\Form\Type\SwitchLocaleType; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; +use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\Security\Core\User\UserProviderInterface; final class LocaleController extends AbstractController { - public function switchLocale(Request $request) + public function __construct( + private readonly LoggerInterface $logger, + private readonly UserProviderInterface $identityService, + ) + { + } + + public function switchLocale(Request $request): RedirectResponse { $returnUrl = $request->query->get('return-url'); @@ -36,7 +47,7 @@ public function switchLocale(Request $request) // @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878 $domain = $request->getSchemeAndHttpHost() . '/'; if (!str_starts_with($returnUrl, $domain)) { - $this->container->get('logger')->error(sprintf( + $this->logger->error(sprintf( 'Identity "%s" used illegal return-url for redirection after changing locale, aborting request', $this->getIdentity()->id, )); @@ -44,9 +55,7 @@ public function switchLocale(Request $request) throw new BadRequestHttpException('Invalid return-url given'); } - /** @var LoggerInterface $logger */ - $logger = $this->container->get('logger'); - $logger->info('Switching locale...'); + $this->logger->info('Switching locale...'); $identity = $this->getIdentity(); if (!$identity) { @@ -65,26 +74,22 @@ public function switchLocale(Request $request) if ($form->isSubmitted() && !$form->isValid()) { $this->addFlash('error', $this->container->get('translator')->trans('ra.flash.invalid_switch_locale_form')); - $logger->error('The switch locale form unexpectedly contained invalid data'); + $this->logger->error('The switch locale form unexpectedly contained invalid data'); return $this->redirect($returnUrl); } - $service = $this->container->get('ra.service.identity'); - if (!$service->switchLocale($command)) { + if (!$this->identityService->switchLocale($command)) { $this->addFlash('error', $this->container->get('translator')->trans('ra.flash.error_while_switching_locale')); - $logger->error('An error occurred while switching locales'); + $this->logger->error('An error occurred while switching locales'); return $this->redirect($returnUrl); } - $logger->info('Successfully switched locale'); + $this->logger->info('Successfully switched locale'); return $this->redirect($returnUrl); } - /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity - */ - private function getIdentity() + private function getIdentity(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } From 813f65ea9af0b1f6fdf1a9c3f9c1fd14c89cdb29 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 12:46:19 +0100 Subject: [PATCH 049/202] DI and types --- .../RaBundle/Controller/SamlController.php | 22 ++++++++++++------- .../RaBundle/Service/ProfileService.php | 8 +------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index a9215565..72f57704 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -18,24 +18,32 @@ namespace Surfnet\StepupRa\RaBundle\Controller; +use Surfnet\SamlBundle\Entity\IdentityProvider; use Surfnet\SamlBundle\Http\PostBinding; use Surfnet\SamlBundle\Http\XMLResponse; use Surfnet\SamlBundle\Metadata\MetadataFactory; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Surfnet\SamlBundle\Entity\ServiceProvider; class SamlController extends AbstractController { + public function __construct( + private readonly PostBinding $postBinding, + private readonly IdentityProvider $remoteIdp, + private readonly ServiceProvider $hostedServiceProvider, + private readonly MetadataFactory $metadataFactory, + ) { + } + public function consumeAssertion(Request $httpRequest): Response { - /** @var PostBinding $postBinding */ - $postBinding = $this->container->get('surfnet_saml.http.post_binding'); - $assertion = $postBinding->processResponse( + $assertion = $this->postBinding->processResponse( $httpRequest, - $this->container->get('surfnet_saml.remote.idp'), - $this->container->get('surfnet_saml.hosted.service_provider'), + $this->remoteIdp, + $this->hostedServiceProvider, ); return $this->render( 'saml/consume_assertion.html.twig', @@ -45,9 +53,7 @@ public function consumeAssertion(Request $httpRequest): Response public function metadata(): XMLResponse { - /** @var MetadataFactory $metadataFactory */ - $metadataFactory = $this->container->get('surfnet_saml.metadata_factory'); - return new XMLResponse($metadataFactory->generate()); + return new XMLResponse($this->metadataFactory->generate()); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php index a19fca95..8b533307 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php @@ -26,15 +26,9 @@ class ProfileService { public function __construct( private readonly ApiProfileService $apiProfileService, - private readonly LoggerInterface $logger, ) { } - - /** - * @param string $identityId - * @return null|Profile - */ - public function findByIdentityId($identityId) + public function findByIdentityId(string $identityId): ?Profile { return $this->apiProfileService->get($identityId); } From 6b9cf752466ae56c8557077a53d3fad870c1afa6 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:02:55 +0100 Subject: [PATCH 050/202] DI and types --- .../RaBundle/Controller/LocaleController.php | 6 ++++-- .../Controller/RaLocationController.php | 12 ++++++------ .../Controller/RaManagementController.php | 18 ++++++++++-------- .../Controller/SecondFactorController.php | 8 ++++---- .../Vetting/SecondFactorController.php | 14 +++++++++----- .../Controller/Vetting/SmsController.php | 4 +++- .../RaBundle/Controller/VettingController.php | 4 ++-- .../RaBundle/Resources/config/services.yml | 2 ++ .../RaBundle/SurfnetStepupRaRaBundle.php | 5 +++-- 9 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index c4940abc..49598a62 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -29,12 +29,14 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; final class LocaleController extends AbstractController { public function __construct( private readonly LoggerInterface $logger, private readonly UserProviderInterface $identityService, + private readonly TranslatorInterface $translator, ) { } @@ -73,13 +75,13 @@ public function switchLocale(Request $request): RedirectResponse $form->handleRequest($request); if ($form->isSubmitted() && !$form->isValid()) { - $this->addFlash('error', $this->container->get('translator')->trans('ra.flash.invalid_switch_locale_form')); + $this->addFlash('error', $this->translator->trans('ra.flash.invalid_switch_locale_form')); $this->logger->error('The switch locale form unexpectedly contained invalid data'); return $this->redirect($returnUrl); } if (!$this->identityService->switchLocale($command)) { - $this->addFlash('error', $this->container->get('translator')->trans('ra.flash.error_while_switching_locale')); + $this->addFlash('error', $this->translator->trans('ra.flash.error_while_switching_locale')); $this->logger->error('An error occurred while switching locales'); return $this->redirect($returnUrl); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index 399d0cff..c36bb916 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -37,6 +37,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) By making the Form Type classes explicit, MD now realizes couping @@ -49,6 +50,7 @@ public function __construct( private readonly InstitutionListingService $institutionListingService, private readonly ProfileService $profileService, private readonly LoggerInterface $logger, + private readonly TranslatorInterface $translator, ) { } @@ -136,7 +138,7 @@ public function create(Request $request): Response if ($success) { $this->addFlash( 'success', - $this->container->get('translator')->trans('ra.create_ra_location.created'), + $this->translator->trans('ra.create_ra_location.created'), ); $this->logger->debug('RA Location added, redirecting to the RA location overview'); @@ -184,7 +186,7 @@ public function change(Request $request): Response if ($success) { $this->addFlash( 'success', - $this->container->get('translator')->trans('ra.create_ra_location.changed'), + $this->translator->trans('ra.create_ra_location.changed'), ); $this->logger->debug('RA Location added, redirecting to the RA location overview'); @@ -219,14 +221,12 @@ public function remove(Request $request): RedirectResponse $command->currentUserId, )); - $translator = $this->container->get('translator'); - $flashBag = $this->container->get('session')->getFlashBag(); if ($this->raLocationService->remove($command)) { $this->logger->notice('RA Location removal Succeeded'); - $this->addFlash('success', $translator->trans('ra.ra_location.revocation.removed')); + $this->addFlash('success', $this->translator->trans('ra.ra_location.revocation.removed')); } else { $this->logger->notice('RA Location removal Failed'); - $flashBag->add('error', $translator->trans('ra.ra_location.revocation.could_not_remove')); + $this->addFlash('error', $this->translator->trans('ra.ra_location.revocation.could_not_remove')); } $this->logger->notice('Redirecting back to RA Location Manage Page'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 77edd0fd..fe8198a9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -34,12 +34,13 @@ use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaListingType; use Surfnet\StepupRa\RaBundle\Service\RaCandidateService; use Surfnet\StepupRa\RaBundle\Service\RaListingService; +use Surfnet\StepupRa\RaBundle\Service\RaService; use Surfnet\StepupRa\RaBundle\Value\RoleAtInstitution; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -51,6 +52,8 @@ public function __construct( private readonly RaListingService $raListingService, private readonly RaCandidateService $raCandidateService, private readonly PaginatorInterface $paginator, + private readonly TranslatorInterface $translator, + private readonly RaService $raService, ) { } @@ -192,7 +195,7 @@ public function createRa(Request $request): Response if ($success) { $this->addFlash( 'success', - $this->container->get('translator')->trans('ra.management.create_ra.identity_accredited'), + $this->translator->trans('ra.management.create_ra.identity_accredited'), ); $this->logger->debug('Identity Accredited, redirecting to candidate overview'); @@ -237,8 +240,8 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution if ($form->isSubmitted() && $form->isValid()) { $this->logger->notice(sprintf("RA(A) '%s' information amendment form submitted, processing", $identityId)); - if ($this->container->get('ra.service.ra')->amendRegistrationAuthorityInformation($command)) { - $this->addFlash('success', $this->container->get('translator')->trans('ra.management.amend_ra_info.info_amended')); + if ($this->raService->amendRegistrationAuthorityInformation($command)) { + $this->addFlash('success', $this->translator->trans('ra.management.amend_ra_info.info_amended')); $this->logger->notice(sprintf("RA(A) '%s' information successfully amended", $identityId)); return $this->redirectToRoute('ra_management_manage'); @@ -257,9 +260,8 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution /** * @param $identityId * @param $raInstitution - * @return RedirectResponse|Response */ - public function retractRegistrationAuthority(Request $request, $identityId, $raInstitution) + public function retractRegistrationAuthority(Request $request, $identityId, $raInstitution): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); $this->denyAccessUnlessGranted('ROLE_SRAA'); @@ -285,10 +287,10 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI $this->logger->notice(sprintf('Confirmed retraction of RA credentials for identity "%s"', $identityId)); - if ($this->container->get('ra.service.ra')->retractRegistrationAuthority($command)) { + if ($this->raService->retractRegistrationAuthority($command)) { $this->logger->notice(sprintf('Registration authority for identity "%s" retracted', $identityId)); - $this->addFlash('success', $this->container->get('translator')->trans('ra.management.retract_ra.success')); + $this->addFlash('success', $this->translator->trans('ra.management.retract_ra.success')); return $this->redirectToRoute('ra_management_manage'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index dc39f7ba..0a72795e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -36,6 +36,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) By making the Form Type classes explicit, MD now realizes couping @@ -49,6 +50,7 @@ public function __construct( private readonly RaSecondFactorService $secondFactorService, private readonly UserProviderInterface $identityService, private readonly AuditLogService $auditLogService, + private readonly TranslatorInterface $translator, ) { } @@ -141,14 +143,12 @@ public function revoke(Request $request): RedirectResponse $command->currentUserId, )); - $translator = $this->container->get('translator'); - $flashBag = $this->container->get('session')->getFlashBag(); if ($this->secondFactorService->revoke($command)) { $this->logger->notice('Second Factor revocation Succeeded'); - $flashBag->add('success', $translator->trans('ra.second_factor.revocation.revoked')); + $this->addFlash('success', $this->translator->trans('ra.second_factor.revocation.revoked')); } else { $this->logger->notice('Second Factor revocation Failed'); - $flashBag->add('error', $translator->trans('ra.second_factor.revocation.could_not_revoke')); + $this->addFlash('error', $this->translator->trans('ra.second_factor.revocation.could_not_revoke')); } $this->logger->notice('Redirecting back to Second Factor Search Page'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php index b1df74ea..fc43978e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php @@ -18,17 +18,21 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting; +use Psr\Log\LoggerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; abstract class SecondFactorController extends AbstractController { - /** - * @param string $type - */ - protected function assertSecondFactorEnabled($type) + public function __construct( + private readonly LoggerInterface $logger, + ) + { + } + + protected function assertSecondFactorEnabled(string $type): void { if (!in_array($type, $this->getParameter('surfnet_stepup_ra.enabled_second_factors'))) { - $this->container->get('logger')->warning('A controller action was called for a disabled second factor'); + $this->logger->warning('A controller action was called for a disabled second factor'); throw $this->createNotFoundException(); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 1041d81e..53ffe01e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -30,11 +30,13 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Contracts\Translation\TranslatorInterface; class SmsController extends SecondFactorController { public function __construct( private readonly VettingService $vettingService, + private readonly TranslatorInterface $translator, ) { } @@ -125,7 +127,7 @@ public function provePossession(Request $request, string $procedureId): Response if ($cancelButton->isClicked()) { $vettingService->cancelProcedure($procedureId); - $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); + $this->addFlash('info', $this->translator->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 537081ac..35471e25 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -183,7 +183,7 @@ public function cancelProcedure($procedureId): RedirectResponse } $this->vettingService->cancelProcedure($procedureId); - $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); + $this->addFlash('info', $this->translator->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } @@ -211,7 +211,7 @@ public function verifyIdentity(Request $request, string $procedureId): Response $cancelButton = $form->get('cancel'); if ($cancelButton->isClicked()) { $this->vettingService->cancelProcedure($procedureId); - $this->addFlash('info', $this->container->get('translator')->trans('ra.vetting.flash.cancelled')); + $this->addFlash('info', $this->translator->trans('ra.vetting.flash.cancelled')); return $this->redirectToRoute('ra_vetting_search'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index b32b709d..477b74b2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -233,6 +233,8 @@ services: arguments: - "@ra.service.command" - "@logger" + Surfnet\StepupRa\RaBundle\Service\RaService: + alias: ra.service.ra ra.service.second_factor: class: Surfnet\StepupRa\RaBundle\Service\SecondFactorService diff --git a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php index 5f7b18ba..57b6f367 100644 --- a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php +++ b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php @@ -20,16 +20,17 @@ use Surfnet\StepupRa\RaBundle\DependencyInjection\Compiler\GssfSessionBagSessionPass; use Surfnet\StepupRa\RaBundle\Security\Factory\SamlFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; class SurfnetStepupRaRaBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { parent::build($container); - /** @var \Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension $extension */ + /** @var SecurityExtension $extension */ $extension = $container->getExtension('security'); $extension->addSecurityListenerFactory(new SamlFactory()); From ff9c27fc8e8fbbede90aeb08fe6d73d4e3702539 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:06:23 +0100 Subject: [PATCH 051/202] Add parent call --- .../StepupRa/RaBundle/Controller/Vetting/GssfController.php | 1 + .../StepupRa/RaBundle/Controller/Vetting/SmsController.php | 3 +++ .../StepupRa/RaBundle/Controller/Vetting/YubikeyController.php | 3 +++ 3 files changed, 7 insertions(+) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index fb115d7e..59a7fc57 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -54,6 +54,7 @@ public function __construct( private readonly AttributeDictionary $attributeDictionary, private readonly ViewConfigCollection $collection, ) { + parent::__construct($logger); } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 53ffe01e..1a62bb3f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -20,6 +20,7 @@ use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Command\SendSmsChallengeCommand; use Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand; use Surfnet\StepupBundle\Value\PhoneNumber\InternationalPhoneNumber; @@ -37,7 +38,9 @@ class SmsController extends SecondFactorController public function __construct( private readonly VettingService $vettingService, private readonly TranslatorInterface $translator, + LoggerInterface $logger, ) { + parent::__construct($logger); } public function sendChallenge(Request $request, string $procedureId): Response diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index caac7f89..a5e33b78 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -20,6 +20,7 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting; +use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; use Surfnet\StepupRa\RaBundle\Form\Type\VerifyYubikeyPublicIdType; use Surfnet\StepupRa\RaBundle\Service\VettingService; @@ -31,8 +32,10 @@ class YubikeyController extends SecondFactorController { public function __construct( private readonly VettingService $vettingService, + LoggerInterface $logger, // TODO: with sf 6 autowire attribute for procedureAwareLogger ) { + parent::__construct($logger); } public function verify(Request $request, string $procedureId): Response From ee578960c7db8e6d734f2b10e55ccc10a044adae Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:22:42 +0100 Subject: [PATCH 052/202] Add types --- .../RaBundle/Logger/ProcedureAwareLogger.php | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php index b46184c6..439cbad9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php +++ b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php @@ -27,80 +27,71 @@ */ final class ProcedureAwareLogger implements LoggerInterface { - /** - * @var string|null - */ - private $procedure; + private string $procedure; public function __construct(private readonly LoggerInterface $logger) { } - public function forProcedure($procedure) + public function forProcedure(string $procedure): ProcedureAwareLogger { - if (!is_string($procedure)) { - throw InvalidArgumentException::invalidType('string', 'procedure', $procedure); - } - $logger = new self($this->logger); $logger->procedure = $procedure; return $logger; } - public function emergency($message, array $context = []) + public function emergency($message, array $context = []): void { $this->logger->emergency($message, $this->enrichContext($context)); } - public function alert($message, array $context = []) + public function alert($message, array $context = []): void { $this->logger->alert($message, $this->enrichContext($context)); } - public function critical($message, array $context = []) + public function critical($message, array $context = []): void { $this->logger->critical($message, $this->enrichContext($context)); } - public function error($message, array $context = []) + public function error($message, array $context = []): void { $this->logger->error($message, $this->enrichContext($context)); } - public function warning($message, array $context = []) + public function warning($message, array $context = []): void { $this->logger->warning($message, $this->enrichContext($context)); } - public function notice($message, array $context = []) + public function notice($message, array $context = []): void { $this->logger->notice($message, $this->enrichContext($context)); } - public function info($message, array $context = []) + public function info($message, array $context = []): void { $this->logger->info($message, $this->enrichContext($context)); } - public function debug($message, array $context = []) + public function debug($message, array $context = []): void { $this->logger->debug($message, $this->enrichContext($context)); } - public function log($level, $message, array $context = []) + public function log($level, $message, array $context = []): void { - $this->logger->log($message, $this->enrichContext($context)); + $this->logger->log($level, $message, $this->enrichContext($context)); } /** * Adds the procedure to the log context. - * - * @return array * @throws RuntimeException */ - private function enrichContext(array $context) + private function enrichContext(array $context): array { if (!$this->procedure) { throw new RuntimeException('Authentication logging context is unknown'); From 353ad53f8a22594c9be3a6348483b953ae6e6f64 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:26:15 +0100 Subject: [PATCH 053/202] Add types --- .../Command/AccreditCandidateCommand.php | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php index f86fd36f..2d390ad9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php @@ -23,39 +23,21 @@ class AccreditCandidateCommand { - /** - * @var string - */ - public $identityId; + public string $identityId; - /** - * @var string - */ - public $institution; + public string $institution; /** * @Assert\NotBlank(message="ra.accredit_candidate.location.may_not_be_blank") - * @Assert\Type(type="string") - * - * @var string */ - public $location; + public string $location; /** * @Assert\NotBlank(message="ra.accredit_candidate.contact_information.may_not_be_blank") - * @Assert\Type(type="string") - * - * @var string */ - public $contactInformation; + public string $contactInformation; - /** - * @var RoleAtInstitution - */ - public $roleAtInstitution; + public RoleAtInstitution $roleAtInstitution; - /** - * @var array - */ - public $availableInstitutions = []; + public array $availableInstitutions = []; } From 8a67770512c672ab740bdca054bf49f68b2f18f7 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:27:25 +0100 Subject: [PATCH 054/202] Add types --- ...egistrationAuthorityInformationCommand.php | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php index 4d2a6eea..24ce7b85 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php @@ -22,29 +22,17 @@ class AmendRegistrationAuthorityInformationCommand { - /** - * @var string - */ - public $identityId; + public string $identityId; /** * @Assert\NotBlank(message="ra.amend_ra_information.location") - * @Assert\Type(type="string") - * - * @var string */ - public $location; + public string $location; /** * @Assert\NotBlank(message="ra.amend_ra_information.contact_information") - * @Assert\Type(type="string") - * - * @var string */ - public $contactInformation; + public string $contactInformation; - /** - * @var string - */ - public $institution; + public string $institution; } From 55b76eaa30727f1ea72ff7fef06c67ea745a0f44 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:28:53 +0100 Subject: [PATCH 055/202] Add types --- .../RaBundle/EventListener/InconsistentStateListener.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php index eebe6386..ea0fa774 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php @@ -20,7 +20,7 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Exception\InconsistentStateException; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; class InconsistentStateListener { @@ -28,7 +28,7 @@ public function __construct(private readonly LoggerInterface $logger) { } - public function onKernelException(GetResponseForExceptionEvent $event) + public function onKernelException(ExceptionEvent $event): void { $exception = $event->getThrowable(); From 9b7aeb7faf5419b523833e575baa3320e8399b57 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:30:28 +0100 Subject: [PATCH 056/202] Add types --- .../StepupRa/RaBundle/EventListener/LocaleListener.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php index 077e79f7..095a2a7c 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php @@ -21,6 +21,7 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -32,7 +33,7 @@ public function __construct(private TokenStorageInterface $tokenStorage, private { } - public function setRequestLocale(GetResponseEvent $event) + public function setRequestLocale(ResponseEvent $event): void { $token = $this->tokenStorage->getToken(); @@ -58,7 +59,7 @@ public function setRequestLocale(GetResponseEvent $event) } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ // Default locale listener listens at P16 From 6910e30b3d9f99ebf80eee9a756c2c3dff8e5f99 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:32:01 +0100 Subject: [PATCH 057/202] Add types --- .../StepupRa/RaBundle/Exception/AssertionFailedException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php b/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php index 7206c421..f481bc3c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php @@ -39,7 +39,7 @@ public function getValue() return $this->value; } - public function getConstraints() + public function getConstraints(): array { return $this->constraints; } From c2be42fa3437d128c2e6fa912a54e7db12b7a4f3 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:32:56 +0100 Subject: [PATCH 058/202] Add types --- .../RaBundle/Exception/InvalidArgumentException.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php index 523ada10..b18184c5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php @@ -20,13 +20,7 @@ class InvalidArgumentException extends \InvalidArgumentException { - /** - * @param string $expected description of expected type - * @param string $parameterName - * @param mixed $parameter the parameter that is not of the expected type. - * @return self - */ - public static function invalidType($expected, $parameterName, mixed $parameter) + public static function invalidType(string $expected, string $parameterName, mixed $parameter): InvalidArgumentException { $message = sprintf( 'Invalid argument type: "%s" expected, "%s" given for "%s"', From be57c26ca4d18947a6c25b2343b9c34fa2996415 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:34:05 +0100 Subject: [PATCH 059/202] Add types --- .../RaBundle/Form/Extension/RaRoleChoiceList.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php index 8de30a40..a866a898 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php @@ -20,28 +20,20 @@ class RaRoleChoiceList { - /** - * @return array - */ - public static function create() + public static function create(): array { return self::buildChoices(); } - private static function buildChoices() + private static function buildChoices(): array { $choices = self::getChoices(); $labels = array_map(fn($choice) => 'ra.form.extension.ra_role_choice.' . $choice, $choices); - $combined = array_combine($labels, $choices); - - return $combined; + return array_combine($labels, $choices); } - /** - * @return array - */ - public static function getChoices() + public static function getChoices(): array { return ['ra', 'raa']; } From 0cfb815151cbfe334689ec436a44749eb012d1d6 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:36:32 +0100 Subject: [PATCH 060/202] Add types --- .../Form/Extension/SecondFactorTypeChoiceList.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php index b4bdae78..d63610dc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php @@ -25,9 +25,11 @@ /** * Used to build a choice list of second factor types * - * Second factor types are indexed on their identifier. Some examples: 'sms', 'tiqr'. These not very human - * readable keys are linked to a more human readable value which is read from the translator. This results in an - * associative array like this: + * Second factor types are indexed on their identifier. + * Some examples: 'sms', 'tiqr'. + * These not very human-readable keys are linked + * to a more human-readable value which is read from the translator. + * This results in an associative array like this: * * [ * 'sms' => 'SMS', @@ -47,10 +49,7 @@ public function __construct( ) { } - /** - * @return array - */ - public function create() + public function create(): array { $selectOptions = []; $collection = $this->secondFactorTypeService->getAvailableSecondFactorTypes(); From deb7464fffb340e574d7e958ae391b824030ef22 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:40:41 +0100 Subject: [PATCH 061/202] Add types --- .../Handler/AuthenticatedUserHandler.php | 11 ++++------- .../Authentication/Handler/AuthenticationHandler.php | 12 +++--------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php index 3712b4e7..b345db46 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php @@ -21,15 +21,12 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Security\Authentication\AuthenticatedSessionStateHandler; use Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionLifetimeGuard; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class AuthenticatedUserHandler implements AuthenticationHandler { - /** - * @var AuthenticationHandler - */ - private $nextHandler; + private AuthenticationHandler $nextHandler; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -39,7 +36,7 @@ public function __construct( ) { } - public function process(GetResponseEvent $event) + public function process(RequestEvent $event): void { if ($this->tokenStorage->getToken() !== null && $this->sessionLifetimeGuard->sessionLifetimeWithinLimits($this->sessionStateHandler) @@ -60,7 +57,7 @@ public function process(GetResponseEvent $event) } } - public function setNext(AuthenticationHandler $next) + public function setNext(AuthenticationHandler $next): void { $this->nextHandler = $next; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php index 53e613da..0791c167 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php @@ -18,24 +18,18 @@ namespace Surfnet\StepupRa\RaBundle\Security\Authentication\Handler; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; interface AuthenticationHandler { /** * Checks if it can process the event and if so does so. Also determines if there * is a next handler to be called if it cannot process the event itself. - * - * @param GetResponseEvent $event - * @return void */ - public function process(GetResponseEvent $event); + public function process(RequestEvent $event): void; /** * Allows setting the optional next handler - * - * @param AuthenticationHandler $handler - * @return void */ - public function setNext(AuthenticationHandler $handler); + public function setNext(AuthenticationHandler $handler): void; } From f1e81a2903f5f1dcc485f4be89186d6b9d8fb9ea Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:41:53 +0100 Subject: [PATCH 062/202] Add types --- .../Handler/ExplicitSessionTimeoutHandler.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php index 73b1d967..6423ed1d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php @@ -22,7 +22,7 @@ use Surfnet\StepupRa\RaBundle\Security\Authentication\AuthenticatedSessionStateHandler; use Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionLifetimeGuard; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler; @@ -33,10 +33,7 @@ */ class ExplicitSessionTimeoutHandler implements AuthenticationHandler { - /** - * @var AuthenticationHandler|null - */ - private $nextHandler; + private ?AuthenticationHandler $nextHandler; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -49,7 +46,7 @@ public function __construct( ) { } - public function process(GetResponseEvent $event) + public function process(RequestEvent $event): void { if ($this->tokenStorage->getToken() !== null && !$this->sessionLifetimeGuard->sessionLifetimeWithinLimits($this->authenticatedSession) @@ -99,7 +96,7 @@ public function process(GetResponseEvent $event) } } - public function setNext(AuthenticationHandler $handler) + public function setNext(AuthenticationHandler $handler): void { $this->nextHandler = $handler; } From 908688da677cf870f6099e57d6634b35bb6ec084 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:43:53 +0100 Subject: [PATCH 063/202] Add types --- .../Authentication/Handler/LogoutSuccessHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php index 59a1c29d..c88678a1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php @@ -28,11 +28,14 @@ final class LogoutSuccessHandler implements LogoutSuccessHandlerInterface /** * @param string[] $logoutRedirectUrl */ - public function __construct(private readonly TokenStorageInterface $tokenStorage, private array $logoutRedirectUrl) + public function __construct( + private readonly TokenStorageInterface $tokenStorage, + private readonly array $logoutRedirectUrl, + ) { } - public function onLogoutSuccess(Request $request) + public function onLogoutSuccess(Request $request): RedirectResponse { $token = $this->tokenStorage->getToken(); $identity = $token->getUser(); From 24939b32cbf3f10c7e5dcca4349bda2497b77bea Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 13:47:00 +0100 Subject: [PATCH 064/202] Fix deprecations --- .../RaBundle/EventListener/LocaleListener.php | 5 ++--- .../Handler/InitiateSamlAuthenticationHandler.php | 11 ++++------- .../Handler/ProcessSamlAuthenticationHandler.php | 13 ++++--------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php index 095a2a7c..ea209bfb 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php @@ -20,8 +20,7 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\ResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -33,7 +32,7 @@ public function __construct(private TokenStorageInterface $tokenStorage, private { } - public function setRequestLocale(ResponseEvent $event): void + public function setRequestLocale(RequestEvent $event): void { $token = $this->tokenStorage->getToken(); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php index a28e8d57..521c96e5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php @@ -23,16 +23,13 @@ use Surfnet\StepupRa\RaBundle\Security\Authentication\AuthenticatedSessionStateHandler; use Surfnet\StepupRa\RaBundle\Security\Authentication\SamlAuthenticationStateHandler; use Surfnet\StepupRa\RaBundle\Security\Authentication\SamlInteractionProvider; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; class InitiateSamlAuthenticationHandler implements AuthenticationHandler { - /** - * @var AuthenticationHandler|null - */ - private $nextHandler; + private ?AuthenticationHandler $nextHandler; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -45,7 +42,7 @@ public function __construct( ) { } - public function process(GetResponseEvent $event) + public function process(RequestEvent $event): void { $acsUri = $this->router->generate('ra_serviceprovider_consume_assertion'); @@ -88,7 +85,7 @@ public function process(GetResponseEvent $event) } } - public function setNext(AuthenticationHandler $handler) + public function setNext(AuthenticationHandler $handler): void { $this->nextHandler = $handler; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php index 24f7a182..4914cc6b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php @@ -25,9 +25,8 @@ use Surfnet\StepupRa\RaBundle\Security\Authentication\SamlAuthenticationStateHandler; use Surfnet\StepupRa\RaBundle\Security\Authentication\SamlInteractionProvider; use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; -use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; @@ -38,10 +37,7 @@ */ class ProcessSamlAuthenticationHandler implements AuthenticationHandler { - /** - * @var AuthenticationHandler - */ - private $nextHandler; + private AuthenticationHandler $nextHandler; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -51,11 +47,10 @@ public function __construct( private readonly AuthenticationManagerInterface $authenticationManager, private readonly LoaResolutionService $loaResolutionService, private readonly SamlAuthenticationLogger $authenticationLogger, - private readonly EngineInterface $templating, ) { } - public function process(GetResponseEvent $event) + public function process(RequestEvent $event): void { if ($this->tokenStorage->getToken() === null && $this->samlInteractionProvider->isSamlAuthenticationInitiated() @@ -100,7 +95,7 @@ public function process(GetResponseEvent $event) } } - public function setNext(AuthenticationHandler $handler) + public function setNext(AuthenticationHandler $handler): void { $this->nextHandler = $handler; } From 345ded4cbb8af16e7be984f26def9fba02b28332 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 14:02:07 +0100 Subject: [PATCH 065/202] Fix deprecations --- .../Handler/AuthenticatedUserHandler.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php index b345db46..77bcaac5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php @@ -26,7 +26,7 @@ class AuthenticatedUserHandler implements AuthenticationHandler { - private AuthenticationHandler $nextHandler; + private ?AuthenticationHandler $nextHandler = null; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -52,13 +52,11 @@ public function process(RequestEvent $event): void return; } - if ($this->nextHandler !== null) { - $this->nextHandler->process($event); - } + $this->nextHandler?->process($event); } - public function setNext(AuthenticationHandler $next): void + public function setNext(AuthenticationHandler $handler): void { - $this->nextHandler = $next; + $this->nextHandler = $handler; } } From 293012e672f4d0bd3eeee3c5f5b10a5b9ef9c3b5 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 14:28:18 +0100 Subject: [PATCH 066/202] Fix deprecations --- .../Controller/RaManagementController.php | 3 +- .../Controller/SecurityController.php | 9 +++++- .../RaBundle/Resources/config/security.yml | 2 ++ .../Handler/ExplicitSessionTimeoutHandler.php | 8 ++--- .../InitiateSamlAuthenticationHandler.php | 6 ++-- .../ProcessSamlAuthenticationHandler.php | 6 ++-- .../SamlInteractionProvider.php | 15 ++++------ .../Authentication/Session/SessionStorage.php | 4 +-- .../RaBundle/Security/Factory/SamlFactory.php | 2 +- .../RaBundle/Service/CommandService.php | 3 +- .../RaBundle/Service/IdentityService.php | 28 +++++------------ .../RaBundle/Service/RaCandidateService.php | 29 +++++------------- .../RaBundle/Service/RaListingService.php | 30 ++++--------------- .../RaBundle/Service/RaLocationService.php | 7 ++--- .../Session/SessionLifetimeGuardTest.php | 2 +- .../Security/Session/SessionStorageTest.php | 2 +- .../Extensions/Extension/SecondFactorType.php | 18 ++++++----- .../Exception/UnknownProviderException.php | 4 +-- .../Tests/Provider/ViewConfigTest.php | 5 ++-- 19 files changed, 69 insertions(+), 114 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index fe8198a9..b840cdf7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -20,6 +20,7 @@ use Knp\Component\Pager\PaginatorInterface; use Psr\Log\LoggerInterface; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateInstitution; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListing; use Surfnet\StepupRa\RaBundle\Command\AccreditCandidateCommand; @@ -308,7 +309,7 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI } /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity + * @return Identity */ private function getCurrentUser() { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index 1e763978..90ac8bd2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -18,16 +18,23 @@ namespace Surfnet\StepupRa\RaBundle\Controller; +use Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionStorage; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class SecurityController extends AbstractController { + public function __construct( + private readonly SessionStorage $sessionStorage, + ) + { + } + public function sessionExpired(Request $request): Response { $redirectToUrl = $this - ->get('ra.security.authentication.session.session_storage') + ->sessionStorage ->getCurrentRequestUri(); return $this->render( diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index 438a7066..58afd693 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -92,6 +92,8 @@ services: class: Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionStorage arguments: - "@request_stack" + Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionStorage: + alias: ra.security.authentication.session.session_storage ra.security.authentication.session.session_lifetime_guard: public: false diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php index 6423ed1d..c26000d4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php @@ -33,7 +33,7 @@ */ class ExplicitSessionTimeoutHandler implements AuthenticationHandler { - private ?AuthenticationHandler $nextHandler; + private ?AuthenticationHandler $nextHandler = null; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -83,7 +83,7 @@ public function process(RequestEvent $event): void $this->sessionLogoutHandler->logout($request, $event->getResponse(), $token); $this->cookieClearingLogoutHandler->logout($request, $event->getResponse(), $token); - $this->tokenStorage->setToken(null); + $this->tokenStorage->setToken(); // the session is restarted after invalidation during the logout, so we can (re)store the last GET request $this->authenticatedSession->setCurrentRequestUri($afterLoginRedirectTo); @@ -91,9 +91,7 @@ public function process(RequestEvent $event): void return; } - if ($this->nextHandler !== null) { - $this->nextHandler->process($event); - } + $this->nextHandler?->process($event); } public function setNext(AuthenticationHandler $handler): void diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php index 521c96e5..faf46338 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php @@ -29,7 +29,7 @@ class InitiateSamlAuthenticationHandler implements AuthenticationHandler { - private ?AuthenticationHandler $nextHandler; + private ?AuthenticationHandler $nextHandler = null; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -80,9 +80,7 @@ public function process(RequestEvent $event): void return; } - if ($this->nextHandler) { - $this->nextHandler->process($event); - } + $this->nextHandler?->process($event); } public function setNext(AuthenticationHandler $handler): void diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php index 4914cc6b..81e94e77 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php @@ -37,7 +37,7 @@ */ class ProcessSamlAuthenticationHandler implements AuthenticationHandler { - private AuthenticationHandler $nextHandler; + private ?AuthenticationHandler $nextHandler = null; public function __construct( private readonly TokenStorageInterface $tokenStorage, @@ -90,9 +90,7 @@ public function process(RequestEvent $event): void return; } - if ($this->nextHandler) { - $this->nextHandler->process($event); - } + $this->nextHandler?->process($event); } public function setNext(AuthenticationHandler $handler): void diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php index 0a0f5d97..b27ebf8d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php @@ -18,6 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Security\Authentication; +use SAML2\Assertion; use Surfnet\SamlBundle\Entity\IdentityProvider; use Surfnet\SamlBundle\Entity\ServiceProvider; use Surfnet\SamlBundle\Http\PostBinding; @@ -27,6 +28,7 @@ use Surfnet\StepupBundle\Value\Loa; use Surfnet\StepupRa\RaBundle\Exception\LoaTooLowException; use Surfnet\StepupRa\RaBundle\Exception\UnexpectedIssuerException; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Exception\AuthenticationException; @@ -54,10 +56,7 @@ public function isSamlAuthenticationInitiated() return $this->samlAuthenticationStateHandler->hasRequestId(); } - /** - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - public function initiateSamlRequest() + public function initiateSamlRequest(): RedirectResponse { $authnRequest = AuthnRequestFactory::createNewRequest( $this->serviceProvider, @@ -68,18 +67,16 @@ public function initiateSamlRequest() $this->samlAuthenticationStateHandler->setRequestId($authnRequest->getRequestId()); - return $this->redirectBinding->createRedirectResponseFor($authnRequest); + return $this->redirectBinding->createResponseFor($authnRequest); } /** - * @return \SAML2\Assertion * @throws LoaTooLowException When required LoA is not met by response * @throws AuthenticationException When response LoA cannot be resolved * @throws UnexpectedIssuerException */ - public function processSamlResponse(Request $request) + public function processSamlResponse(Request $request): Assertion { - /** @var \SAML2\Assertion $assertion */ $assertion = $this->postBinding->processResponse( $request, $this->identityProvider, @@ -106,7 +103,7 @@ public function processSamlResponse(Request $request) sprintf( "Gateway responded with LoA '%s', which is lower than required LoA '%s'", $assertion->getAuthnContextClassRef(), - (string) $this->requiredLoa, + $this->requiredLoa, ), ); } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php index 39213089..9004c047 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php @@ -51,7 +51,7 @@ public function logAuthenticationMoment(): void public function isAuthenticationMomentLogged(): bool { - return $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'authenticated_at', null) !== null; + return $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'authenticated_at') !== null; } public function getAuthenticationMoment(): DateTime @@ -70,7 +70,7 @@ public function updateLastInteractionMoment(): void public function hasSeenInteraction(): bool { - return $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'last_interaction', null) !== null; + return $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'last_interaction') !== null; } public function getLastInteractionMoment(): DateTime diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php index f62a58e0..631cf17e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php @@ -25,7 +25,7 @@ class SamlFactory implements SecurityFactoryInterface { - public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint) + public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint): array { $providerId = 'security.authentication.provider.saml.' . $id; $container->setDefinition( diff --git a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php index dcad81dd..9294bce6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php @@ -20,6 +20,7 @@ use Surfnet\StepupMiddlewareClientBundle\Command\Command; use Surfnet\StepupMiddlewareClientBundle\Command\Metadata; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupMiddlewareClientBundle\Service\CommandService as MiddlewareCommandService; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -33,7 +34,7 @@ public function __construct( public function execute(Command $command) { - /** @var \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity $identity */ + /** @var Identity $identity */ $identity = $this->tokenStorage->getToken()->getUser(); return $this->commandService->execute($command, new Metadata($identity->id, $identity->institution)); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index b57d45c2..fbf23498 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -24,6 +24,7 @@ use Surfnet\StepupMiddlewareClient\Identity\Dto\IdentitySearchQuery; use Surfnet\StepupMiddlewareClientBundle\Identity\Command\ExpressLocalePreferenceCommand; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RegistrationAuthorityCredentials; use Surfnet\StepupMiddlewareClientBundle\Identity\Service\IdentityService as ApiIdentityService; use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -61,32 +62,24 @@ public function refreshUser(UserInterface $user) /** * Whether this provider supports the given user class - * - * @param string $class - * - * @return bool */ - public function supportsClass($class) + public function supportsClass($class): bool { return $class === Identity::class; } /** * @param string $identityId the UUID of the identity to find - * @return null|Identity */ - public function findById($identityId) + public function findById(string $identityId): ?Identity { return $this->apiIdentityService->get($identityId); } /** - * @param string $nameId - * @param string $institution - * @return null|\Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity - * @throws \Surfnet\StepupRa\RaBundle\Exception\RuntimeException + * @throws RuntimeException */ - public function findByNameIdAndInstitution($nameId, $institution) + public function findByNameIdAndInstitution(string $nameId, string $institution): ?Identity { $searchQuery = new IdentitySearchQuery(); $searchQuery->setNameId($nameId); @@ -115,10 +108,7 @@ public function findByNameIdAndInstitution($nameId, $institution) )); } - /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RegistrationAuthorityCredentials|null - */ - public function getRaCredentials(Identity $identity) + public function getRaCredentials(Identity $identity): ?RegistrationAuthorityCredentials { try { $credentials = $this->apiIdentityService->getRegistrationAuthorityCredentials($identity); @@ -132,12 +122,8 @@ public function getRaCredentials(Identity $identity) return $credentials; } - /** - * @return bool - */ - public function switchLocale(SwitchLocaleCommand $command) + public function switchLocale(SwitchLocaleCommand $command): bool { - /** @var TokenInterface|null */ $token = $this->tokenStorage->getToken(); if (!$token) { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php index 78b922ff..d1b057b3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php @@ -25,6 +25,8 @@ use Surfnet\StepupBundle\Value\VettingType; use Surfnet\StepupMiddlewareClient\Identity\Dto\RaCandidateSearchQuery; use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AccreditIdentityCommand; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateCollection; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateInstitutions; use Surfnet\StepupMiddlewareClientBundle\Identity\Service\RaCandidateService as ApiRaCandidateService; use Surfnet\StepupRa\RaBundle\Command\AccreditCandidateCommand; use Surfnet\StepupRa\RaBundle\Command\SearchRaCandidatesCommand; @@ -43,10 +45,7 @@ public function __construct( ) { } - /** - * @return \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateCollection - */ - public function search(SearchRaCandidatesCommand $command) + public function search(SearchRaCandidatesCommand $command): RaCandidateCollection { $query = new RaCandidateSearchQuery($command->actorId, $command->pageNumber); @@ -79,25 +78,13 @@ public function search(SearchRaCandidatesCommand $command) return $this->apiRaCandidateService->search($query); } - /** - * @param string $identityId - * @param string $actorId - * @return null|\Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaCandidateInstitutions - */ - public function getRaCandidate($identityId, $actorId) + public function getRaCandidate(string $identityId, string $actorId): ?RaCandidateInstitutions { - if (!is_string($identityId)) { - throw InvalidArgumentException::invalidType('string', 'identityId', $identityId); - } - - if (!is_string($actorId)) { - throw InvalidArgumentException::invalidType('string', 'actorId', $actorId); - } return $this->apiRaCandidateService->get($identityId, $actorId); } - public function accreditCandidate(AccreditCandidateCommand $command) + public function accreditCandidate(AccreditCandidateCommand $command): bool { $apiCommand = new AccreditIdentityCommand(); $apiCommand->raInstitution = $command->roleAtInstitution->getInstitution(); @@ -128,12 +115,12 @@ public function accreditCandidate(AccreditCandidateCommand $command) /** * @return string[] */ - private function getLoa3SecondFactorTypes() + private function getLoa3SecondFactorTypes(): array { - $loa3 = new Loa(Loa::LOA_3, 'LOA3'); return array_filter( $this->secondFactorTypeService->getAvailableSecondFactorTypes(), - function ($secondFactorType) use ($loa3) { + function ($secondFactorType) { + $loa3 = new Loa(Loa::LOA_3, 'LOA3'); $secondFactorType = new SecondFactorType($secondFactorType); return $this->secondFactorTypeService->canSatisfy( $secondFactorType, diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php index 17526f73..c2a14f21 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php @@ -18,27 +18,25 @@ namespace Surfnet\StepupRa\RaBundle\Service; -use Psr\Log\LoggerInterface; use Surfnet\StepupMiddlewareClient\Identity\Dto\RaListingSearchQuery; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListing; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\RaListingCollection; use Surfnet\StepupMiddlewareClientBundle\Identity\Service\RaListingService as ApiRaListingService; use Surfnet\StepupRa\RaBundle\Command\SearchRaListingCommand; -use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; final readonly class RaListingService { - public function __construct(private ApiRaListingService $apiRaListingService, private LoggerInterface $logger) + public function __construct( + private ApiRaListingService $apiRaListingService, + ) { } /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) -- The command to query mapping in search exceed the * @SuppressWarnings(PHPMD.NPathComplexity) CyclomaticComplexity and NPathComplexity threshold. - * - * @return RaListingCollection */ - public function search(SearchRaListingCommand $command) + public function search(SearchRaListingCommand $command): RaListingCollection { $query = new RaListingSearchQuery($command->actorId, $command->pageNumber); @@ -73,26 +71,8 @@ public function search(SearchRaListingCommand $command) return $this->apiRaListingService->search($query); } - /** - * @param string $identityId - * @param string $institution - * @param string $actorId - * @return null|RaListing - */ - public function get($identityId, $institution, $actorId) + public function get(string $identityId, string $institution, string $actorId): ?RaListing { - if (!is_string($identityId)) { - throw InvalidArgumentException::invalidType('string', 'identityId', $identityId); - } - - if (!is_string($institution)) { - throw InvalidArgumentException::invalidType('string', 'institution', $institution); - } - - if (!is_string($actorId)) { - throw InvalidArgumentException::invalidType('string', 'actorId', $actorId); - } - return $this->apiRaListingService->get($identityId, $institution, $actorId); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php index 9e1435a2..4fdd37d1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php @@ -23,6 +23,7 @@ use Surfnet\StepupMiddlewareClientBundle\Configuration\Command\AddRaLocationCommand as MiddlewareCreateLocationCommand; use Surfnet\StepupMiddlewareClientBundle\Configuration\Command\ChangeRaLocationCommand as MiddlewareChangeRaLocationCommand; use Surfnet\StepupMiddlewareClientBundle\Configuration\Command\RemoveRaLocationCommand as MiddlewareRemoveRaLocationCommand; +use Surfnet\StepupMiddlewareClientBundle\Configuration\Dto\RaLocation; use Surfnet\StepupMiddlewareClientBundle\Configuration\Dto\RaLocationCollection; use Surfnet\StepupMiddlewareClientBundle\Configuration\Service\RaLocationService as ApiRaLocationService; use Surfnet\StepupMiddlewareClientBundle\Uuid\Uuid; @@ -43,11 +44,7 @@ public function __construct( ) { } - /** - * @param string $id - * @return null|\Surfnet\StepupMiddlewareClientBundle\Configuration\Dto\RaLocation - */ - public function find($id) + public function find(string $id): ?RaLocation { return $this->apiRaLocationService->get($id); } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php index 7275e8cb..fecab73a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php @@ -34,7 +34,7 @@ class SessionLifetimeGuardTest extends TestCase */ public function tearDown(): void { - $this->setCurrentTime(null); + $this->setCurrentTime(); } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php index 41632d17..80e1a56b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php @@ -34,7 +34,7 @@ class SessionStorageTest extends TestCase */ public function tearDown(): void { - $this->setCurrentTime(null); + $this->setCurrentTime(); } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php index 999787a3..7e4b1aa2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php @@ -19,28 +19,30 @@ namespace Surfnet\StepupRa\RaBundle\Twig\Extensions\Extension; use Surfnet\StepupBundle\Service\SecondFactorTypeTranslationService; -use Twig_Extension; -use Twig_SimpleFilter; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; -final class SecondFactorType extends Twig_Extension +final class SecondFactorType extends AbstractExtension { - public function __construct(private readonly SecondFactorTypeTranslationService $translator) + public function __construct( + private readonly SecondFactorTypeTranslationService $translator, + ) { } - public function getName() + public function getName(): string { return 'ra.twig.second_factor_type'; } - public function getFilters() + public function getFilters(): array { return [ - new Twig_SimpleFilter('trans_second_factor_type', $this->translateSecondFactorType(...)), + new TwigFilter('trans_second_factor_type', $this->translateSecondFactorType(...)), ]; } - public function translateSecondFactorType($secondFactorType) + public function translateSecondFactorType($secondFactorType): string { return $this->translator->translate($secondFactorType, 'ra.second_factor.search.type.%s'); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php index 38ff1005..2ce8732a 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php @@ -20,9 +20,9 @@ final class UnknownProviderException extends RuntimeException { - public static function create($unknownProvider, array $knownProviders) + public static function create($unknownProvider, array $knownProviders): UnknownProviderException { - return new static(sprintf( + return new UnknownProviderException(sprintf( 'Unknown Generic SAML Stepup Provider requested "%s", known providers: "%s"', is_object($unknownProvider) ? '(object)' . $unknownProvider::class : $unknownProvider, implode('", "', $knownProviders), diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php index e803df76..da21f29d 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php @@ -20,6 +20,7 @@ use Mockery as m; use PHPUnit\Framework\TestCase; +use Surfnet\StepupRa\RaBundle\Exception\LogicException; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig; use Symfony\Component\HttpFoundation\RequestStack; @@ -58,7 +59,7 @@ public function view_config_translates_correctly() public function translation_fails_when_no_current_language_set() { $this->expectExceptionMessage("The current language is not set"); - $this->expectException(\Surfnet\StepupRa\RaBundle\Exception\LogicException::class); + $this->expectException(LogicException::class); $viewConfig = $this->buildViewConfig(null); $viewConfig->getExplanation(); @@ -71,7 +72,7 @@ public function translation_fails_when_no_current_language_set() public function view_config_cannot_serve_french_translations() { $this->expectExceptionMessage("The requested translation is not available in this language: fr_FR. Available languages: en_GB, nl_NL"); - $this->expectException(\Surfnet\StepupRa\RaBundle\Exception\LogicException::class); + $this->expectException(LogicException::class); $viewConfig = $this->buildViewConfig('fr_FR'); $viewConfig->getGssfIdMismatch(); From e821fc09a5746d64560078318db4eb648da8d59e Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 14:47:18 +0100 Subject: [PATCH 067/202] Add return types --- src/Surfnet/StepupRa/RaBundle/Assert.php | 2 +- .../Command/ExportRaSecondFactorsCommand.php | 2 +- .../Controller/RaManagementController.php | 2 +- .../StepupRa/RaBundle/DateTime/DateTime.php | 2 +- .../Compiler/GssfSessionBagSessionPass.php | 2 +- .../DependencyInjection/Configuration.php | 10 +++---- ...ndRegistrationAuthorityInformationType.php | 6 ++-- .../RaBundle/Form/Type/AnchorType.php | 8 +++--- .../RaBundle/Form/Type/ButtonGroupType.php | 2 +- .../Form/Type/ChangeRaLocationType.php | 6 ++-- .../RaBundle/Form/Type/ChangeRaRoleType.php | 6 ++-- .../Form/Type/CreateRaLocationType.php | 6 ++-- .../RaBundle/Form/Type/CreateRaType.php | 6 ++-- .../RaBundle/Form/Type/InitiateGssfType.php | 6 ++-- .../StepupRa/RaBundle/Form/Type/OtpType.php | 6 ++-- .../Form/Type/RemoveRaLocationType.php | 6 ++-- .../Type/RetractRegistrationAuthorityType.php | 6 ++-- .../Form/Type/RevokeRecoveryTokenType.php | 6 ++-- .../Form/Type/RevokeSecondFactorType.php | 6 ++-- .../Form/Type/RoleAtInstitutionType.php | 6 ++-- .../Form/Type/SearchRaListingType.php | 6 ++-- .../Form/Type/SearchRaSecondFactorsType.php | 6 ++-- .../Form/Type/SearchRecoveryTokensType.php | 6 ++-- .../Form/Type/SelectInstitutionType.php | 6 ++-- .../Form/Type/SendSmsChallengeType.php | 6 ++-- .../Form/Type/StartVettingProcedureType.php | 6 ++-- .../Authentication/Provider/SamlProvider.php | 4 +-- .../SamlAuthenticationStateHandler.php | 20 +++---------- .../SamlInteractionProvider.php | 4 +-- .../Session/SessionLifetimeGuard.php | 6 ++-- .../Authentication/Session/SessionStorage.php | 4 +-- .../Authentication/Token/SamlToken.php | 4 +-- .../RaBundle/Security/Factory/SamlFactory.php | 4 +-- .../RaBundle/Service/AuditLogService.php | 2 +- .../RaBundle/Service/CommandService.php | 2 +- .../RaBundle/Service/GlobalViewParameters.php | 2 +- .../StepupRa/RaBundle/Service/GssfService.php | 4 +-- ...InstitutionConfigurationOptionsService.php | 2 +- ...onConfigurationOptionsServiceInterface.php | 2 +- .../RaBundle/Service/RaLocationService.php | 8 +++--- .../RaBundle/Service/RaSecondFactorExport.php | 2 +- .../StepupRa/RaBundle/Service/RaService.php | 6 ++-- .../RaBundle/Service/RecoveryTokenService.php | 2 +- .../RaBundle/Service/VettingService.php | 2 +- .../DependencyInjection/ConfigurationTest.php | 2 +- .../Tests/Security/Session/FakeSession.php | 28 +++++++++---------- .../Session/SessionLifetimeGuardTest.php | 8 +++--- .../Security/Session/SessionStorageTest.php | 2 +- .../TestDouble/Factory/GuzzleApiFactory.php | 6 ++-- .../StepupRa/RaBundle/Value/DateTime.php | 18 ++++++------ .../RaBundle/Value/RoleAtInstitution.php | 12 ++++---- .../DependencyInjection/Configuration.php | 6 ++-- .../Exception/InvalidArgumentException.php | 2 +- .../Provider/Metadata.php | 4 +-- .../Provider/Provider.php | 8 +++--- .../Saml/StateHandler.php | 8 +++--- 56 files changed, 155 insertions(+), 167 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Assert.php b/src/Surfnet/StepupRa/RaBundle/Assert.php index d36b211b..905c981d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Assert.php +++ b/src/Surfnet/StepupRa/RaBundle/Assert.php @@ -25,7 +25,7 @@ final class Assert extends Assertion { protected static $exceptionClass = AssertionFailedException::class; - public static function keysAre(array $array, array $expectedKeys, $propertyPath = null) + public static function keysAre(array $array, array $expectedKeys, $propertyPath = null): void { $givenKeys = array_keys($array); diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php index 1ba4cf11..a86d08e4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php @@ -91,7 +91,7 @@ final class ExportRaSecondFactorsCommand * Builds the command from a SearchRaSecondFactorsCommand * @return ExportRaSecondFactorsCommand */ - public static function fromSearchCommand(SearchRaSecondFactorsCommand $command) + public static function fromSearchCommand(SearchRaSecondFactorsCommand $command): ExportRaSecondFactorsCommand { $exportCommand = new self; diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index b840cdf7..f3450350 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -311,7 +311,7 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI /** * @return Identity */ - private function getCurrentUser() + private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } diff --git a/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php b/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php index fe89636b..2a1a7e6d 100644 --- a/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php +++ b/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php @@ -30,7 +30,7 @@ class DateTime /** * @return CoreDateTime */ - public static function now() + public static function now(): CoreDateTime { return self::$now ?: new CoreDateTime; } diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php index f30169e4..4550c737 100644 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php +++ b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php @@ -28,7 +28,7 @@ class GssfSessionBagSessionPass implements CompilerPassInterface * {@inheritdoc} This is required to ensure that our NamespacedAttributeBag is registered in the session handler * before the session is started. */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $container ->getDefinition('session') diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php index fd37067f..bc47588f 100644 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php @@ -27,7 +27,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('surfnet_stepup_ra_ra'); $rootNode = $treeBuilder->getRootNode(); @@ -41,7 +41,7 @@ public function getConfigTreeBuilder() return $treeBuilder; } - private function appendLoaConfiguration(NodeBuilder $childNodes) + private function appendLoaConfiguration(NodeBuilder $childNodes): void { $childNodes ->scalarNode('required_loa') @@ -54,7 +54,7 @@ private function appendLoaConfiguration(NodeBuilder $childNodes) ->end(); } - private function appendSecondFactorTypesConfiguration(NodeBuilder $childNodes) + private function appendSecondFactorTypesConfiguration(NodeBuilder $childNodes): void { $childNodes ->arrayNode('enabled_second_factors') @@ -73,7 +73,7 @@ private function appendSecondFactorTypesConfiguration(NodeBuilder $childNodes) ->end(); } - private function appendSessionConfiguration(NodeBuilder $childNodes) + private function appendSessionConfiguration(NodeBuilder $childNodes): void { $childNodes ->arrayNode('session_lifetimes') @@ -110,7 +110,7 @@ private function appendSessionConfiguration(NodeBuilder $childNodes) ->end(); } - private function appendUrlConfiguration(NodeBuilder $childNodes) + private function appendUrlConfiguration(NodeBuilder $childNodes): void { $childNodes ->scalarNode('self_service_url') diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php index 34392b63..5ea4b63b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php @@ -27,7 +27,7 @@ class AmendRegistrationAuthorityInformationType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('location', TextareaType::class, [ @@ -58,14 +58,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => AmendRegistrationAuthorityInformationCommand::class ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_management_amend_ra_info'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php index 3fe829af..2191ee76 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php @@ -27,17 +27,17 @@ class AnchorType extends AbstractType implements ButtonTypeInterface { - public function getParent() + public function getParent(): string { return ButtonType::class; } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'anchor'; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'route' => null, @@ -51,7 +51,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('route_parameters', 'array'); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php index 390bb80d..7d996cdc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php @@ -31,7 +31,7 @@ class ButtonGroupType extends FormType /** * {@inheritdoc} */ - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'button_group'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php index d7a4f824..13a922a2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php @@ -27,7 +27,7 @@ class ChangeRaLocationType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('name', null, [ @@ -65,14 +65,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => ChangeRaLocationCommand::class ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_change_ra_location'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php index 60d25702..2d7f1c07 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php @@ -28,7 +28,7 @@ class ChangeRaRoleType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('role', ChoiceType::class, [ @@ -58,14 +58,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => ChangeRaRoleCommand::class ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_management_change_ra_role'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php index 08473733..298252ef 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php @@ -27,7 +27,7 @@ class CreateRaLocationType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('name', null, [ @@ -60,14 +60,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => CreateRaLocationCommand::class ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_create_ra_location'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php index 21f9b50e..11b0d8bf 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php @@ -27,7 +27,7 @@ class CreateRaType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $options = array_combine( $builder->getData()->availableInstitutions, @@ -66,14 +66,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => AccreditCandidateCommand::class ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_management_create_ra'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php index a7a7b759..ac5a92d7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php @@ -30,7 +30,7 @@ public function __construct(private readonly RouterInterface $router) { } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $action = $this->router->generate( 'ra_vetting_gssf_authenticate', @@ -46,14 +46,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->setAction($action); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired(['procedureId', 'provider']); $resolver->setAllowedTypes('procedureId', 'string'); $resolver->setAllowedTypes('provider', 'string'); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_initiate_gssf'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php index cbc1220a..e8f67e89 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php @@ -23,7 +23,7 @@ class OtpType extends TextType { - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults( [ @@ -36,12 +36,12 @@ public function configureOptions(OptionsResolver $resolver) ], ); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'otp'; } - public function getParent() + public function getParent(): string { return TextType::class; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php index b61c04cf..d3272769 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php @@ -26,21 +26,21 @@ class RemoveRaLocationType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('locationId', HiddenType::class) ->add('institution', HiddenType::class); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => RemoveRaLocationCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_remove_ra_location'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php index 328410a6..44bc46b6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php @@ -26,7 +26,7 @@ class RetractRegistrationAuthorityType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add( $builder->create( @@ -47,14 +47,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => RetractRegistrationAuthorityCommand::class ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_management_retract_registration_authority'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php index 3b545f24..536542b6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php @@ -26,21 +26,21 @@ class RevokeRecoveryTokenType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('recoveryTokenId', HiddenType::class) ->add('identityId', HiddenType::class); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => RevokeRecoveryTokenCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_revoke_recovery_token'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php index f36d86dc..0f99a1fe 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php @@ -26,21 +26,21 @@ class RevokeSecondFactorType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('secondFactorId', HiddenType::class) ->add('identityId', HiddenType::class); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => RevokeSecondFactorCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_revoke_second_factor'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php index fbd7884a..4efed652 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php @@ -41,7 +41,7 @@ */ class RoleAtInstitutionType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $selectRaaOptions = $options['choices']; $isRequired = $options['required']; @@ -58,12 +58,12 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults(['data_class' => RoleAtInstitution::class, 'choices' => [], 'horizontal' => true, 'error_bubbling' => false]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_role_at_institution'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php index f60c7199..333e8297 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php @@ -28,7 +28,7 @@ class SearchRaListingType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { /** @var SearchRaListingCommand $data */ $data = $builder->getData(); @@ -53,14 +53,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SearchRaListingCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_search_ra_listing'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php index 33802be6..79b9c960 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php @@ -32,7 +32,7 @@ public function __construct(private readonly SecondFactorTypeChoiceList $secondF { } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('name', null, [ 'label' => 'ra.form.ra_search_ra_second_factors.label.name', @@ -90,7 +90,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add($buttonGroup); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SearchRaSecondFactorsCommand::class, @@ -100,7 +100,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('enable_export_button', 'bool'); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_search_ra_second_factors'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php index 8e5cd684..966f3999 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php @@ -28,7 +28,7 @@ class SearchRecoveryTokensType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('name', null, [ 'label' => 'ra.form.ra_search_recovery_tokens.label.name', @@ -80,14 +80,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add($buttonGroup); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SearchRecoveryTokensCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_search_recovery_tokens'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php index bcf2cb2d..9386e2d1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php @@ -27,7 +27,7 @@ class SelectInstitutionType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add( @@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults( [ @@ -56,7 +56,7 @@ public function configureOptions(OptionsResolver $resolver) ); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'select_institution'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php index ae1de935..3bb85d47 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php @@ -26,7 +26,7 @@ class SendSmsChallengeType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('send-challenge', SubmitType::class, [ 'label' => 'ra.form.ra_send_sms_challenge.button.send_challenge', @@ -34,14 +34,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SendSmsChallengeCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_send_sms_challenge'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php index 0f0fa4f4..96d99740 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php @@ -27,7 +27,7 @@ class StartVettingProcedureType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('registrationCode', TextType::class, [ 'label' => /** @Ignore */ false, @@ -40,14 +40,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => StartVettingProcedureCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_start_vetting_procedure'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index ffa20dc7..59568f1f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -98,7 +98,7 @@ public function authenticate(TokenInterface $token) return $authenticatedToken; } - private function getSingleStringValue($attribute, AssertionAdapter $translatedAssertion) + private function getSingleStringValue($attribute, AssertionAdapter $translatedAssertion): string { $values = $translatedAssertion->getAttributeValue($attribute); @@ -137,7 +137,7 @@ private function getSingleStringValue($attribute, AssertionAdapter $translatedAs return $value; } - public function supports(TokenInterface $token) + public function supports(TokenInterface $token): bool { return $token instanceof SamlToken; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php index d8faab32..96bb2700 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php @@ -20,23 +20,11 @@ interface SamlAuthenticationStateHandler { - /** - * @return string - */ - public function getRequestId(); + public function getRequestId(): string; - /** - * @param string $requestId - */ - public function setRequestId($requestId); + public function setRequestId(string $requestId); - /** - * @return bool - */ - public function hasRequestId(); + public function hasRequestId(): bool; - /** - * Removes the requestId from the session - */ - public function clearRequestId(); + public function clearRequestId(): void; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php index b27ebf8d..acf40313 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php @@ -51,7 +51,7 @@ public function __construct( /** * @return bool */ - public function isSamlAuthenticationInitiated() + public function isSamlAuthenticationInitiated(): bool { return $this->samlAuthenticationStateHandler->hasRequestId(); } @@ -114,7 +114,7 @@ public function processSamlResponse(Request $request): Assertion /** * Resets the SAML flow. */ - public function reset() + public function reset(): void { $this->samlAuthenticationStateHandler->clearRequestId(); } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php index ca26c389..c736ff30 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php @@ -33,7 +33,7 @@ public function __construct( /** * @return bool */ - public function sessionLifetimeWithinLimits(AuthenticatedSessionStateHandler $sessionStateHandler) + public function sessionLifetimeWithinLimits(AuthenticatedSessionStateHandler $sessionStateHandler): bool { return $this->sessionLifetimeWithinAbsoluteLimit($sessionStateHandler) && $this->sessionLifetimeWithinRelativeLimit($sessionStateHandler); @@ -42,7 +42,7 @@ public function sessionLifetimeWithinLimits(AuthenticatedSessionStateHandler $se /** * @return bool */ - public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHandler $sessionStateHandler) + public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHandler $sessionStateHandler): bool { if (!$sessionStateHandler->isAuthenticationMomentLogged()) { return true; @@ -62,7 +62,7 @@ public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHand /** * @return bool */ - public function sessionLifetimeWithinRelativeLimit(AuthenticatedSessionStateHandler $sessionStateHandler) + public function sessionLifetimeWithinRelativeLimit(AuthenticatedSessionStateHandler $sessionStateHandler): bool { if (!$sessionStateHandler->hasSeenInteraction()) { return true; diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php index 9004c047..c4cb7ae6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php @@ -95,12 +95,12 @@ public function getCurrentRequestUri(): string return $uri; } - public function getRequestId(): ?string + public function getRequestId(): string { return $this->requestStack->getSession()->get(self::SAML_SESSION_KEY . 'request_id'); } - public function setRequestId($requestId): void + public function setRequestId(string $requestId): void { $this->requestStack->getSession()->set(self::SAML_SESSION_KEY . 'request_id', $requestId); } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php index fd62ebd3..0cb7bcd1 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php @@ -47,7 +47,7 @@ public function getLoa(): Loa return $this->loa; } - public function serialize() + public function serialize(): array|string { return serialize( [ @@ -57,7 +57,7 @@ public function serialize() ); } - public function unserialize($serialized) + public function unserialize($serialized): void { [$parent, $this->loa, ] = unserialize( $serialized, diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php index 631cf17e..bbb4630d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php @@ -49,12 +49,12 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider, return [$providerId, $listenerId, $defaultEntryPoint]; } - public function getPosition() + public function getPosition(): string { return 'pre_auth'; } - public function getKey() + public function getKey(): string { return 'saml'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php index 55887ce9..a690a27a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php @@ -32,7 +32,7 @@ public function __construct(private readonly ApiAuditLogService $apiAuditLogServ /** * @return AuditLog */ - public function getAuditlog(SearchSecondFactorAuditLogCommand $command) + public function getAuditlog(SearchSecondFactorAuditLogCommand $command): AuditLog { $query = new SecondFactorAuditLogSearchQuery($command->institution, $command->identityId, $command->pageNumber); $query->setOrderBy($command->orderBy); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php index 9294bce6..a3b6387e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php @@ -32,7 +32,7 @@ public function __construct( ) { } - public function execute(Command $command) + public function execute(Command $command): \Surfnet\StepupMiddlewareClient\Service\ExecutionResult { /** @var Identity $identity */ $identity = $this->tokenStorage->getToken()->getUser(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php index 2775c63f..a191e8e0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php @@ -47,7 +47,7 @@ public function __construct(private readonly TranslatorInterface $translator, ar /** * @return string */ - public function getSupportUrl() + public function getSupportUrl(): string { return $this->supportUrl[$this->translator->getLocale()]; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index cac3b4f3..922e13e7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -31,7 +31,7 @@ public function __construct(private AttributeBagInterface $state) * @param string $gssfId * @param string $procedureId */ - public function startVerification($gssfId, $procedureId) + public function startVerification($gssfId, $procedureId): void { $this->state->set('current_verification', ['procedureId' => $procedureId, 'gssfId' => $gssfId]); } @@ -40,7 +40,7 @@ public function startVerification($gssfId, $procedureId) * @param string $gssfId * @return VerificationResult */ - public function verify($gssfId) + public function verify($gssfId): VerificationResult { $verification = $this->state->remove('current_verification'); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php index c4ccb7d4..d7f1d7a4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php @@ -33,7 +33,7 @@ public function __construct( * @param string $institution * @return null|InstitutionConfigurationOptions */ - public function getInstitutionConfigurationOptionsFor($institution) + public function getInstitutionConfigurationOptionsFor($institution): ?InstitutionConfigurationOptions { $configuration = $this->apiInstitutionConfigurationOptionsService->getInstitutionConfigurationOptionsFor($institution); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php index 7eeb755e..d94197d9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php @@ -26,5 +26,5 @@ interface InstitutionConfigurationOptionsServiceInterface * @param $institution * @return null|InstitutionConfigurationOptions */ - public function getInstitutionConfigurationOptionsFor($institution); + public function getInstitutionConfigurationOptionsFor($institution): ?InstitutionConfigurationOptions; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php index 4fdd37d1..9f624ac8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php @@ -52,7 +52,7 @@ public function find(string $id): ?RaLocation /** * @return RaLocationCollection */ - public function search(SearchRaLocationsCommand $command) + public function search(SearchRaLocationsCommand $command): RaLocationCollection { $query = new RaLocationSearchQuery($command->institution); @@ -67,7 +67,7 @@ public function search(SearchRaLocationsCommand $command) return $this->apiRaLocationService->search($query); } - public function create(CreateRaLocationCommand $command) + public function create(CreateRaLocationCommand $command): bool { $middlewareCommand = new MiddlewareCreateLocationCommand(); $middlewareCommand->id = Uuid::generate(); @@ -91,7 +91,7 @@ public function create(CreateRaLocationCommand $command) return $result->isSuccessful(); } - public function change(ChangeRaLocationCommand $command) + public function change(ChangeRaLocationCommand $command): bool { $middlewareCommand = new MiddlewareChangeRaLocationCommand(); $middlewareCommand->id = $command->id; @@ -118,7 +118,7 @@ public function change(ChangeRaLocationCommand $command) /** * @return bool */ - public function remove(RemoveRaLocationCommand $command) + public function remove(RemoveRaLocationCommand $command): bool { $middlewareCommand = new MiddlewareRemoveRaLocationCommand(); $middlewareCommand->institution = $command->institution; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php index b8321cb9..7d0c5100 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php @@ -29,7 +29,7 @@ public function __construct(private readonly LoggerInterface $logger) { } - public function export(RaSecondFactorExportCollection $collection, $fileName) + public function export(RaSecondFactorExportCollection $collection, $fileName): StreamedResponse { $this->logger->notice(sprintf('Exporting %d rows to "%s"', $collection->count(), $fileName)); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php index c19acb1c..ab7dd88e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php @@ -33,7 +33,7 @@ public function __construct(private CommandService $commandService, private Logg { } - public function amendRegistrationAuthorityInformation(AmendRegistrationAuthorityInformationCommand $command) + public function amendRegistrationAuthorityInformation(AmendRegistrationAuthorityInformationCommand $command): bool { $apiCommand = new AmendRegistrationAuthorityInformationApiCommand(); $apiCommand->identityId = $command->identityId; @@ -54,7 +54,7 @@ public function amendRegistrationAuthorityInformation(AmendRegistrationAuthority return $result->isSuccessful(); } - public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command) + public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command): bool { $apiCommand = new AppointRoleCommand(); $apiCommand->identityId = $command->identityId; @@ -74,7 +74,7 @@ public function changeRegistrationAuthorityRole(ChangeRaRoleCommand $command) return $result->isSuccessful(); } - public function retractRegistrationAuthority(RetractRegistrationAuthorityCommand $command) + public function retractRegistrationAuthority(RetractRegistrationAuthorityCommand $command): bool { $apiCommand = new ApiRetractRegistrationAuthorityCommand(); $apiCommand->identityId = $command->identityId; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php b/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php index fbb78b26..3ff7cdd8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php @@ -35,7 +35,7 @@ public function __construct( ) { } - public function revoke(RevokeRecoveryTokenCommand $command) + public function revoke(RevokeRecoveryTokenCommand $command): bool { $middlewareCommand = new RevokeRegistrantsRecoveryTokenCommand(); $middlewareCommand->recoveryTokenId = $command->recoveryTokenId; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index 0522d610..ed8a8abf 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -297,7 +297,7 @@ public function getIdentityCommonName(string $procedureId): string /** * @throws UnknownVettingProcedureException */ - public function isProvePossessionSkippable(string $procedureId): string + public function isProvePossessionSkippable(string $procedureId): ?bool { return $this->getProcedure($procedureId)->isProvePossessionSkippable(); } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php index a4b5f8f3..f6a7144c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -99,7 +99,7 @@ public function it_allows_two_enabled_second_factors() $this->assertConfigurationIsValid([['enabled_second_factors' => ['sms', 'yubikey']]], 'enabled_second_factors'); } - protected function getConfiguration() + protected function getConfiguration(): Configuration { return new Configuration(); } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php index eb31a734..cd2d7feb 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php @@ -49,32 +49,32 @@ public function __construct() $this->sessionId = bin2hex(openssl_random_pseudo_bytes(16)); } - public function start() + public function start(): true { return true; } - public function getId() + public function getId(): string { return $this->sessionId; } - public function setId($id) + public function setId($id): void { $this->sessionId = $id; } - public function getName() + public function getName(): string { return $this->sessionName; } - public function setName($name) + public function setName($name): void { $this->sessionName = $name; } - public function invalidate($lifetime = null) + public function invalidate($lifetime = null): true { $this->sessionContent = []; $this->bags = []; @@ -83,7 +83,7 @@ public function invalidate($lifetime = null) return true; } - public function migrate($destroy = false, $lifetime = null) + public function migrate($destroy = false, $lifetime = null): true { if ($destroy) { $this->sessionContent = []; @@ -100,7 +100,7 @@ public function save() // noop } - public function has($name) + public function has($name): bool { return array_key_exists($name, $this->sessionContent); } @@ -110,17 +110,17 @@ public function get($name, $default = null) return $this->has($name) ? $this->sessionContent[$name] : $default; } - public function set($name, $value) + public function set($name, $value): void { $this->sessionContent[$name] = $value; } - public function all() + public function all(): array { return $this->sessionContent; } - public function replace(array $attributes) + public function replace(array $attributes): void { $this->sessionContent = $attributes; } @@ -137,17 +137,17 @@ public function remove($name) return $return; } - public function clear() + public function clear(): void { $this->sessionContent = []; } - public function isStarted() + public function isStarted(): true { return true; } - public function registerBag(SessionBagInterface $bag) + public function registerBag(SessionBagInterface $bag): void { $this->bags[$bag->getName()] = $bag; } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php index fecab73a..ad0d8588 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php @@ -218,7 +218,7 @@ public function an_authentication_session_is_verified_against_both_limits( /** * @return array */ - public function bothLimitsVerificationProvider() + public function bothLimitsVerificationProvider(): array { $withinLimit = new DateTime(new CoreDateTime('@1001')); $overLimit = new DateTime(new CoreDateTime('@999')); @@ -237,7 +237,7 @@ public function bothLimitsVerificationProvider() * * @param DateTime|null $now */ - private function setCurrentTime(DateTime $now = null) + private function setCurrentTime(DateTime $now = null): void { $nowProperty = new ReflectionProperty(DateTime::class, 'now'); $nowProperty->setAccessible(true); @@ -250,7 +250,7 @@ private function setCurrentTime(DateTime $now = null) * @param DateTime|null $moment * @return AuthenticatedSessionStateHandler mocked */ - private function createSessionMockAuthenticatedAt(DateTime $moment = null) + private function createSessionMockAuthenticatedAt(DateTime $moment = null): AuthenticatedSessionStateHandler { $sessionMock = Mockery::mock(AuthenticatedSessionStateHandler::class); $sessionMock @@ -278,7 +278,7 @@ private function createSessionMockAuthenticatedAt(DateTime $moment = null) * @param DateTime|null $moment * @return AuthenticatedSessionStateHandler mocked */ - private function createSessionMockLastInteractionAt(DateTime $moment = null) + private function createSessionMockLastInteractionAt(DateTime $moment = null): AuthenticatedSessionStateHandler { $sessionMock = Mockery::mock(AuthenticatedSessionStateHandler::class); diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php index 80e1a56b..9e0c0de3 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php @@ -339,7 +339,7 @@ public function a_session_can_be_migrated() * * @param DateTime|null $now */ - private function setCurrentTime(DateTime $now = null) + private function setCurrentTime(DateTime $now = null): void { $nowProperty = new ReflectionProperty(DateTime::class, 'now'); $nowProperty->setAccessible(true); diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php b/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php index a7d23448..b8cfc582 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php @@ -35,7 +35,7 @@ class GuzzleApiFactory * * @see \Surfnet\StepupMiddlewareClientBundle\DependencyInjection\SurfnetStepupMiddlewareClientExtension::configureMiddlewareReadApiClient */ - public static function createApiGuzzleClient($apiUri, $username, $password) + public static function createApiGuzzleClient($apiUri, $username, $password): Client { $arguments = [ 'base_uri' => $apiUri, @@ -59,7 +59,7 @@ public static function createApiGuzzleClient($apiUri, $username, $password) * * @see \Surfnet\StepupMiddlewareClientBundle\DependencyInjection\SurfnetStepupMiddlewareClientExtension::configureMiddlewareCommandApiUrl */ - public static function createCommandGuzzleClient($apiUri) + public static function createCommandGuzzleClient($apiUri): Client { return new Client( [ @@ -73,7 +73,7 @@ public static function createCommandGuzzleClient($apiUri) * @param string $uri * @return CookieJar */ - private static function makeCookieJar($uri) + private static function makeCookieJar($uri): CookieJar { $cookieDomain = parse_url($uri, PHP_URL_HOST); diff --git a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php index 430292da..426cd0ee 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php @@ -48,7 +48,7 @@ class DateTime implements Stringable /** * @return self */ - public static function now() + public static function now(): DateTime { return self::$now ?: new self(new CoreDateTime); } @@ -57,7 +57,7 @@ public static function now() * @param string $string A date-time string formatted using `self::FORMAT` (eg. '2014-11-26T15:20:43+01:00'). * @return DateTime */ - public static function fromString($string) + public static function fromString($string): DateTime { if (!is_string($string)) { InvalidArgumentException::invalidType('string', 'string', $string); @@ -83,7 +83,7 @@ public function __construct(CoreDateTime $dateTime = null) /** * @return DateTime */ - public function add(DateInterval $interval) + public function add(DateInterval $interval): DateTime { $dateTime = clone $this->dateTime; $dateTime->add($interval); @@ -94,7 +94,7 @@ public function add(DateInterval $interval) /** * @return DateTime */ - public function sub(DateInterval $interval) + public function sub(DateInterval $interval): DateTime { $dateTime = clone $this->dateTime; $dateTime->sub($interval); @@ -105,7 +105,7 @@ public function sub(DateInterval $interval) /** * @return boolean */ - public function comesBefore(DateTime $dateTime) + public function comesBefore(DateTime $dateTime): bool { return $this->dateTime < $dateTime->dateTime; } @@ -113,7 +113,7 @@ public function comesBefore(DateTime $dateTime) /** * @return boolean */ - public function comesBeforeOrIsEqual(DateTime $dateTime) + public function comesBeforeOrIsEqual(DateTime $dateTime): bool { return $this->dateTime <= $dateTime->dateTime; } @@ -121,7 +121,7 @@ public function comesBeforeOrIsEqual(DateTime $dateTime) /** * @return boolean */ - public function comesAfter(DateTime $dateTime) + public function comesAfter(DateTime $dateTime): bool { return $this->dateTime > $dateTime->dateTime; } @@ -129,7 +129,7 @@ public function comesAfter(DateTime $dateTime) /** * @return boolean */ - public function comesAfterOrIsEqual(DateTime $dateTime) + public function comesAfterOrIsEqual(DateTime $dateTime): bool { return $this->dateTime >= $dateTime->dateTime; } @@ -138,7 +138,7 @@ public function comesAfterOrIsEqual(DateTime $dateTime) * @param $format * @return string */ - public function format($format) + public function format($format): string { $formatted = $this->dateTime->format($format); diff --git a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php index 25f71de4..a202fa7a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php @@ -35,7 +35,7 @@ class RoleAtInstitution /** * @param string $role */ - public function setRole($role) + public function setRole($role): void { Assert::nullOrString($role, 'Role must be null or a string value'); $this->role = $role; @@ -44,7 +44,7 @@ public function setRole($role) /** * @param string $institution */ - public function setInstitution($institution) + public function setInstitution($institution): void { Assert::nullOrString($institution, 'Institution must be null or a string value'); $this->institution = $institution; @@ -53,7 +53,7 @@ public function setInstitution($institution) /** * @return bool */ - public function hasRole() + public function hasRole(): bool { return !is_null($this->role); } @@ -61,7 +61,7 @@ public function hasRole() /** * @return bool */ - public function hasInstitution() + public function hasInstitution(): bool { return !is_null($this->institution); } @@ -69,7 +69,7 @@ public function hasInstitution() /** * @return string */ - public function getRole() + public function getRole(): string { return $this->role; } @@ -77,7 +77,7 @@ public function getRole() /** * @return string */ - public function getInstitution() + public function getInstitution(): string { return $this->institution; } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php index da318c3e..ce02cb70 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php @@ -27,7 +27,7 @@ */ class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('surfnet_stepup_ra_saml_stepup_provider'); $rootNode = $treeBuilder->getRootNode(); @@ -38,7 +38,7 @@ public function getConfigTreeBuilder() return $treeBuilder; } - private function addRoutesSection(ArrayNodeDefinition $rootNode) + private function addRoutesSection(ArrayNodeDefinition $rootNode): void { $rootNode ->children() @@ -62,7 +62,7 @@ private function addRoutesSection(ArrayNodeDefinition $rootNode) ->end(); } - private function addProvidersSection(ArrayNodeDefinition $rootNode) + private function addProvidersSection(ArrayNodeDefinition $rootNode): void { /** @var ArrayNodeDefinition $protoType */ $protoType = $rootNode diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php index 067a3812..0b366a3a 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php @@ -22,7 +22,7 @@ class InvalidArgumentException extends CoreInvalidArgumentException { - public static function invalidType($expectedType, $parameter, $value) + public static function invalidType($expectedType, $parameter, $value): InvalidArgumentException { return new self( sprintf( diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php index 1e8eadec..6322d1e4 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php @@ -50,7 +50,7 @@ class Metadata implements Signable, Stringable */ public $document; - public function getRootDomElement() + public function getRootDomElement(): ?\DOMElement { if (!$this->document) { throw new LogicException('Cannot get the rootElement of Metadata before the document has been generated'); @@ -59,7 +59,7 @@ public function getRootDomElement() return $this->document->documentElement; } - public function getAppendBeforeNode() + public function getAppendBeforeNode(): ?\DOMNode { if (!$this->document) { throw new LogicException( diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php index f52cb893..e5a79c0a 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php @@ -38,7 +38,7 @@ public function __construct( /** * @return StateHandler */ - public function getStateHandler() + public function getStateHandler(): StateHandler { return $this->stateHandler; } @@ -46,7 +46,7 @@ public function getStateHandler() /** * @return IdentityProvider */ - public function getRemoteIdentityProvider() + public function getRemoteIdentityProvider(): IdentityProvider { return $this->remoteIdentityProvider; } @@ -54,7 +54,7 @@ public function getRemoteIdentityProvider() /** * @return ServiceProvider */ - public function getServiceProvider() + public function getServiceProvider(): ServiceProvider { return $this->serviceProvider; } @@ -62,7 +62,7 @@ public function getServiceProvider() /** * @return string */ - public function getName() + public function getName(): string { return $this->name; } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php index 3c3ed847..2ee95173 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php @@ -34,7 +34,7 @@ public function __construct(private readonly NamespacedAttributeBag $attributeBa * @param string $originalRequestId * @return $this */ - public function setRequestId($originalRequestId) + public function setRequestId($originalRequestId): static { $this->set('request_id', $originalRequestId); @@ -44,17 +44,17 @@ public function setRequestId($originalRequestId) /** * @return string|null */ - public function getRequestId() + public function getRequestId(): ?string { return $this->get('request_id'); } - public function clear() + public function clear(): void { $this->attributeBag->remove($this->provider); } - protected function set($key, $value) + protected function set($key, $value): void { $this->attributeBag->set($this->provider . '/' . $key, $value); } From 6624e128fd063cdd76880b62922439c4f94be770 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 15:12:04 +0100 Subject: [PATCH 068/202] Add return types --- .../Command/VettingTypeHintCommand.php | 4 +- .../SurfnetStepupRaRaExtension.php | 2 +- .../RaBundle/Form/Type/VerifyIdentityType.php | 6 +- .../Form/Type/VerifyPhoneNumberType.php | 6 +- .../Form/Type/VerifyYubikeyPublicIdType.php | 6 +- .../Form/Type/VettingTypeHintType.php | 6 +- .../SamlAuthenticationStateHandler.php | 2 +- .../Authentication/Session/SessionStorage.php | 2 +- .../Service/Gssf/VerificationResult.php | 12 ++-- .../Service/VettingTypeHintService.php | 2 +- .../VerificationResult.php | 8 +-- .../Service/YubikeySecondFactorService.php | 2 +- .../RaBundle/Service/YubikeyService.php | 2 +- .../Service/YubikeyVerificationResult.php | 6 +- .../Tests/Service/VettingServiceTest.php | 6 +- .../RaBundle/Tests/Value/TimeFrameTest.php | 2 +- .../StepupRa/RaBundle/Value/TimeFrame.php | 6 +- .../Compiler/StateHandlerSessionPass.php | 2 +- .../Compiler/ViewConfigCollectionPass.php | 2 +- ...netStepupRaSamlStepupProviderExtension.php | 9 +-- .../Provider/ViewConfig.php | 68 +++---------------- ...urfnetStepupRaSamlStepupProviderBundle.php | 2 +- .../Tests/Provider/ViewConfigTest.php | 9 +-- 23 files changed, 62 insertions(+), 110 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php index 305e2fb2..f0cfb938 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php @@ -99,7 +99,7 @@ public function __isset($name): bool * Based on the languages that are configured on the application eg: nl_NL or en_EN,.. * test if the passed parameter contains a valid language identifier. */ - private function assertValidLanguageInName($name) + private function assertValidLanguageInName($name): void { $locale = $this->extractLocaleFromFormFieldName($name); if (!in_array($locale, $this->locales, true)) { @@ -138,7 +138,7 @@ private function extractLocaleFromFormFieldName(string $name): string return $matches[1]; } - public function setHints(array $hints) + public function setHints(array $hints): void { foreach ($hints as $hint) { $this->hints[$hint['locale']] = $hint['hint']; diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php index 207944d9..b6320c11 100644 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php +++ b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php @@ -28,7 +28,7 @@ class SurfnetStepupRaRaExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php index 612bf577..27c2e071 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php @@ -28,7 +28,7 @@ class VerifyIdentityType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('documentNumber', TextType::class, [ 'label' => 'ra.form.verify_identity.document_number.label', @@ -52,14 +52,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => VerifyIdentityCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_verify_identity'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php index d0066daa..a07b3a50 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php @@ -27,7 +27,7 @@ class VerifyPhoneNumberType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('challenge', TextType::class, [ 'label' => 'ra.form.ra_verify_phone_number.text.challenge', @@ -50,7 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => VerifyPossessionOfPhoneCommand::class, @@ -62,7 +62,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('procedureId', 'string'); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_verify_phone_number'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php index 0d7e2393..b8250e6c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php @@ -25,19 +25,19 @@ class VerifyYubikeyPublicIdType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('otp', OtpType::class); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => VerifyYubikeyPublicIdCommand::class, ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ra_verify_yubikey_public_id'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php index 9d116e9b..f7aae3d5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php @@ -30,7 +30,7 @@ class VettingTypeHintType extends AbstractType { final public const HINT_TEXTAREA_NAME_PREFIX = 'vetting_type_hint_'; - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { foreach ($builder->getData()->locales as $locale) { $builder @@ -58,7 +58,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults( [ @@ -67,7 +67,7 @@ public function configureOptions(OptionsResolver $resolver) ); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'vetting_type_hint'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php index 96bb2700..2fc253f2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php @@ -20,7 +20,7 @@ interface SamlAuthenticationStateHandler { - public function getRequestId(): string; + public function getRequestId(): ?string; public function setRequestId(string $requestId); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php index c4cb7ae6..53836945 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php @@ -95,7 +95,7 @@ public function getCurrentRequestUri(): string return $uri; } - public function getRequestId(): string + public function getRequestId(): ?string { return $this->requestStack->getSession()->get(self::SAML_SESSION_KEY . 'request_id'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php index 1996fd3d..0a6f911d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php @@ -36,7 +36,7 @@ final class VerificationResult * @param string $procedureId * @return VerificationResult */ - public static function verificationSucceeded($procedureId) + public static function verificationSucceeded($procedureId): VerificationResult { if (!is_string($procedureId)) { throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); @@ -49,7 +49,7 @@ public static function verificationSucceeded($procedureId) return $result; } - public static function noSuchProcedure() + public static function noSuchProcedure(): VerificationResult { $result = new self(); $result->verificationSucceeded = false; @@ -61,7 +61,7 @@ public static function noSuchProcedure() * @param string $procedureId * @return VerificationResult */ - public static function verificationFailed($procedureId) + public static function verificationFailed($procedureId): VerificationResult { if (!is_string($procedureId)) { throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); @@ -77,7 +77,7 @@ public static function verificationFailed($procedureId) /** * @return bool */ - public function isSuccess() + public function isSuccess(): bool { return $this->verificationSucceeded && $this->procedureId; } @@ -85,7 +85,7 @@ public function isSuccess() /** * @return bool */ - public function didVerificationSucceed() + public function didVerificationSucceed(): bool { return $this->verificationSucceeded; } @@ -93,7 +93,7 @@ public function didVerificationSucceed() /** * @return null|string NULL if no procedure ID was known for given SAML request ID. */ - public function getProcedureId() + public function getProcedureId(): ?string { return $this->procedureId; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php index a0c097c2..f941cb40 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php @@ -34,7 +34,7 @@ public function __construct( ) { } - public function save(VettingTypeHintCommand $command) + public function save(VettingTypeHintCommand $command): bool { $middlewareCommand = new SaveVettingTypeHintCommand(); $middlewareCommand->identityId = $command->identityId; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php index 6c106618..b7222e45 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php @@ -53,17 +53,17 @@ public function __construct($result, private readonly ?YubikeyPublicId $publicId $this->result = $result; } - public function didPublicIdMatch() + public function didPublicIdMatch(): bool { return $this->result === self::RESULT_PUBLIC_ID_MATCHED && $this->publicId !== null; } - public function wasOtpInvalid() + public function wasOtpInvalid(): bool { return $this->result === self::RESULT_OTP_INVALID; } - public function didOtpVerificationFail() + public function didOtpVerificationFail(): bool { return $this->result === self::RESULT_OTP_VERIFICATION_FAILED; } @@ -71,7 +71,7 @@ public function didOtpVerificationFail() /** * @return YubikeyPublicId|null */ - public function getPublicId() + public function getPublicId(): ?YubikeyPublicId { return $this->publicId; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php index 95687fcc..e45844f8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php @@ -36,7 +36,7 @@ public function __construct( /** * @return VerificationResult */ - public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command) + public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command): VerificationResult { $verifyOtpCommand = new VerifyYubikeyOtpCommand(); $verifyOtpCommand->otp = $command->otp; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php index f32b1113..7f5a97b8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php @@ -36,7 +36,7 @@ public function __construct(private readonly Client $guzzleClient, private reado /** * @return YubikeyVerificationResult */ - public function verify(VerifyYubikeyOtpCommand $command) + public function verify(VerifyYubikeyOtpCommand $command): YubikeyVerificationResult { $this->logger->info('Verifying Yubikey OTP'); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php index 09598252..0299df6a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php @@ -31,7 +31,7 @@ public function __construct(private $clientError, private $serverError) /** * @return bool */ - public function isSuccessful() + public function isSuccessful(): bool { return !$this->clientError && !$this->serverError; } @@ -39,7 +39,7 @@ public function isSuccessful() /** * @return boolean */ - public function isClientError() + public function isClientError(): bool { return $this->clientError; } @@ -47,7 +47,7 @@ public function isClientError() /** * @return boolean */ - public function isServerError() + public function isServerError(): bool { return $this->serverError; } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php index 6dcd3c39..84f12a7d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php @@ -44,7 +44,8 @@ public function registration_code_is_valid_within_two_weeks_after_verification($ ); } - public function validRegistrationDatesProvider() { + public function validRegistrationDatesProvider(): array + { return [ [date_create('- 1 week')], [date_create('- 2 weeks')], @@ -71,7 +72,8 @@ public function registration_code_is_invalid_two_weeks_after_verification($regis ); } - public function expiredRegistrationDatesProvider() { + public function expiredRegistrationDatesProvider(): array + { return [ [date_create('- 3 weeks')], [date_create('- 15 days')->setTime(0, 0, 0)], diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php index 38ac9ea9..28a7898d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php @@ -59,7 +59,7 @@ public function to_string_output_matches_amount_of_seconds_as_string() /** * @return array */ - public function notPositiveIntegerProvider() + public function notPositiveIntegerProvider(): array { return [ 'empty string' => [''], diff --git a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php index 758cc984..98465556 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php @@ -32,7 +32,7 @@ final private function __construct(private DateInterval $timeFrame) * @param int $seconds * @return TimeFrame */ - public static function ofSeconds($seconds) + public static function ofSeconds($seconds): TimeFrame { if (!is_int($seconds) || $seconds < 1) { throw InvalidArgumentException::invalidType('positive integer', 'seconds', $seconds); @@ -44,7 +44,7 @@ public static function ofSeconds($seconds) /** * @return DateTime */ - public function getEndWhenStartingAt(DateTime $dateTime) + public function getEndWhenStartingAt(DateTime $dateTime): DateTime { return $dateTime->add($this->timeFrame); } @@ -52,7 +52,7 @@ public function getEndWhenStartingAt(DateTime $dateTime) /** * @return bool */ - public function equals(TimeFrame $other) + public function equals(TimeFrame $other): bool { return $this->timeFrame->s === $other->timeFrame->s; } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php index 28d5c916..81420b1c 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php @@ -28,7 +28,7 @@ class StateHandlerSessionPass implements CompilerPassInterface * {@inheritdoc} This is required to ensure that our NamespacedAttributeBag is registered in the session handler * before the session is started. */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $container ->getDefinition('session') diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php index 12f930df..4b8e7790 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php @@ -29,7 +29,7 @@ class ViewConfigCollectionPass implements CompilerPassInterface /** * @param ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->has('surfnet_stepup.provider.collection')) { return; diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index 90395d1c..292c31f5 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -117,7 +117,8 @@ private function createHostedDefinitions( array $configuration, array $routes, ContainerBuilder $container, - ) { + ): void + { $hostedDefinition = $this->buildHostedEntityDefinition($provider, $configuration, $routes); $container->setDefinition('gssp.provider.' . $provider . '.hosted_entities', $hostedDefinition); @@ -135,7 +136,7 @@ private function createHostedDefinitions( * @param string $provider * @return Definition */ - private function buildHostedEntityDefinition($provider, array $configuration, array $routes) + private function buildHostedEntityDefinition($provider, array $configuration, array $routes): Definition { $entityId = ['entity_id_route' => $this->createRouteConfig($provider, $routes['metadata'])]; $spAdditional = [ @@ -164,7 +165,7 @@ private function buildHostedEntityDefinition($provider, array $configuration, ar /** * @param string $provider */ - private function createRemoteDefinition($provider, array $configuration, ContainerBuilder $container) + private function createRemoteDefinition($provider, array $configuration, ContainerBuilder $container): void { $definition = new Definition(IdentityProvider::class, [ [ @@ -209,7 +210,7 @@ private function createMetadataDefinition( $container->setDefinition('gssp.provider.' . $provider . '.metadata.factory', $metadataFactory); } - private function createRouteConfig($provider, $routeName) + private function createRouteConfig($provider, $routeName): array { // In the future, we ought to wrap this in an object. // https://www.pivotaltracker.com/story/show/90095392 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index ec56657f..588c7063 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -24,31 +24,6 @@ class ViewConfig implements ViewConfigInterface { - /** - * @var array - */ - public $title; - - /** - * @var array - */ - public $pageTitle; - - /** - * @var array - */ - public $explanation; - - /** - * @var array - */ - public $initiate; - - /** - * @var array - */ - public $gssfIdMismatch; - /** * The arrays are arrays of translated text, indexed on locale. * @@ -56,64 +31,43 @@ class ViewConfig implements ViewConfigInterface */ public function __construct( private readonly RequestStack $requestStack, - array $title, - array $pageTitle, - array $explanation, - array $initiate, - array $gssfIdMismatch, + public array $title, + public array $pageTitle, + public array $explanation, + public array $initiate, + public array $gssfIdMismatch, ) { - $this->title = $title; - $this->pageTitle = $pageTitle; - $this->explanation = $explanation; - $this->initiate = $initiate; - $this->gssfIdMismatch = $gssfIdMismatch; } - /** - * @return array - */ - public function getTitle() + public function getTitle(): string { return $this->getTranslation($this->title); } - /** - * @return array - */ - public function getExplanation() + public function getExplanation(): string { return $this->getTranslation($this->explanation); } - /** - * @return array - */ - public function getGssfIdMismatch() + public function getGssfIdMismatch(): string { return $this->getTranslation($this->gssfIdMismatch); } - /** - * @return array - */ - public function getInitiate() + public function getInitiate(): string { return $this->getTranslation($this->initiate); } - /** - * @return array - */ - public function getPageTitle() + public function getPageTitle(): string { return $this->getTranslation($this->pageTitle); } /** - * @return mixed * @throws LogicException */ - private function getTranslation(array $translations) + private function getTranslation(array $translations): mixed { $currentLocale = $this->requestStack->getCurrentRequest()->getLocale(); if (is_null($currentLocale)) { diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php index 04189bda..85a7927c 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php @@ -25,7 +25,7 @@ class SurfnetStepupRaSamlStepupProviderBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new StateHandlerSessionPass()); $container->addCompilerPass(new ViewConfigCollectionPass()); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php index da21f29d..3a3d1b94 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php @@ -78,11 +78,7 @@ public function view_config_cannot_serve_french_translations() $viewConfig->getGssfIdMismatch(); } - /** - * @param string $locale - * @return ViewConfig - */ - private function buildViewConfig($locale = '') + private function buildViewConfig(?string $locale = ''): ViewConfig { $request = m::mock(RequestStack::class); $request->shouldReceive('getCurrentRequest->getLocale')->andReturn($locale)->byDefault(); @@ -98,9 +94,8 @@ private function buildViewConfig($locale = '') /** * @param $string - * @return array */ - private function getTranslationsArray($string) + private function getTranslationsArray($string): array { return [ 'en_GB' => 'EN ' . $string, From 207795414609cd36b43813a4ada0b2ee71c70ccf Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 15:13:09 +0100 Subject: [PATCH 069/202] Removed unused imports --- composer.json | 5 +++-- .../StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php | 1 - .../StepupRa/RaBundle/Controller/LocaleController.php | 1 - .../StepupRa/RaBundle/Controller/SecondFactorController.php | 1 - src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php | 6 ------ .../StepupRa/RaBundle/Logger/ProcedureAwareLogger.php | 1 - .../Security/Authentication/Session/SessionStorage.php | 1 - src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php | 1 - src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php | 1 - .../StepupRa/RaBundle/Service/RaCandidateService.php | 1 - 10 files changed, 3 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index ea506781..fc364419 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,6 @@ "nelmio/security-bundle": "^2.12", "openconext/monitor-bundle": "^3.0", "ramsey/uuid": "^3.5", - "sensio/framework-extra-bundle": "^5.5", "sensiolabs/security-checker": "^6.0", "surfnet/stepup-bundle": "^5.0", "surfnet/stepup-middleware-client-bundle": "^4.1", @@ -40,7 +39,9 @@ "twbs/bootstrap": "~3.3.0", "twig/extensions": "~1.5", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "ext-openssl": "*", + "ext-dom": "*" }, "require-dev": { "matthiasnoback/symfony-config-test": "^4.0", diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php index 3a338b79..219b5e35 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php @@ -18,7 +18,6 @@ namespace Surfnet\StepupRa\RaBundle\Command; -use AllowDynamicProperties; use Symfony\Component\Validator\Constraints as Assert; class SearchRaCandidatesCommand diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 49598a62..376ae5bf 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -22,7 +22,6 @@ use Surfnet\StepupBundle\Command\SwitchLocaleCommand; use Surfnet\StepupBundle\Form\Type\SwitchLocaleType; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; -use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 0a72795e..fbe7b372 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -28,7 +28,6 @@ use Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType; use Surfnet\StepupRa\RaBundle\Form\Type\SearchRaSecondFactorsType; use Surfnet\StepupRa\RaBundle\Service\AuditLogService; -use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Surfnet\StepupRa\RaBundle\Service\RaSecondFactorService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php index 7d996cdc..f4bbbdb0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php @@ -18,13 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; -use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\ButtonTypeInterface; -use Symfony\Component\Form\Extension\Core\Type\ButtonType; use Symfony\Component\Form\Extension\Core\Type\FormType; -use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormView; -use Symfony\Component\OptionsResolver\OptionsResolver; class ButtonGroupType extends FormType { diff --git a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php index 439cbad9..e16f1838 100644 --- a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php +++ b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php @@ -19,7 +19,6 @@ namespace Surfnet\StepupRa\RaBundle\Logger; use Psr\Log\LoggerInterface; -use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; /** diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php index 53836945..12cd95b0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php @@ -25,7 +25,6 @@ use Surfnet\StepupRa\RaBundle\Security\Authentication\SamlAuthenticationStateHandler; use Surfnet\StepupRa\RaBundle\Value\DateTime; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Session\SessionInterface; class SessionStorage implements AuthenticatedSessionStateHandler, SamlAuthenticationStateHandler { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index fbf23498..ecb0112e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -28,7 +28,6 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Service\IdentityService as ApiIdentityService; use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php index 8b533307..dc6b6e25 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php @@ -18,7 +18,6 @@ namespace Surfnet\StepupRa\RaBundle\Service; -use Psr\Log\LoggerInterface; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Profile; use Surfnet\StepupMiddlewareClientBundle\Identity\Service\ProfileService as ApiProfileService; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php index d1b057b3..72baa224 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php @@ -30,7 +30,6 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Service\RaCandidateService as ApiRaCandidateService; use Surfnet\StepupRa\RaBundle\Command\AccreditCandidateCommand; use Surfnet\StepupRa\RaBundle\Command\SearchRaCandidatesCommand; -use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) From 5b915e8a03cc90982cd7fb3886429dbeb49f7df7 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 15:38:30 +0100 Subject: [PATCH 070/202] Removed unused moment installation --- .../Resources/public/js/moment/.bower.json | 34 - .../Resources/public/js/moment/CHANGELOG.md | 535 - .../Resources/public/js/moment/LICENSE | 22 - .../Resources/public/js/moment/README.md | 58 - .../Resources/public/js/moment/bower.json | 22 - .../Resources/public/js/moment/locale/af.js | 73 - .../public/js/moment/locale/ar-ma.js | 60 - .../public/js/moment/locale/ar-sa.js | 104 - .../public/js/moment/locale/ar-tn.js | 58 - .../Resources/public/js/moment/locale/ar.js | 137 - .../Resources/public/js/moment/locale/az.js | 105 - .../Resources/public/js/moment/locale/be.js | 134 - .../Resources/public/js/moment/locale/bg.js | 90 - .../Resources/public/js/moment/locale/bn.js | 119 - .../Resources/public/js/moment/locale/bo.js | 119 - .../Resources/public/js/moment/locale/br.js | 108 - .../Resources/public/js/moment/locale/bs.js | 143 - .../Resources/public/js/moment/locale/ca.js | 81 - .../Resources/public/js/moment/locale/cs.js | 171 - .../Resources/public/js/moment/locale/cv.js | 63 - .../Resources/public/js/moment/locale/cy.js | 80 - .../Resources/public/js/moment/locale/da.js | 60 - .../public/js/moment/locale/de-at.js | 79 - .../Resources/public/js/moment/locale/de.js | 78 - .../Resources/public/js/moment/locale/dv.js | 99 - .../Resources/public/js/moment/locale/el.js | 98 - .../public/js/moment/locale/en-au.js | 66 - .../public/js/moment/locale/en-ca.js | 63 - .../public/js/moment/locale/en-gb.js | 67 - .../public/js/moment/locale/en-ie.js | 67 - .../public/js/moment/locale/en-nz.js | 66 - .../Resources/public/js/moment/locale/eo.js | 73 - .../Resources/public/js/moment/locale/es.js | 81 - .../Resources/public/js/moment/locale/et.js | 80 - .../Resources/public/js/moment/locale/eu.js | 66 - .../Resources/public/js/moment/locale/fa.js | 106 - .../Resources/public/js/moment/locale/fi.js | 107 - .../Resources/public/js/moment/locale/fo.js | 60 - .../public/js/moment/locale/fr-ca.js | 60 - .../public/js/moment/locale/fr-ch.js | 64 - .../Resources/public/js/moment/locale/fr.js | 64 - .../Resources/public/js/moment/locale/fy.js | 73 - .../Resources/public/js/moment/locale/gd.js | 76 - .../Resources/public/js/moment/locale/gl.js | 77 - .../Resources/public/js/moment/locale/he.js | 99 - .../Resources/public/js/moment/locale/hi.js | 124 - .../Resources/public/js/moment/locale/hr.js | 145 - .../Resources/public/js/moment/locale/hu.js | 109 - .../public/js/moment/locale/hy-am.js | 95 - .../Resources/public/js/moment/locale/id.js | 83 - .../Resources/public/js/moment/locale/is.js | 127 - .../Resources/public/js/moment/locale/it.js | 70 - .../Resources/public/js/moment/locale/ja.js | 76 - .../Resources/public/js/moment/locale/jv.js | 83 - .../Resources/public/js/moment/locale/ka.js | 89 - .../Resources/public/js/moment/locale/kk.js | 87 - .../Resources/public/js/moment/locale/km.js | 58 - .../Resources/public/js/moment/locale/ko.js | 68 - .../Resources/public/js/moment/locale/ky.js | 88 - .../Resources/public/js/moment/locale/lb.js | 136 - .../Resources/public/js/moment/locale/lo.js | 70 - .../Resources/public/js/moment/locale/lt.js | 116 - .../Resources/public/js/moment/locale/lv.js | 97 - .../Resources/public/js/moment/locale/me.js | 111 - .../Resources/public/js/moment/locale/mk.js | 90 - .../Resources/public/js/moment/locale/ml.js | 81 - .../Resources/public/js/moment/locale/mr.js | 159 - .../public/js/moment/locale/ms-my.js | 82 - .../Resources/public/js/moment/locale/ms.js | 82 - .../Resources/public/js/moment/locale/my.js | 93 - .../Resources/public/js/moment/locale/nb.js | 63 - .../Resources/public/js/moment/locale/ne.js | 123 - .../Resources/public/js/moment/locale/nl.js | 73 - .../Resources/public/js/moment/locale/nn.js | 60 - .../public/js/moment/locale/pa-in.js | 124 - .../Resources/public/js/moment/locale/pl.js | 105 - .../public/js/moment/locale/pt-br.js | 61 - .../Resources/public/js/moment/locale/pt.js | 65 - .../Resources/public/js/moment/locale/ro.js | 75 - .../Resources/public/js/moment/locale/ru.js | 175 - .../Resources/public/js/moment/locale/se.js | 61 - .../Resources/public/js/moment/locale/si.js | 71 - .../Resources/public/js/moment/locale/sk.js | 150 - .../Resources/public/js/moment/locale/sl.js | 162 - .../Resources/public/js/moment/locale/sq.js | 70 - .../public/js/moment/locale/sr-cyrl.js | 110 - .../Resources/public/js/moment/locale/sr.js | 110 - .../Resources/public/js/moment/locale/ss.js | 89 - .../Resources/public/js/moment/locale/sv.js | 69 - .../Resources/public/js/moment/locale/sw.js | 59 - .../Resources/public/js/moment/locale/ta.js | 129 - .../Resources/public/js/moment/locale/te.js | 89 - .../Resources/public/js/moment/locale/th.js | 67 - .../public/js/moment/locale/tl-ph.js | 62 - .../Resources/public/js/moment/locale/tlh.js | 120 - .../Resources/public/js/moment/locale/tr.js | 90 - .../Resources/public/js/moment/locale/tzl.js | 91 - .../public/js/moment/locale/tzm-latn.js | 58 - .../Resources/public/js/moment/locale/tzm.js | 58 - .../Resources/public/js/moment/locale/uk.js | 146 - .../Resources/public/js/moment/locale/uz.js | 58 - .../Resources/public/js/moment/locale/vi.js | 79 - .../public/js/moment/locale/x-pseudo.js | 68 - .../public/js/moment/locale/zh-cn.js | 127 - .../public/js/moment/locale/zh-tw.js | 101 - .../Resources/public/js/moment/min/locales.js | 8021 -- .../public/js/moment/min/locales.min.js | 73 - .../js/moment/min/moment-with-locales.js | 12051 --- .../js/moment/min/moment-with-locales.min.js | 76 - .../public/js/moment/min/moment.min.js | 7 - .../Resources/public/js/moment/min/tests.js | 72632 ---------------- .../Resources/public/js/moment/moment.d.ts | 512 - .../Resources/public/js/moment/moment.js | 4040 - .../moment/src/lib/create/check-overflow.js | 34 - .../moment/src/lib/create/date-from-array.js | 21 - .../js/moment/src/lib/create/from-anything.js | 101 - .../js/moment/src/lib/create/from-array.js | 136 - .../js/moment/src/lib/create/from-object.js | 16 - .../src/lib/create/from-string-and-array.js | 50 - .../src/lib/create/from-string-and-format.js | 107 - .../js/moment/src/lib/create/from-string.js | 120 - .../public/js/moment/src/lib/create/local.js | 5 - .../js/moment/src/lib/create/parsing-flags.js | 24 - .../public/js/moment/src/lib/create/utc.js | 5 - .../public/js/moment/src/lib/create/valid.js | 42 - .../public/js/moment/src/lib/duration/abs.js | 18 - .../moment/src/lib/duration/add-subtract.js | 21 - .../public/js/moment/src/lib/duration/as.js | 55 - .../js/moment/src/lib/duration/bubble.js | 61 - .../js/moment/src/lib/duration/constructor.js | 41 - .../js/moment/src/lib/duration/create.js | 118 - .../js/moment/src/lib/duration/duration.js | 12 - .../public/js/moment/src/lib/duration/get.js | 25 - .../js/moment/src/lib/duration/humanize.js | 64 - .../js/moment/src/lib/duration/iso-string.js | 52 - .../js/moment/src/lib/duration/prototype.js | 48 - .../public/js/moment/src/lib/format/format.js | 91 - .../js/moment/src/lib/locale/calendar.js | 15 - .../js/moment/src/lib/locale/constructor.js | 5 - .../public/js/moment/src/lib/locale/en.js | 15 - .../js/moment/src/lib/locale/formats.js | 23 - .../js/moment/src/lib/locale/invalid.js | 5 - .../public/js/moment/src/lib/locale/lists.js | 92 - .../public/js/moment/src/lib/locale/locale.js | 39 - .../js/moment/src/lib/locale/locales.js | 164 - .../js/moment/src/lib/locale/ordinal.js | 7 - .../moment/src/lib/locale/pre-post-format.js | 3 - .../js/moment/src/lib/locale/prototype.js | 87 - .../js/moment/src/lib/locale/relative.js | 29 - .../public/js/moment/src/lib/locale/set.js | 38 - .../js/moment/src/lib/moment/add-subtract.js | 54 - .../js/moment/src/lib/moment/calendar.js | 21 - .../public/js/moment/src/lib/moment/clone.js | 5 - .../js/moment/src/lib/moment/compare.js | 59 - .../js/moment/src/lib/moment/constructor.js | 74 - .../js/moment/src/lib/moment/creation-data.js | 9 - .../public/js/moment/src/lib/moment/diff.js | 62 - .../public/js/moment/src/lib/moment/format.js | 32 - .../public/js/moment/src/lib/moment/from.js | 17 - .../js/moment/src/lib/moment/get-set.js | 43 - .../public/js/moment/src/lib/moment/locale.js | 34 - .../js/moment/src/lib/moment/min-max.js | 63 - .../public/js/moment/src/lib/moment/moment.js | 28 - .../public/js/moment/src/lib/moment/now.js | 3 - .../js/moment/src/lib/moment/prototype.js | 149 - .../js/moment/src/lib/moment/start-end-of.js | 59 - .../js/moment/src/lib/moment/to-type.js | 34 - .../public/js/moment/src/lib/moment/to.js | 17 - .../public/js/moment/src/lib/moment/valid.js | 15 - .../public/js/moment/src/lib/parse/regex.js | 54 - .../public/js/moment/src/lib/parse/token.js | 32 - .../public/js/moment/src/lib/units/aliases.js | 29 - .../js/moment/src/lib/units/constants.js | 9 - .../js/moment/src/lib/units/day-of-month.js | 32 - .../js/moment/src/lib/units/day-of-week.js | 331 - .../js/moment/src/lib/units/day-of-year.js | 32 - .../public/js/moment/src/lib/units/hour.js | 134 - .../js/moment/src/lib/units/millisecond.js | 64 - .../public/js/moment/src/lib/units/minute.js | 24 - .../public/js/moment/src/lib/units/month.js | 261 - .../public/js/moment/src/lib/units/offset.js | 219 - .../public/js/moment/src/lib/units/quarter.js | 27 - .../public/js/moment/src/lib/units/second.js | 24 - .../js/moment/src/lib/units/timestamp.js | 20 - .../js/moment/src/lib/units/timezone.js | 16 - .../public/js/moment/src/lib/units/units.js | 20 - .../src/lib/units/week-calendar-utils.js | 65 - .../js/moment/src/lib/units/week-year.js | 100 - .../public/js/moment/src/lib/units/week.js | 61 - .../public/js/moment/src/lib/units/year.js | 70 - .../js/moment/src/lib/utils/abs-ceil.js | 7 - .../js/moment/src/lib/utils/abs-floor.js | 7 - .../js/moment/src/lib/utils/abs-round.js | 7 - .../js/moment/src/lib/utils/compare-arrays.js | 16 - .../js/moment/src/lib/utils/defaults.js | 10 - .../js/moment/src/lib/utils/deprecate.js | 40 - .../public/js/moment/src/lib/utils/extend.js | 19 - .../js/moment/src/lib/utils/has-own-prop.js | 3 - .../public/js/moment/src/lib/utils/hooks.js | 13 - .../js/moment/src/lib/utils/index-of.js | 18 - .../js/moment/src/lib/utils/is-array.js | 3 - .../public/js/moment/src/lib/utils/is-date.js | 3 - .../js/moment/src/lib/utils/is-function.js | 3 - .../js/moment/src/lib/utils/is-object.js | 3 - .../js/moment/src/lib/utils/is-undefined.js | 3 - .../public/js/moment/src/lib/utils/keys.js | 19 - .../public/js/moment/src/lib/utils/map.js | 7 - .../public/js/moment/src/lib/utils/some.js | 19 - .../public/js/moment/src/lib/utils/to-int.js | 12 - .../js/moment/src/lib/utils/zero-fill.js | 7 - .../public/js/moment/src/locale/af.js | 63 - .../public/js/moment/src/locale/ar-ma.js | 51 - .../public/js/moment/src/locale/ar-sa.js | 95 - .../public/js/moment/src/locale/ar-tn.js | 49 - .../public/js/moment/src/locale/ar.js | 128 - .../public/js/moment/src/locale/az.js | 96 - .../public/js/moment/src/locale/be.js | 125 - .../public/js/moment/src/locale/bg.js | 81 - .../public/js/moment/src/locale/bn.js | 110 - .../public/js/moment/src/locale/bo.js | 110 - .../public/js/moment/src/locale/br.js | 99 - .../public/js/moment/src/locale/bs.js | 134 - .../public/js/moment/src/locale/ca.js | 72 - .../public/js/moment/src/locale/cs.js | 162 - .../public/js/moment/src/locale/cv.js | 53 - .../public/js/moment/src/locale/cy.js | 71 - .../public/js/moment/src/locale/da.js | 51 - .../public/js/moment/src/locale/de-at.js | 69 - .../public/js/moment/src/locale/de.js | 68 - .../public/js/moment/src/locale/dv.js | 89 - .../public/js/moment/src/locale/el.js | 86 - .../public/js/moment/src/locale/en-au.js | 57 - .../public/js/moment/src/locale/en-ca.js | 53 - .../public/js/moment/src/locale/en-gb.js | 58 - .../public/js/moment/src/locale/en-ie.js | 58 - .../public/js/moment/src/locale/en-nz.js | 56 - .../public/js/moment/src/locale/eo.js | 64 - .../public/js/moment/src/locale/es.js | 72 - .../public/js/moment/src/locale/et.js | 71 - .../public/js/moment/src/locale/eu.js | 57 - .../public/js/moment/src/locale/fa.js | 97 - .../public/js/moment/src/locale/fi.js | 98 - .../public/js/moment/src/locale/fo.js | 51 - .../public/js/moment/src/locale/fr-ca.js | 51 - .../public/js/moment/src/locale/fr-ch.js | 55 - .../public/js/moment/src/locale/fr.js | 55 - .../public/js/moment/src/locale/fy.js | 64 - .../public/js/moment/src/locale/gd.js | 67 - .../public/js/moment/src/locale/gl.js | 68 - .../public/js/moment/src/locale/he.js | 90 - .../public/js/moment/src/locale/hi.js | 115 - .../public/js/moment/src/locale/hr.js | 136 - .../public/js/moment/src/locale/hu.js | 100 - .../public/js/moment/src/locale/hy-am.js | 86 - .../public/js/moment/src/locale/id.js | 74 - .../public/js/moment/src/locale/is.js | 118 - .../public/js/moment/src/locale/it.js | 61 - .../public/js/moment/src/locale/ja.js | 67 - .../public/js/moment/src/locale/jv.js | 73 - .../public/js/moment/src/locale/ka.js | 80 - .../public/js/moment/src/locale/kk.js | 77 - .../public/js/moment/src/locale/km.js | 49 - .../public/js/moment/src/locale/ko.js | 59 - .../public/js/moment/src/locale/ky.js | 78 - .../public/js/moment/src/locale/lb.js | 127 - .../public/js/moment/src/locale/lo.js | 61 - .../public/js/moment/src/locale/lt.js | 107 - .../public/js/moment/src/locale/lv.js | 88 - .../public/js/moment/src/locale/me.js | 101 - .../public/js/moment/src/locale/mk.js | 81 - .../public/js/moment/src/locale/ml.js | 72 - .../public/js/moment/src/locale/mr.js | 150 - .../public/js/moment/src/locale/ms-my.js | 73 - .../public/js/moment/src/locale/ms.js | 73 - .../public/js/moment/src/locale/my.js | 84 - .../public/js/moment/src/locale/nb.js | 54 - .../public/js/moment/src/locale/ne.js | 114 - .../public/js/moment/src/locale/nl.js | 64 - .../public/js/moment/src/locale/nn.js | 51 - .../public/js/moment/src/locale/pa-in.js | 115 - .../public/js/moment/src/locale/pl.js | 95 - .../public/js/moment/src/locale/pt-br.js | 52 - .../public/js/moment/src/locale/pt.js | 56 - .../public/js/moment/src/locale/ro.js | 66 - .../public/js/moment/src/locale/ru.js | 165 - .../public/js/moment/src/locale/se.js | 51 - .../public/js/moment/src/locale/si.js | 61 - .../public/js/moment/src/locale/sk.js | 141 - .../public/js/moment/src/locale/sl.js | 152 - .../public/js/moment/src/locale/sq.js | 61 - .../public/js/moment/src/locale/sr-cyrl.js | 101 - .../public/js/moment/src/locale/sr.js | 101 - .../public/js/moment/src/locale/ss.js | 80 - .../public/js/moment/src/locale/sv.js | 60 - .../public/js/moment/src/locale/sw.js | 50 - .../public/js/moment/src/locale/ta.js | 120 - .../public/js/moment/src/locale/te.js | 79 - .../public/js/moment/src/locale/th.js | 58 - .../public/js/moment/src/locale/tl-ph.js | 53 - .../public/js/moment/src/locale/tlh.js | 110 - .../public/js/moment/src/locale/tr.js | 81 - .../public/js/moment/src/locale/tzl.js | 82 - .../public/js/moment/src/locale/tzm-latn.js | 49 - .../public/js/moment/src/locale/tzm.js | 49 - .../public/js/moment/src/locale/uk.js | 137 - .../public/js/moment/src/locale/uz.js | 49 - .../public/js/moment/src/locale/vi.js | 70 - .../public/js/moment/src/locale/x-pseudo.js | 58 - .../public/js/moment/src/locale/zh-cn.js | 118 - .../public/js/moment/src/locale/zh-tw.js | 91 - .../Resources/public/js/moment/src/moment.js | 75 - .../public/js/moment/templates/amd-named.js | 7 - .../public/js/moment/templates/amd.js | 7 - .../public/js/moment/templates/default.js | 5 - .../public/js/moment/templates/globals.js | 5 - .../js/moment/templates/locale-header.js | 6 - .../public/js/moment/templates/test-header.js | 6 - .../RaBundle/Resources/public/js/stepup-ra.js | 2 + webpack.config.js | 2 +- 319 files changed, 3 insertions(+), 119904 deletions(-) delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/.bower.json delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/CHANGELOG.md delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/LICENSE delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/README.md delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/bower.json delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/af.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-ma.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-sa.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-tn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/az.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/be.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bg.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/br.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bs.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ca.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cs.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cy.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/da.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de-at.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/dv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/el.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-au.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ca.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-gb.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ie.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-nz.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/es.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/et.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eu.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fa.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fi.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ca.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ch.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fy.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gd.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/he.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hi.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hu.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hy-am.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/id.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/is.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/it.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ja.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/jv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ka.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/kk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/km.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ko.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ky.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lb.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lt.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/me.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ml.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms-my.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/my.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nb.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ne.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pa-in.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt-br.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ro.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ru.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/se.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/si.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sq.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr-cyrl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ss.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sw.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ta.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/te.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/th.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tl-ph.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tlh.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm-latn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uz.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/vi.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/x-pseudo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-cn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-tw.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.min.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.min.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment.min.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/tests.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.d.ts delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/check-overflow.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/date-from-array.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-anything.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-array.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-object.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-array.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-format.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/local.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/parsing-flags.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/utc.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/valid.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/abs.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/add-subtract.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/as.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/bubble.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/constructor.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/create.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/duration.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/get.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/humanize.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/iso-string.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/prototype.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/format/format.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/calendar.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/constructor.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/en.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/formats.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/invalid.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/lists.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locale.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locales.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/ordinal.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/pre-post-format.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/prototype.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/relative.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/set.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/add-subtract.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/calendar.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/clone.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/compare.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/constructor.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/creation-data.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/diff.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/format.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/from.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/get-set.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/locale.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/min-max.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/moment.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/now.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/prototype.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/start-end-of.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to-type.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/valid.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/regex.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/token.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/aliases.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/constants.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-month.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-week.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-year.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/hour.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/millisecond.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/minute.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/month.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/offset.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/quarter.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/second.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timestamp.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timezone.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/units.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-calendar-utils.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-year.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/year.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-ceil.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-floor.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-round.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/compare-arrays.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/defaults.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/deprecate.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/extend.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/has-own-prop.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/hooks.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/index-of.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-array.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-date.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-function.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-object.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-undefined.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/keys.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/map.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/some.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/to-int.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/zero-fill.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/af.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-ma.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-sa.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-tn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/az.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/be.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bg.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/br.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bs.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ca.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cs.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cy.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/da.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de-at.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/dv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/el.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-au.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ca.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-gb.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ie.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-nz.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/es.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/et.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eu.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fa.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fi.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ca.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ch.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fy.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gd.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/he.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hi.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hu.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hy-am.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/id.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/is.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/it.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ja.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/jv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ka.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/kk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/km.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ko.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ky.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lb.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lt.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/me.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ml.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms-my.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/my.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nb.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ne.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pa-in.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt-br.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ro.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ru.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/se.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/si.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sq.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr-cyrl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ss.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sv.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sw.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ta.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/te.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/th.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tl-ph.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tlh.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tr.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzl.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm-latn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uk.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uz.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/vi.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/x-pseudo.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-cn.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-tw.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/moment.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd-named.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/default.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/globals.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/locale-header.js delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/test-header.js diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/.bower.json b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/.bower.json deleted file mode 100644 index 0cfb88cf..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/.bower.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "moment", - "main": "moment.js", - "ignore": [ - "**/.*", - "benchmarks", - "bower_components", - "meteor", - "node_modules", - "scripts", - "tasks", - "test", - "component.json", - "composer.json", - "CONTRIBUTING.md", - "ender.js", - "Gruntfile.js", - "Moment.js.nuspec", - "package.js", - "package.json" - ], - "homepage": "https://github.com/moment/moment", - "version": "2.13.0", - "_release": "2.13.0", - "_resolution": { - "type": "version", - "tag": "2.13.0", - "commit": "f90b5150a46651fabd7724d06438d7df2db59401" - }, - "_source": "https://github.com/moment/moment.git", - "_target": "^2.13.0", - "_originalSource": "moment", - "_direct": true -} \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/CHANGELOG.md b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/CHANGELOG.md deleted file mode 100644 index 433fa857..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/CHANGELOG.md +++ /dev/null @@ -1,535 +0,0 @@ -Changelog -========= - -### 2.13.0 [See full changelog](https://gist.github.com/ichernev/0132fcf5b61f7fc140b0bb0090480d49) - -## Enhancements: -* [#2982](https://github.com/moment/moment/pull/2982) Add 'date' as alias to 'day' for startOf() and endOf(). -* [#2955](https://github.com/moment/moment/pull/2955) Add parsing negative components in durations when ISO 8601 -* [#2991](https://github.com/moment/moment/pull/2991) isBetween support for both open and closed intervals -* [#3105](https://github.com/moment/moment/pull/3105) Add localeSorted argument to weekday listers -* [#3102](https://github.com/moment/moment/pull/3102) Add k and kk formatting tokens - -## Bugfixes -* [#3109](https://github.com/moment/moment/pull/3109) Fix [#1756](https://github.com/moment/moment/issues/1756) Resolved thread-safe issue on server side. -* [#3078](https://github.com/moment/moment/pull/3078) Fix parsing for months/weekdays with weird characters -* [#3098](https://github.com/moment/moment/pull/3098) Use Z suffix when in UTC mode ([#3020](https://github.com/moment/moment/issues/3020)) -* [#2995](https://github.com/moment/moment/pull/2995) Fix floating point rounding errors in durations -* [#3059](https://github.com/moment/moment/pull/3059) fix bug where diff returns -0 in month-related diffs -* [#3045](https://github.com/moment/moment/pull/3045) Fix mistaking any input for 'a' token -* [#2877](https://github.com/moment/moment/pull/2877) Use explicit .valueOf() calls instead of coercion -* [#3036](https://github.com/moment/moment/pull/3036) Year setter should keep time when DST changes - -Plus 3 new locales and locale fixes. - -### 2.12.0 [See full changelog](https://gist.github.com/ichernev/6e5bfdf8d6522fc4ac73) - -## Enhancements: -* [#2932](https://github.com/moment/moment/pull/2932) List loaded locales -* [#2818](https://github.com/moment/moment/pull/2818) Parse ISO-8061 duration containing both day and week values -* [#2774](https://github.com/moment/moment/pull/2774) Implement locale inheritance and locale updating - -## Bugfixes: -* [#2970](https://github.com/moment/moment/pull/2970) change add subtract to handle decimal values by rounding -* [#2887](https://github.com/moment/moment/pull/2887) Fix toJSON casting of invalid moment -* [#2897](https://github.com/moment/moment/pull/2897) parse string arguments for month() correctly, closes #2884 -* [#2946](https://github.com/moment/moment/pull/2946) Fix usage suggestions for min and max - -## New locales: -* [#2917](https://github.com/moment/moment/pull/2917) Locale Punjabi(Gurmukhi) India format conversion - -And more - -### 2.11.2 (Fix ReDoS attack vector) - -* [#2939](https://github.com/moment/moment/pull/2939) use full-string match to speed up aspnet regex match - -### 2.11.1 [See full changelog](https://gist.github.com/ichernev/8ec3ee25b749b4cff3c2) - -## Bugfixes: -* [#2881](https://github.com/moment/moment/pull/2881) Revert "Merge pull request #2746 from mbad0la:develop" Sep->Sept -* [#2868](https://github.com/moment/moment/pull/2868) Add format and parse token Y, so it actually works -* [#2865](https://github.com/moment/moment/pull/2865) Use typeof checks for undefined for global variables -* [#2858](https://github.com/moment/moment/pull/2858) Fix Date mocking regression introduced in 2.11.0 -* [#2864](https://github.com/moment/moment/pull/2864) Include changelog in npm release -* [#2830](https://github.com/moment/moment/pull/2830) dep: add grunt-cli -* [#2869](https://github.com/moment/moment/pull/2869) Fix months parsing for some locales - -### 2.11.0 [See full changelog](https://gist.github.com/ichernev/6594bc29719dde6b2f66) - -* [#2624](https://github.com/moment/moment/pull/2624) Proper handling of invalid moments -* [#2634](https://github.com/moment/moment/pull/2634) Fix strict month parsing issue in cs,ru,sk -* [#2735](https://github.com/moment/moment/pull/2735) Reset the locale back to 'en' after defining all locales in min/locales.js -* [#2702](https://github.com/moment/moment/pull/2702) Week rework -* [#2746](https://github.com/moment/moment/pull/2746) Changed September Abbreviation to "Sept" in locale-specific english - files and default locale file -* [#2646](https://github.com/moment/moment/pull/2646) Fix [#2645](https://github.com/moment/moment/pull/2645) - invalid dates pre-1970 - -* [#2641](https://github.com/moment/moment/pull/2641) Implement basic format and comma as ms separator in ISO 8601 -* [#2665](https://github.com/moment/moment/pull/2665) Implement stricter weekday parsing -* [#2700](https://github.com/moment/moment/pull/2700) Add [Hh]mm and [Hh]mmss formatting tokens, so you can parse 123 with - hmm for example -* [#2565](https://github.com/moment/moment/pull/2565) [#2835](https://github.com/moment/moment/pull/2835) Expose arguments used for moment creation with creationData - (fix [#2443](https://github.com/moment/moment/pull/2443)) -* [#2648](https://github.com/moment/moment/pull/2648) fix issue [#2640](https://github.com/moment/moment/pull/2640): support instanceof operator -* [#2709](https://github.com/moment/moment/pull/2709) Add isSameOrAfter and isSameOrBefore comparison methods -* [#2721](https://github.com/moment/moment/pull/2721) Fix moment creation from object with strings values -* [#2740](https://github.com/moment/moment/pull/2740) Enable 'd hh:mm:ss.sss' format for durations -* [#2766](https://github.com/moment/moment/pull/2766) [#2833](https://github.com/moment/moment/pull/2833) Alternate Clock Source Support - -### 2.10.6 - -[#2515](https://github.com/moment/moment/pull/2515) Fix regression introduced -in `2.10.5` related to `moment.ISO_8601` parsing. - -### 2.10.5 [See full changelog](https://gist.github.com/ichernev/6ec13ac7efc396da44b2) - -Important changes: -* [#2357](https://github.com/moment/moment/pull/2357) Improve unit bubbling for ISO dates - this fixes day to year conversions to work around end-of-year (~365 days). As - a side effect 365 days is 11 months and 30 days, and 366 days is one year. -* [#2438](https://github.com/moment/moment/pull/2438) Fix inconsistent moment.min and moment.max results - Return invalid result if any of the inputs is invalid -* [#2494](https://github.com/moment/moment/pull/2494) Fix two digit year parsing with YYYY format - This brings the benefits of YY to YYYY -* [#2368](https://github.com/moment/moment/pull/2368) perf: use faster form of copying dates, across the board improvement - - -### 2.10.3 [See full changelog](https://gist.github.com/ichernev/f264b9bed5b00f8b1b7f) - -* add `moment.fn.to` and `moment.fn.toNow` (similar to `from` and `fromNow`) -* new locales (Sinhalese (si), Montenegrin (me), Javanese (ja)) -* performance improvements - -### 2.10.2 - -* fixed moment-with-locales in browser env caused by esperanto change - -### 2.10.1 - -* regression: Add moment.duration.fn back - -### 2.10.0 - -Ported code to es6 modules. - -### 2.9.0 [See full changelog](https://gist.github.com/ichernev/0c9a9b49951111a27ce7) - -languages: -* [2104](https://github.com/moment/moment/issues/2104) Frisian (fy) language file with unit test -* [2097](https://github.com/moment/moment/issues/2097) add ar-tn locale - -deprecations: -* [2074](https://github.com/moment/moment/issues/2074) Implement `moment.fn.utcOffset`, deprecate `moment.fn.zone` - -features: -* [2088](https://github.com/moment/moment/issues/2088) add moment.fn.isBetween -* [2054](https://github.com/moment/moment/issues/2054) Call updateOffset when creating moment (needed for default timezone in - moment-timezone) -* [1893](https://github.com/moment/moment/issues/1893) Add moment.isDate method -* [1825](https://github.com/moment/moment/issues/1825) Implement toJSON function on Duration -* [1809](https://github.com/moment/moment/issues/1809) Allowing moment.set() to accept a hash of units -* [2128](https://github.com/moment/moment/issues/2128) Add firstDayOfWeek, firstDayOfYear locale getters -* [2131](https://github.com/moment/moment/issues/2131) Add quarter diff support - -Some bugfixes and language improvements -- [full changelog](https://gist.github.com/ichernev/0c9a9b49951111a27ce7) - -### 2.8.4 [See full changelog](https://gist.github.com/ichernev/a4fcb0a46d74e4b9b996) - -Features: - -* [#2000](https://github.com/moment/moment/issues/2000) Add LTS localised format that includes seconds -* [#1960](https://github.com/moment/moment/issues/1960) added formatToken 'x' for unix offset in milliseconds #1938 -* [#1965](https://github.com/moment/moment/issues/1965) Support 24:00:00.000 to mean next day, at midnight. -* [#2002](https://github.com/moment/moment/issues/2002) Accept 'date' key when creating moment with object -* [#2009](https://github.com/moment/moment/issues/2009) Use native toISOString when we can - -Some bugfixes and language improvements -- [full changelog](https://gist.github.com/ichernev/a4fcb0a46d74e4b9b996) - -### 2.8.3 - -Bugfixes: - -* [#1801](https://github.com/moment/moment/issues/1801) proper pluralization for Arabic -* [#1833](https://github.com/moment/moment/issues/1833) improve spm integration -* [#1871](https://github.com/moment/moment/issues/1871) fix zone bug caused by Firefox 24 -* [#1882](https://github.com/moment/moment/issues/1882) Use hh:mm in Czech -* [#1883](https://github.com/moment/moment/issues/1883) Fix 2.8.0 regression in duration as conversions -* [#1890](https://github.com/moment/moment/issues/1890) Faster travis builds -* [#1892](https://github.com/moment/moment/issues/1892) Faster isBefore/After/Same -* [#1848](https://github.com/moment/moment/issues/1848) Fix flaky month diffs -* [#1895](https://github.com/moment/moment/issues/1895) Fix 2.8.0 regression in moment.utc with format array -* [#1896](https://github.com/moment/moment/issues/1896) Support setting invalid instance locale (noop) -* [#1897](https://github.com/moment/moment/issues/1897) Support moment([str]) in addition to moment([int]) - -### 2.8.2 - -Minor bugfixes: - -* [#1874](https://github.com/moment/moment/issues/1874) use `Object.prototype.hasOwnProperty` - instead of `obj.hasOwnProperty` (ie8 bug) -* [#1873](https://github.com/moment/moment/issues/1873) add `duration#toString()` -* [#1859](https://github.com/moment/moment/issues/1859) better month/weekday names in norwegian -* [#1812](https://github.com/moment/moment/issues/1812) meridiem parsing for greek -* [#1804](https://github.com/moment/moment/issues/1804) spanish del -> de -* [#1800](https://github.com/moment/moment/issues/1800) korean LT improvement - -### 2.8.1 - -* bugfix [#1813](https://github.com/moment/moment/issues/1813): fix moment().lang([key]) incompatibility - -### 2.8.0 [See changelog](https://gist.github.com/ichernev/ac3899324a5fa6c8c9b4) - -* incompatible changes - * [#1761](https://github.com/moment/moment/issues/1761): moments created without a language are no longer following the global language, in case it changes. Only newly created moments take the global language by default. In case you're affected by this, wait, comment on [#1797](https://github.com/moment/moment/issues/1797) and wait for a proper reimplementation - * [#1642](https://github.com/moment/moment/issues/1642): 45 days is no longer "a month" according to humanize, cutoffs for month, and year have changed. Hopefully your code does not depend on a particular answer from humanize (which it shouldn't anyway) - * [#1784](https://github.com/moment/moment/issues/1784): if you use the human readable English datetime format in a weird way (like storing them in a database) that would break when the format changes you're at risk. - -* deprecations (old behavior will be dropped in 3.0) - * [#1761](https://github.com/moment/moment/issues/1761) `lang` is renamed to `locale`, `langData` -> `localeData`. Also there is now `defineLocale` that should be used when creating new locales - * [#1763](https://github.com/moment/moment/issues/1763) `add(unit, value)` and `subtract(unit, value)` are now deprecated. Use `add(value, unit)` and `subtract(value, unit)` instead. - * [#1759](https://github.com/moment/moment/issues/1759) rename `duration.toIsoString` to `duration.toISOString`. The js standard library and moment's `toISOString` follow that convention. - -* new locales - * [#1789](https://github.com/moment/moment/issues/1789) Tibetan (bo) - * [#1786](https://github.com/moment/moment/issues/1786) Africaans (af) - * [#1778](https://github.com/moment/moment/issues/1778) Burmese (my) - * [#1727](https://github.com/moment/moment/issues/1727) Belarusian (be) - -* bugfixes, locale bugfixes, performance improvements, features - -### 2.7.0 [See changelog](https://gist.github.com/ichernev/b0a3d456d5a84c9901d7) - -* new languages - - * [#1678](https://github.com/moment/moment/issues/1678) Bengali (bn) - * [#1628](https://github.com/moment/moment/issues/1628) Azerbaijani (az) - * [#1633](https://github.com/moment/moment/issues/1633) Arabic, Saudi Arabia (ar-sa) - * [#1648](https://github.com/moment/moment/issues/1648) Austrian German (de-at) - -* features - - * [#1663](https://github.com/moment/moment/issues/1663) configurable relative time thresholds - * [#1554](https://github.com/moment/moment/issues/1554) support anchor time in moment.calendar - * [#1693](https://github.com/moment/moment/issues/1693) support moment.ISO_8601 as parsing format - * [#1637](https://github.com/moment/moment/issues/1637) add moment.min and moment.max and deprecate min/max instance methods - * [#1704](https://github.com/moment/moment/issues/1704) support string value in add/subtract - * [#1647](https://github.com/moment/moment/issues/1647) add spm support (package manager) - -* bugfixes - -### 2.6.0 [See changelog](https://gist.github.com/ichernev/10544682) - -* languages - * [#1529](https://github.com/moment/moment/issues/1529) Serbian-Cyrillic (sr-cyr) - * [#1544](https://github.com/moment/moment/issues/1544), [#1546](https://github.com/moment/moment/issues/1546) Khmer Cambodia (km) - -* features - * [#1419](https://github.com/moment/moment/issues/1419), [#1468](https://github.com/moment/moment/issues/1468), [#1467](https://github.com/moment/moment/issues/1467), [#1546](https://github.com/moment/moment/issues/1546) better handling of timezone-d moments around DST - * [#1462](https://github.com/moment/moment/issues/1462) add weeksInYear and isoWeeksInYear - * [#1475](https://github.com/moment/moment/issues/1475) support ordinal parsing - * [#1499](https://github.com/moment/moment/issues/1499) composer support - * [#1577](https://github.com/moment/moment/issues/1577), [#1604](https://github.com/moment/moment/issues/1604) put Date parsing in moment.createFromInputFallback so it can be properly deprecated and controlled in the future - * [#1545](https://github.com/moment/moment/issues/1545) extract two-digit year parsing in moment.parseTwoDigitYear, so it can be overwritten - * [#1590](https://github.com/moment/moment/issues/1590) (see [#1574](https://github.com/moment/moment/issues/1574)) set AMD global before module definition to better support non AMD module dependencies used in AMD environment - * [#1589](https://github.com/moment/moment/issues/1589) remove global in Node.JS environment (was not working before, nobody complained, was scheduled for removal anyway) - * [#1586](https://github.com/moment/moment/issues/1586) support quarter setting and parsing - -* 18 bugs fixed - -### 2.5.1 - -* languages - * [#1392](https://github.com/moment/moment/issues/1392) Armenian (hy-am) - -* bugfixes - * [#1429](https://github.com/moment/moment/issues/1429) fixes [#1423](https://github.com/moment/moment/issues/1423) weird chrome-32 bug with js object creation - * [#1421](https://github.com/moment/moment/issues/1421) remove html entities from Welsh - * [#1418](https://github.com/moment/moment/issues/1418) fixes [#1401](https://github.com/moment/moment/issues/1401) improved non-padded tokens in strict matching - * [#1417](https://github.com/moment/moment/issues/1417) fixes [#1404](https://github.com/moment/moment/issues/1404) handle buggy moment object created by property cloning - * [#1398](https://github.com/moment/moment/issues/1398) fixes [#1397](https://github.com/moment/moment/issues/1397) fix Arabic-like week number parsing - * [#1396](https://github.com/moment/moment/issues/1396) add leftZeroFill(4) to GGGG and gggg formats - * [#1373](https://github.com/moment/moment/issues/1373) use lowercase for months and days in Catalan - -* testing - * [#1374](https://github.com/moment/moment/issues/1374) run tests on multiple browser/os combos via SauceLabs and Travis - -### 2.5.0 [See changelog](https://gist.github.com/ichernev/8104451) - -* New languages - * Luxemburish (lb) [1247](https://github.com/moment/moment/issues/1247) - * Serbian (rs) [1319](https://github.com/moment/moment/issues/1319) - * Tamil (ta) [1324](https://github.com/moment/moment/issues/1324) - * Macedonian (mk) [1337](https://github.com/moment/moment/issues/1337) - -* Features - * [1311](https://github.com/moment/moment/issues/1311) Add quarter getter and format token `Q` - * [1303](https://github.com/moment/moment/issues/1303) strict parsing now respects number of digits per token (fix [1196](https://github.com/moment/moment/issues/1196)) - * 0d30bb7 add jspm support - * [1347](https://github.com/moment/moment/issues/1347) improve zone parsing - * [1362](https://github.com/moment/moment/issues/1362) support merideam parsing in Korean - -* 22 bugfixes - -### 2.4.0 - -* **Deprecate** globally exported moment, will be removed in next major -* New languages - * Farose (fo) [#1206](https://github.com/moment/moment/issues/1206) - * Tagalog/Filipino (tl-ph) [#1197](https://github.com/moment/moment/issues/1197) - * Welsh (cy) [#1215](https://github.com/moment/moment/issues/1215) -* Bugfixes - * properly handle Z at the end of iso RegExp [#1187](https://github.com/moment/moment/issues/1187) - * chinese meridian time improvements [#1076](https://github.com/moment/moment/issues/1076) - * fix language tests [#1177](https://github.com/moment/moment/issues/1177) - * remove some failing tests (that should have never existed :)) - [#1185](https://github.com/moment/moment/issues/1185) - [#1183](https://github.com/moment/moment/issues/1183) - * handle russian noun cases in weird cases [#1195](https://github.com/moment/moment/issues/1195) - -### 2.3.1 - -Removed a trailing comma [1169] and fixed a bug with `months`, `weekdays` getters [#1171](https://github.com/moment/moment/issues/1171). - -### 2.3.0 [See changelog](https://gist.github.com/ichernev/6864354) - -Changed isValid, added strict parsing. -Week tokens parsing. - -### 2.2.1 - -Fixed bug in string prototype test. -Updated authors and contributors. - -### 2.2.0 [See changelog](https://gist.github.com/ichernev/00f837a9baf46a3565e4) - -Added bower support. - -Language files now use UMD. - -Creating moment defaults to current date/month/year. - -Added a bundle of moment and all language files. - -### 2.1.0 [See changelog](https://gist.github.com/timrwood/b8c2d90d528eddb53ab5) - -Added better week support. - -Added ability to set offset with `moment#zone`. - -Added ability to set month or weekday from a string. - -Added `moment#min` and `moment#max` - -### 2.0.0 [See changelog](https://gist.github.com/timrwood/e72f2eef320ed9e37c51) - -Added short form localized tokens. - -Added ability to define language a string should be parsed in. - -Added support for reversed add/subtract arguments. - -Added support for `endOf('week')` and `startOf('week')`. - -Fixed the logic for `moment#diff(Moment, 'months')` and `moment#diff(Moment, 'years')` - -`moment#diff` now floors instead of rounds. - -Normalized `moment#toString`. - -Added `isSame`, `isAfter`, and `isBefore` methods. - -Added better week support. - -Added `moment#toJSON` - -Bugfix: Fixed parsing of first century dates - -Bugfix: Parsing 10Sep2001 should work as expected - -Bugfix: Fixed weirdness with `moment.utc()` parsing. - -Changed language ordinal method to return the number + ordinal instead of just the ordinal. - -Changed two digit year parsing cutoff to match strptime. - -Removed `moment#sod` and `moment#eod` in favor of `moment#startOf` and `moment#endOf`. - -Removed `moment.humanizeDuration()` in favor of `moment.duration().humanize()`. - -Removed the lang data objects from the top level namespace. - -Duplicate `Date` passed to `moment()` instead of referencing it. - -### 1.7.2 [See discussion](https://github.com/timrwood/moment/issues/456) - -Bugfixes - -### 1.7.1 [See discussion](https://github.com/timrwood/moment/issues/384) - -Bugfixes - -### 1.7.0 [See discussion](https://github.com/timrwood/moment/issues/288) - -Added `moment.fn.endOf()` and `moment.fn.startOf()`. - -Added validation via `moment.fn.isValid()`. - -Made formatting method 3x faster. http://jsperf.com/momentjs-cached-format-functions - -Add support for month/weekday callbacks in `moment.fn.format()` - -Added instance specific languages. - -Added two letter weekday abbreviations with the formatting token `dd`. - -Various language updates. - -Various bugfixes. - -### 1.6.0 [See discussion](https://github.com/timrwood/moment/pull/268) - -Added Durations. - -Revamped parser to support parsing non-separated strings (YYYYMMDD vs YYYY-MM-DD). - -Added support for millisecond parsing and formatting tokens (S SS SSS) - -Added a getter for `moment.lang()` - -Various bugfixes. - -There are a few things deprecated in the 1.6.0 release. - -1. The format tokens `z` and `zz` (timezone abbreviations like EST CST MST etc) will no longer be supported. Due to inconsistent browser support, we are unable to consistently produce this value. See [this issue](https://github.com/timrwood/moment/issues/162) for more background. - -2. The method `moment.fn.native` is deprecated in favor of `moment.fn.toDate`. There continue to be issues with Google Closure Compiler throwing errors when using `native`, even in valid instances. - -3. The way to customize am/pm strings is being changed. This would only affect you if you created a custom language file. For more information, see [this issue](https://github.com/timrwood/moment/pull/222). - -### 1.5.0 [See milestone](https://github.com/timrwood/moment/issues?milestone=10&page=1&state=closed) - -Added UTC mode. - -Added automatic ISO8601 parsing. - -Various bugfixes. - -### 1.4.0 [See milestone](https://github.com/timrwood/moment/issues?milestone=8&state=closed) - -Added `moment.fn.toDate` as a replacement for `moment.fn.native`. - -Added `moment.fn.sod` and `moment.fn.eod` to get the start and end of day. - -Various bugfixes. - -### 1.3.0 [See milestone](https://github.com/timrwood/moment/issues?milestone=7&state=closed) - -Added support for parsing month names in the current language. - -Added escape blocks for parsing tokens. - -Added `moment.fn.calendar` to format strings like 'Today 2:30 PM', 'Tomorrow 1:25 AM', and 'Last Sunday 4:30 AM'. - -Added `moment.fn.day` as a setter. - -Various bugfixes - -### 1.2.0 [See milestone](https://github.com/timrwood/moment/issues?milestone=4&state=closed) - -Added timezones to parser and formatter. - -Added `moment.fn.isDST`. - -Added `moment.fn.zone` to get the timezone offset in minutes. - -### 1.1.2 [See milestone](https://github.com/timrwood/moment/issues?milestone=6&state=closed) - -Various bugfixes - -### 1.1.1 [See milestone](https://github.com/timrwood/moment/issues?milestone=5&state=closed) - -Added time specific diffs (months, days, hours, etc) - -### 1.1.0 - -Added `moment.fn.format` localized masks. 'L LL LLL LLLL' [issue 29](https://github.com/timrwood/moment/pull/29) - -Fixed [issue 31](https://github.com/timrwood/moment/pull/31). - -### 1.0.1 - -Added `moment.version` to get the current version. - -Removed `window !== undefined` when checking if module exists to support browserify. [issue 25](https://github.com/timrwood/moment/pull/25) - -### 1.0.0 - -Added convenience methods for getting and setting date parts. - -Added better support for `moment.add()`. - -Added better lang support in NodeJS. - -Renamed library from underscore.date to Moment.js - -### 0.6.1 - -Added Portuguese, Italian, and French language support - -### 0.6.0 - -Added _date.lang() support. -Added support for passing multiple formats to try to parse a date. _date("07-10-1986", ["MM-DD-YYYY", "YYYY-MM-DD"]); -Made parse from string and single format 25% faster. - -### 0.5.2 - -Bugfix for [issue 8](https://github.com/timrwood/underscore.date/pull/8) and [issue 9](https://github.com/timrwood/underscore.date/pull/9). - -### 0.5.1 - -Bugfix for [issue 5](https://github.com/timrwood/underscore.date/pull/5). - -### 0.5.0 - -Dropped the redundant `_date.date()` in favor of `_date()`. -Removed `_date.now()`, as it is a duplicate of `_date()` with no parameters. -Removed `_date.isLeapYear(yearNumber)`. Use `_date([yearNumber]).isLeapYear()` instead. -Exposed customization options through the `_date.relativeTime`, `_date.weekdays`, `_date.weekdaysShort`, `_date.months`, `_date.monthsShort`, and `_date.ordinal` variables instead of the `_date.customize()` function. - -### 0.4.1 - -Added date input formats for input strings. - -### 0.4.0 - -Added underscore.date to npm. Removed dependencies on underscore. - -### 0.3.2 - -Added `'z'` and `'zz'` to `_.date().format()`. Cleaned up some redundant code to trim off some bytes. - -### 0.3.1 - -Cleaned up the namespace. Moved all date manipulation and display functions to the _.date() object. - -### 0.3.0 - -Switched to the Underscore methodology of not mucking with the native objects' prototypes. -Made chaining possible. - -### 0.2.1 - -Changed date names to be a more pseudo standardized 'dddd, MMMM Do YYYY, h:mm:ss a'. -Added `Date.prototype` functions `add`, `subtract`, `isdst`, and `isleapyear`. - -### 0.2.0 - -Changed function names to be more concise. -Changed date format from php date format to custom format. - -### 0.1.0 - -Initial release - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/LICENSE b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/LICENSE deleted file mode 100644 index 9ee53744..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/README.md b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/README.md deleted file mode 100644 index c45e9d62..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/README.md +++ /dev/null @@ -1,58 +0,0 @@ -[![Join the chat at https://gitter.im/moment/moment](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/moment/moment?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Build Status][travis-image]][travis-url] -[![Coverage Status](https://coveralls.io/repos/moment/moment/badge.svg?branch=develop)](https://coveralls.io/r/moment/moment?branch=develop) - -A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates. - -**[Documentation](http://momentjs.com/docs/)** - -## Port to ECMAScript 6 (version 2.10.0) - -Moment 2.10.0 does not bring any new features, but the code is now written in -ECMAScript 6 modules and placed inside `src/`. Previously `moment.js`, `locale/*.js` and -`test/moment/*.js`, `test/locale/*.js` contained the source of the project. Now -the source is in `src/`, temporary build (ECMAScript 5) files are placed under -`build/umd/` (for running tests during development), and the `moment.js` and -`locale/*.js` files are updated only on release. - -If you want to use a particular revision of the code, make sure to run -`grunt transpile update-index`, so `moment.js` and `locales/*.js` are synced -with `src/*`. We might place that in a commit hook in the future. - -## Upgrading to 2.0.0 - -There are a number of small backwards incompatible changes with version 2.0.0. [See the full descriptions here](https://gist.github.com/timrwood/e72f2eef320ed9e37c51#backwards-incompatible-changes) - - * Changed language ordinal method to return the number + ordinal instead of just the ordinal. - - * Changed two digit year parsing cutoff to match strptime. - - * Removed `moment#sod` and `moment#eod` in favor of `moment#startOf` and `moment#endOf`. - - * Removed `moment.humanizeDuration()` in favor of `moment.duration().humanize()`. - - * Removed the lang data objects from the top level namespace. - - * Duplicate `Date` passed to `moment()` instead of referencing it. - -## [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - -## [Contributing](https://github.com/moment/moment/blob/develop/CONTRIBUTING.md) - -We're looking for co-maintainers! If you want to become a master of time please -write to [ichernev](https://github.com/ichernev). - -## License - -Moment.js is freely distributable under the terms of the [MIT license](https://github.com/moment/moment/blob/develop/LICENSE). - -[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat -[license-url]: LICENSE - -[npm-url]: https://npmjs.org/package/moment -[npm-version-image]: http://img.shields.io/npm/v/moment.svg?style=flat -[npm-downloads-image]: http://img.shields.io/npm/dm/moment.svg?style=flat - -[travis-url]: http://travis-ci.org/moment/moment -[travis-image]: http://img.shields.io/travis/moment/moment/develop.svg?style=flat diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/bower.json b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/bower.json deleted file mode 100644 index d9f47e82..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "moment", - "main": "moment.js", - "ignore": [ - "**/.*", - "benchmarks", - "bower_components", - "meteor", - "node_modules", - "scripts", - "tasks", - "test", - "component.json", - "composer.json", - "CONTRIBUTING.md", - "ender.js", - "Gruntfile.js", - "Moment.js.nuspec", - "package.js", - "package.json" - ] -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/af.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/af.js deleted file mode 100644 index 1a96bf47..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/af.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : afrikaans (af) -//! author : Werner Mollentze : https://github.com/wernerm - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var af = moment.defineLocale('af', { - months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'), - weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), - weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), - meridiemParse: /vm|nm/i, - isPM : function (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? 'nm' : 'NM'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Vandag om] LT', - nextDay : '[Môre om] LT', - nextWeek : 'dddd [om] LT', - lastDay : '[Gister om] LT', - lastWeek : '[Laas] dddd [om] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'oor %s', - past : '%s gelede', - s : '\'n paar sekondes', - m : '\'n minuut', - mm : '%d minute', - h : '\'n uur', - hh : '%d ure', - d : '\'n dag', - dd : '%d dae', - M : '\'n maand', - MM : '%d maande', - y : '\'n jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter - }, - week : { - dow : 1, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. - } - }); - - return af; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-ma.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-ma.js deleted file mode 100644 index 923a4930..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-ma.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : Moroccan Arabic (ar-ma) -//! author : ElFadili Yassine : https://github.com/ElFadiliY -//! author : Abdel Said : https://github.com/abdelsaid - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ar_ma = moment.defineLocale('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ar_ma; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-sa.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-sa.js deleted file mode 100644 index aecb80a5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-sa.js +++ /dev/null @@ -1,104 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic Saudi Arabia (ar-sa) -//! author : Suhail Alkowaileet : https://github.com/xsoh - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }; - - var ar_sa = moment.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ar_sa; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-tn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-tn.js deleted file mode 100644 index b8e07a0b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar-tn.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : Tunisian Arabic (ar-tn) - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ar_tn = moment.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%d سنوات' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return ar_tn; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar.js deleted file mode 100644 index b478c0f5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ar.js +++ /dev/null @@ -1,137 +0,0 @@ -//! moment.js locale configuration -//! Locale: Arabic (ar) -//! Author: Abdel Said: https://github.com/abdelsaid -//! Changes in months, weekdays: Ahmed Elkhatib -//! Native plural forms: forabi https://github.com/forabi - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, months = [ - 'كانون الثاني يناير', - 'شباط فبراير', - 'آذار مارس', - 'نيسان أبريل', - 'أيار مايو', - 'حزيران يونيو', - 'تموز يوليو', - 'آب أغسطس', - 'أيلول سبتمبر', - 'تشرين الأول أكتوبر', - 'تشرين الثاني نوفمبر', - 'كانون الأول ديسمبر' - ]; - - var ar = moment.defineLocale('ar', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/\u200FM/\u200FYYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ar; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/az.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/az.js deleted file mode 100644 index 1beeca5c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/az.js +++ /dev/null @@ -1,105 +0,0 @@ -//! moment.js locale configuration -//! locale : azerbaijani (az) -//! author : topchiyev : https://github.com/topchiyev - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' - }; - - var az = moment.defineLocale('az', { - months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'), - monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'), - weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } - }, - ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return az; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/be.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/be.js deleted file mode 100644 index c6294b34..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/be.js +++ /dev/null @@ -1,134 +0,0 @@ -//! moment.js locale configuration -//! locale : belarusian (be) -//! author : Dmitry Demidov : https://github.com/demidov91 -//! author: Praleska: http://praleska.pro/ -//! Author : Menelion Elensúle : https://github.com/Oire - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } - - var be = moment.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : relativeTimeWithPlural, - hh : relativeTimeWithPlural, - d : 'дзень', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - ordinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return be; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bg.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bg.js deleted file mode 100644 index 169e1238..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bg.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : bulgarian (bg) -//! author : Krasen Borisov : https://github.com/kraz - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var bg = moment.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return bg; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bn.js deleted file mode 100644 index f6ae2603..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bn.js +++ /dev/null @@ -1,119 +0,0 @@ -//! moment.js locale configuration -//! locale : Bengali (bn) -//! author : Kaushik Gandhi : https://github.com/kaushikgandhi - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' - }, - numberMap = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' - }; - - var bn = moment.defineLocale('bn', { - months : 'জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'), - longDateFormat : { - LT : 'A h:mm সময়', - LTS : 'A h:mm:ss সময়', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm সময়', - LLLL : 'dddd, D MMMM YYYY, A h:mm সময়' - }, - calendar : { - sameDay : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return bn; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bo.js deleted file mode 100644 index 77ea1bd4..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bo.js +++ /dev/null @@ -1,119 +0,0 @@ -//! moment.js locale configuration -//! locale : tibetan (bo) -//! author : Thupten N. Chakrishar : https://github.com/vajradog - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' - }, - numberMap = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' - }; - - var bo = moment.defineLocale('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; - } else { - return 'མཚན་མོ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return bo; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/br.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/br.js deleted file mode 100644 index 7b42d428..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/br.js +++ /dev/null @@ -1,108 +0,0 @@ -//! moment.js locale configuration -//! locale : breton (br) -//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); - } - function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } - } - function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; - } - function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; - } - function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); - } - - var br = moment.defineLocale('br', { - months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'), - monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'), - weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'), - weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), - weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h[e]mm A', - LTS : 'h[e]mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D [a viz] MMMM YYYY', - LLL : 'D [a viz] MMMM YYYY h[e]mm A', - LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A' - }, - calendar : { - sameDay : '[Hiziv da] LT', - nextDay : '[Warc\'hoazh da] LT', - nextWeek : 'dddd [da] LT', - lastDay : '[Dec\'h da] LT', - lastWeek : 'dddd [paset da] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'a-benn %s', - past : '%s \'zo', - s : 'un nebeud segondennoù', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - ordinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return br; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bs.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bs.js deleted file mode 100644 index bbe54dcd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/bs.js +++ /dev/null @@ -1,143 +0,0 @@ -//! moment.js locale configuration -//! locale : bosnian (bs) -//! author : Nedim Cholich : https://github.com/frontyard -//! based on (hr) translation by Bojan Marković - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var bs = moment.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return bs; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ca.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ca.js deleted file mode 100644 index d796dc34..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ca.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : catalan (ca) -//! author : Juan G. Hurtado : https://github.com/juanghurtado - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ca = moment.defineLocale('ca', { - months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'fa %s', - s : 'uns segons', - m : 'un minut', - mm : '%d minuts', - h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', - M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - ordinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return ca; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cs.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cs.js deleted file mode 100644 index 5854f70e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cs.js +++ /dev/null @@ -1,171 +0,0 @@ -//! moment.js locale configuration -//! locale : czech (cs) -//! author : petrbela : https://github.com/petrbela - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), - monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); - function plural(n) { - return (n > 1) && (n < 5) && (~~(n / 10) !== 1); - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } - } - - var cs = moment.defineLocale('cs', { - months : months, - monthsShort : monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(months, monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(months)), - weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), - weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), - weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse : /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return cs; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cv.js deleted file mode 100644 index a1d87e18..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cv.js +++ /dev/null @@ -1,63 +0,0 @@ -//! moment.js locale configuration -//! locale : chuvash (cv) -//! author : Anatoly Mironov : https://github.com/mirontoli - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var cv = moment.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - ordinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return cv; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cy.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cy.js deleted file mode 100644 index 958871e5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/cy.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : Welsh (cy) -//! author : Robert Allen - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var cy = moment.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return cy; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/da.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/da.js deleted file mode 100644 index 70b4c0da..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/da.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : danish (da) -//! author : Ulrik Nielsen : https://github.com/mrbase - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var da = moment.defineLocale('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd [d.] D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[I dag kl.] LT', - nextDay : '[I morgen kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[I går kl.] LT', - lastWeek : '[sidste] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return da; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de-at.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de-at.js deleted file mode 100644 index 0ea81bcd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de-at.js +++ /dev/null @@ -1,79 +0,0 @@ -//! moment.js locale configuration -//! locale : austrian german (de-at) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Martin Groller : https://github.com/MadMG -//! author : Mikolaj Dadela : https://github.com/mik01aj - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de_at = moment.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return de_at; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de.js deleted file mode 100644 index f1dfa9e2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/de.js +++ /dev/null @@ -1,78 +0,0 @@ -//! moment.js locale configuration -//! locale : german (de) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Mikolaj Dadela : https://github.com/mik01aj - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de = moment.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return de; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/dv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/dv.js deleted file mode 100644 index d29d6620..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/dv.js +++ /dev/null @@ -1,99 +0,0 @@ -//! moment.js locale configuration -//! locale : dhivehi (dv) -//! author : Jawish Hameed : https://github.com/jawish - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var months = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ], weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - var dv = moment.defineLocale('dv', { - months : months, - monthsShort : months, - weekdays : weekdays, - weekdaysShort : weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return dv; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/el.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/el.js deleted file mode 100644 index d86666dc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/el.js +++ /dev/null @@ -1,98 +0,0 @@ -//! moment.js locale configuration -//! locale : modern greek (el) -//! author : Aggelos Karalias : https://github.com/mehiel - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - - var el = moment.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - ordinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } - }); - - return el; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-au.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-au.js deleted file mode 100644 index 58608c18..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-au.js +++ /dev/null @@ -1,66 +0,0 @@ -//! moment.js locale configuration -//! locale : australian english (en-au) - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var en_au = moment.defineLocale('en-au', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return en_au; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ca.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ca.js deleted file mode 100644 index 3e3bc4fe..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ca.js +++ /dev/null @@ -1,63 +0,0 @@ -//! moment.js locale configuration -//! locale : canadian english (en-ca) -//! author : Jonathan Abourbih : https://github.com/jonbca - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var en_ca = moment.defineLocale('en-ca', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'YYYY-MM-DD', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - return en_ca; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-gb.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-gb.js deleted file mode 100644 index 47b2c209..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-gb.js +++ /dev/null @@ -1,67 +0,0 @@ -//! moment.js locale configuration -//! locale : great britain english (en-gb) -//! author : Chris Gedrim : https://github.com/chrisgedrim - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var en_gb = moment.defineLocale('en-gb', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return en_gb; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ie.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ie.js deleted file mode 100644 index c0ff10c4..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-ie.js +++ /dev/null @@ -1,67 +0,0 @@ -//! moment.js locale configuration -//! locale : Irish english (en-ie) -//! author : Chris Cartlidge : https://github.com/chriscartlidge - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var en_ie = moment.defineLocale('en-ie', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return en_ie; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-nz.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-nz.js deleted file mode 100644 index 14a50ea4..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/en-nz.js +++ /dev/null @@ -1,66 +0,0 @@ -//! moment.js locale configuration -//! locale : New Zealand english (en-nz) - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var en_nz = moment.defineLocale('en-nz', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return en_nz; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eo.js deleted file mode 100644 index 92772dff..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eo.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : esperanto (eo) -//! author : Colin Dean : https://github.com/colindean -//! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko. -//! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni! - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var eo = moment.defineLocale('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato'.split('_'), - weekdaysShort : 'Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Ĵa_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-an de] MMMM, YYYY', - LLL : 'D[-an de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-an de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'je %s', - past : 'antaŭ %s', - s : 'sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - ordinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return eo; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/es.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/es.js deleted file mode 100644 index 555e94bf..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/es.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : spanish (es) -//! author : Julio Napurí : https://github.com/julionc - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), - monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - - var es = moment.defineLocale('es', { - months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return monthsShort[m.month()]; - } else { - return monthsShortDot[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return es; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/et.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/et.js deleted file mode 100644 index 09043bfa..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/et.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : estonian (et) -//! author : Henry Kehlmann : https://github.com/madhenry -//! improvements : Illimar Tambek : https://github.com/ragulka - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; - } - - var et = moment.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : '%d päeva', - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return et; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eu.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eu.js deleted file mode 100644 index 7383f89b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/eu.js +++ /dev/null @@ -1,66 +0,0 @@ -//! moment.js locale configuration -//! locale : euskara (eu) -//! author : Eneko Illarramendi : https://github.com/eillarra - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var eu = moment.defineLocale('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return eu; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fa.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fa.js deleted file mode 100644 index e2bd7b0b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fa.js +++ /dev/null @@ -1,106 +0,0 @@ -//! moment.js locale configuration -//! locale : Persian (fa) -//! author : Ebrahim Byagowi : https://github.com/ebraminio - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' - }, numberMap = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' - }; - - var fa = moment.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - meridiemParse: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چندین ثانیه', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - ordinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return fa; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fi.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fi.js deleted file mode 100644 index 4f9161bd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fi.js +++ /dev/null @@ -1,107 +0,0 @@ -//! moment.js locale configuration -//! locale : finnish (fi) -//! author : Tarmo Aidantausta : https://github.com/bleadof - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; - function translate(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; - } - function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; - } - - var fi = moment.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return fi; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fo.js deleted file mode 100644 index 460b6cd8..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fo.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : faroese (fo) -//! author : Ragnar Johannesen : https://github.com/ragnar123 - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var fo = moment.defineLocale('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D. MMMM, YYYY HH:mm' - }, - calendar : { - sameDay : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - m : 'ein minutt', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaði', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return fo; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ca.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ca.js deleted file mode 100644 index 52108b88..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ca.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : canadian french (fr-ca) -//! author : Jonathan Abourbih : https://github.com/jonbca - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var fr_ca = moment.defineLocale('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - } - }); - - return fr_ca; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ch.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ch.js deleted file mode 100644 index 876de40a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr-ch.js +++ /dev/null @@ -1,64 +0,0 @@ -//! moment.js locale configuration -//! locale : swiss french (fr) -//! author : Gaspard Bucher : https://github.com/gaspard - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var fr_ch = moment.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return fr_ch; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr.js deleted file mode 100644 index d08ebf1b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fr.js +++ /dev/null @@ -1,64 +0,0 @@ -//! moment.js locale configuration -//! locale : french (fr) -//! author : John Fischer : https://github.com/jfroffice - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var fr = moment.defineLocale('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : ''); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return fr; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fy.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fy.js deleted file mode 100644 index 9d008ca7..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/fy.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : frisian (fy) -//! author : Robin van der Vliet : https://github.com/robin0van0der0v - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - - var fy = moment.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return fy; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gd.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gd.js deleted file mode 100644 index 578e5674..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gd.js +++ /dev/null @@ -1,76 +0,0 @@ -//! moment.js locale configuration -//! locale : great britain scottish gealic (gd) -//! author : Jon Ashdown : https://github.com/jonashdown - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var months = [ - 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd' - ]; - - var monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - - var weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - - var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - - var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - - var gd = moment.defineLocale('gd', { - months : months, - monthsShort : monthsShort, - monthsParseExact : true, - weekdays : weekdays, - weekdaysShort : weekdaysShort, - weekdaysMin : weekdaysMin, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - ordinalParse : /\d{1,2}(d|na|mh)/, - ordinal : function (number) { - var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return gd; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gl.js deleted file mode 100644 index 0621d034..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/gl.js +++ /dev/null @@ -1,77 +0,0 @@ -//! moment.js locale configuration -//! locale : galician (gl) -//! author : Juan G. Hurtado : https://github.com/juanghurtado - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var gl = moment.defineLocale('gl', { - months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'), - monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'), - monthsParseExact: true, - weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'), - weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str === 'uns segundos') { - return 'nuns segundos'; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return gl; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/he.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/he.js deleted file mode 100644 index ffc3e1fd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/he.js +++ /dev/null @@ -1,99 +0,0 @@ -//! moment.js locale configuration -//! locale : Hebrew (he) -//! author : Tomer Cohen : https://github.com/tomer -//! author : Moshe Simantov : https://github.com/DevelopmentIL -//! author : Tal Ater : https://github.com/TalAter - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var he = moment.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [ב]MMMM YYYY', - LLL : 'D [ב]MMMM YYYY HH:mm', - LLLL : 'dddd, D [ב]MMMM YYYY HH:mm', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } - }); - - return he; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hi.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hi.js deleted file mode 100644 index ebd272d1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hi.js +++ /dev/null @@ -1,124 +0,0 @@ -//! moment.js locale configuration -//! locale : hindi (hi) -//! author : Mayank Singhal : https://github.com/mayanksinghal - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var hi = moment.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm बजे', - LTS : 'A h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, A h:mm बजे' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return hi; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hr.js deleted file mode 100644 index a96f3a5a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hr.js +++ /dev/null @@ -1,145 +0,0 @@ -//! moment.js locale configuration -//! locale : hrvatski (hr) -//! author : Bojan Marković : https://github.com/bmarkovic - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var hr = moment.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return hr; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hu.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hu.js deleted file mode 100644 index 27086727..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hu.js +++ /dev/null @@ -1,109 +0,0 @@ -//! moment.js locale configuration -//! locale : hungarian (hu) -//! author : Adam Brunner : https://github.com/adambrunner - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); - function translate(number, withoutSuffix, key, isFuture) { - var num = number, - suffix; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; - } - function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; - } - - var hu = moment.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return hu; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hy-am.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hy-am.js deleted file mode 100644 index 7350bfbe..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/hy-am.js +++ /dev/null @@ -1,95 +0,0 @@ -//! moment.js locale configuration -//! locale : Armenian (hy-am) -//! author : Armendarabyan : https://github.com/armendarabyan - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var hy_am = moment.defineLocale('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY թ.', - LLL : 'D MMMM YYYY թ., HH:mm', - LLLL : 'dddd, D MMMM YYYY թ., HH:mm' - }, - calendar : { - sameDay: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return hy_am; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/id.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/id.js deleted file mode 100644 index 09461a5d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/id.js +++ /dev/null @@ -1,83 +0,0 @@ -//! moment.js locale configuration -//! locale : Bahasa Indonesia (id) -//! author : Mohammad Satrio Utomo : https://github.com/tyok -//! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var id = moment.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return id; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/is.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/is.js deleted file mode 100644 index b6f63ca7..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/is.js +++ /dev/null @@ -1,127 +0,0 @@ -//! moment.js locale configuration -//! locale : icelandic (is) -//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function plural(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (plural(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (plural(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } - } - - var is = moment.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : translate, - m : translate, - mm : translate, - h : 'klukkustund', - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return is; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/it.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/it.js deleted file mode 100644 index e8b2c950..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/it.js +++ /dev/null @@ -1,70 +0,0 @@ -//! moment.js locale configuration -//! locale : italian (it) -//! author : Lorenzo : https://github.com/aliem -//! author: Mattia Larentis: https://github.com/nostalgiaz - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var it = moment.defineLocale('it', { - months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), - monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), - weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'), - weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Me_Gi_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Oggi alle] LT', - nextDay: '[Domani alle] LT', - nextWeek: 'dddd [alle] LT', - lastDay: '[Ieri alle] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[la scorsa] dddd [alle] LT'; - default: - return '[lo scorso] dddd [alle] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : function (s) { - return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; - }, - past : '%s fa', - s : 'alcuni secondi', - m : 'un minuto', - mm : '%d minuti', - h : 'un\'ora', - hh : '%d ore', - d : 'un giorno', - dd : '%d giorni', - M : 'un mese', - MM : '%d mesi', - y : 'un anno', - yy : '%d anni' - }, - ordinalParse : /\d{1,2}º/, - ordinal: '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return it; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ja.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ja.js deleted file mode 100644 index 14754393..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ja.js +++ /dev/null @@ -1,76 +0,0 @@ -//! moment.js locale configuration -//! locale : japanese (ja) -//! author : LI Long : https://github.com/baryon - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ja = moment.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'Ah時m分', - LTS : 'Ah時m分s秒', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah時m分', - LLLL : 'YYYY年M月D日Ah時m分 dddd' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : '[来週]dddd LT', - lastDay : '[昨日] LT', - lastWeek : '[前週]dddd LT', - sameElse : 'L' - }, - ordinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } - }); - - return ja; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/jv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/jv.js deleted file mode 100644 index d3b85a4c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/jv.js +++ /dev/null @@ -1,83 +0,0 @@ -//! moment.js locale configuration -//! locale : Boso Jowo (jv) -//! author : Rony Lantip : https://github.com/lantip -//! reference: http://jv.wikipedia.org/wiki/Basa_Jawa - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var jv = moment.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return jv; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ka.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ka.js deleted file mode 100644 index f052c3ac..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ka.js +++ /dev/null @@ -1,89 +0,0 @@ -//! moment.js locale configuration -//! locale : Georgian (ka) -//! author : Irakli Janiashvili : https://github.com/irakli-janiashvili - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ka = moment.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } - }); - - return ka; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/kk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/kk.js deleted file mode 100644 index 9c005882..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/kk.js +++ /dev/null @@ -1,87 +0,0 @@ -//! moment.js locale configuration -//! locale : kazakh (kk) -//! authors : Nurlan Rakhimzhanov : https://github.com/nurlan - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var suffixes = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' - }; - - var kk = moment.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return kk; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/km.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/km.js deleted file mode 100644 index dcfd911c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/km.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : khmer (km) -//! author : Kruy Vanna : https://github.com/kruyvanna - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var km = moment.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return km; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ko.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ko.js deleted file mode 100644 index 0481987a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ko.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : korean (ko) -//! -//! authors -//! -//! - Kyungwook, Park : https://github.com/kyungw00k -//! - Jeeeyul Lee - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ko = moment.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h시 m분', - LTS : 'A h시 m분 s초', - L : 'YYYY.MM.DD', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h시 m분', - LLLL : 'YYYY년 MMMM D일 dddd A h시 m분' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '일분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - ordinalParse : /\d{1,2}일/, - ordinal : '%d일', - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } - }); - - return ko; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ky.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ky.js deleted file mode 100644 index 346adb70..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ky.js +++ /dev/null @@ -1,88 +0,0 @@ -//! moment.js locale configuration -//! locale : kyrgyz (ky) -//! author : Chyngyz Arystan uulu : https://github.com/chyngyz - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - - var suffixes = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' - }; - - var ky = moment.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кече саат] LT', - lastWeek : '[Өткен аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ky; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lb.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lb.js deleted file mode 100644 index bd51b39b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lb.js +++ /dev/null @@ -1,136 +0,0 @@ -//! moment.js locale configuration -//! locale : Luxembourgish (lb) -//! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; - } - function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; - } - /** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ - function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } - } - - var lb = moment.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - m : processRelativeTime, - mm : '%d Minutten', - h : processRelativeTime, - hh : '%d Stonnen', - d : processRelativeTime, - dd : '%d Deeg', - M : processRelativeTime, - MM : '%d Méint', - y : processRelativeTime, - yy : '%d Joer' - }, - ordinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return lb; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lo.js deleted file mode 100644 index 9171fd74..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lo.js +++ /dev/null @@ -1,70 +0,0 @@ -//! moment.js locale configuration -//! locale : lao (lo) -//! author : Ryan Hart : https://github.com/ryanhart2 - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var lo = moment.defineLocale('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'ວັນdddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - ordinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } - }); - - return lo; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lt.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lt.js deleted file mode 100644 index a3f05d44..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lt.js +++ /dev/null @@ -1,116 +0,0 @@ -//! moment.js locale configuration -//! locale : Lithuanian (lt) -//! author : Mindaugas Mozūras : https://github.com/mmozuras - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var units = { - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' - }; - function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } - } - function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); - } - function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); - } - function forms(key) { - return units[key].split('_'); - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } - } - var lt = moment.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_') - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - m : translateSingular, - mm : translate, - h : translateSingular, - hh : translate, - d : translateSingular, - dd : translate, - M : translateSingular, - MM : translate, - y : translateSingular, - yy : translate - }, - ordinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return lt; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lv.js deleted file mode 100644 index 21e00b0c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/lv.js +++ /dev/null @@ -1,97 +0,0 @@ -//! moment.js locale configuration -//! locale : latvian (lv) -//! author : Kristaps Karlsons : https://github.com/skakri -//! author : Jānis Elmeris : https://github.com/JanisE - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var units = { - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') - }; - /** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ - function format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number !== 11 ? forms[0] : forms[1]; - } - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - return number + ' ' + format(units[key], number, withoutSuffix); - } - function relativeTimeWithSingular(number, withoutSuffix, key) { - return format(units[key], number, withoutSuffix); - } - function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; - } - - var lv = moment.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - m : relativeTimeWithSingular, - mm : relativeTimeWithPlural, - h : relativeTimeWithSingular, - hh : relativeTimeWithPlural, - d : relativeTimeWithSingular, - dd : relativeTimeWithPlural, - M : relativeTimeWithSingular, - MM : relativeTimeWithPlural, - y : relativeTimeWithSingular, - yy : relativeTimeWithPlural - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return lv; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/me.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/me.js deleted file mode 100644 index a78cf5a9..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/me.js +++ /dev/null @@ -1,111 +0,0 @@ -//! moment.js locale configuration -//! locale : Montenegrin (me) -//! author : Miodrag Nikač : https://github.com/miodragnikac - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var me = moment.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mjesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return me; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mk.js deleted file mode 100644 index 89b5414c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mk.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : macedonian (mk) -//! author : Borislav Mickov : https://github.com/B0k0 - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var mk = moment.defineLocale('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return mk; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ml.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ml.js deleted file mode 100644 index 4ffe9317..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ml.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : malayalam (ml) -//! author : Floyd Pink : https://github.com/floydpink - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ml = moment.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), - longDateFormat : { - LT : 'A h:mm -നു', - LTS : 'A h:mm:ss -നു', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm -നു', - LLLL : 'dddd, D MMMM YYYY, A h:mm -നു' - }, - calendar : { - sameDay : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } - }); - - return ml; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mr.js deleted file mode 100644 index 2bdf262d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/mr.js +++ /dev/null @@ -1,159 +0,0 @@ -//! moment.js locale configuration -//! locale : Marathi (mr) -//! author : Harshad Kale : https://github.com/kalehv -//! author : Vivek Athalye : https://github.com/vnathalye - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - function relativeTimeMr(number, withoutSuffix, string, isFuture) - { - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); - } - - var mr = moment.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm वाजता', - LTS : 'A h:mm:ss वाजता', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm वाजता', - LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return mr; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms-my.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms-my.js deleted file mode 100644 index 38c31387..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms-my.js +++ /dev/null @@ -1,82 +0,0 @@ -//! moment.js locale configuration -//! locale : Bahasa Malaysia (ms-MY) -//! author : Weldan Jamili : https://github.com/weldan - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ms_my = moment.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ms_my; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms.js deleted file mode 100644 index fbbb734d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ms.js +++ /dev/null @@ -1,82 +0,0 @@ -//! moment.js locale configuration -//! locale : Bahasa Malaysia (ms-MY) -//! author : Weldan Jamili : https://github.com/weldan - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var ms = moment.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ms; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/my.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/my.js deleted file mode 100644 index 71e99f0e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/my.js +++ /dev/null @@ -1,93 +0,0 @@ -//! moment.js locale configuration -//! locale : Burmese (my) -//! author : Squar team, mysquar.com - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' - }, numberMap = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' - }; - - var my = moment.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 1st is the first week of the year. - } - }); - - return my; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nb.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nb.js deleted file mode 100644 index 45b57a1d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nb.js +++ /dev/null @@ -1,63 +0,0 @@ -//! moment.js locale configuration -//! locale : norwegian bokmål (nb) -//! authors : Espen Hovlandsdal : https://github.com/rexxars -//! Sigurd Gartmann : https://github.com/sigurdga - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var nb = moment.defineLocale('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return nb; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ne.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ne.js deleted file mode 100644 index f40eb8d5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ne.js +++ /dev/null @@ -1,123 +0,0 @@ -//! moment.js locale configuration -//! locale : nepali/nepalese -//! author : suvash : https://github.com/suvash - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var ne = moment.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'Aको h:mm बजे', - LTS : 'Aको h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, Aको h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ne; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nl.js deleted file mode 100644 index df36a45c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nl.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : dutch (nl) -//! author : Joris Röling : https://github.com/jjupiter - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - - var nl = moment.defineLocale('nl', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return nl; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nn.js deleted file mode 100644 index 980b5305..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/nn.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : norwegian nynorsk (nn) -//! author : https://github.com/mechuwind - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var nn = moment.defineLocale('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return nn; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pa-in.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pa-in.js deleted file mode 100644 index 1d4e366b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pa-in.js +++ /dev/null @@ -1,124 +0,0 @@ -//! moment.js locale configuration -//! locale : punjabi india (pa-in) -//! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' - }, - numberMap = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' - }; - - var pa_in = moment.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calender but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - longDateFormat : { - LT : 'A h:mm ਵਜੇ', - LTS : 'A h:mm:ss ਵਜੇ', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm ਵਜੇ', - LLLL : 'dddd, D MMMM YYYY, A h:mm ਵਜੇ' - }, - calendar : { - sameDay : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return pa_in; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pl.js deleted file mode 100644 index fa815794..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pl.js +++ /dev/null @@ -1,105 +0,0 @@ -//! moment.js locale configuration -//! locale : polish (pl) -//! author : Rafal Hirsz : https://github.com/evoL - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); - function plural(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); - } - function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (plural(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (plural(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (plural(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (plural(number) ? 'lata' : 'lat'); - } - } - - var pl = moment.defineLocale('pl', { - months : function (momentToFormat, format) { - if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'nie_pon_wt_śr_czw_pt_sb'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: '[W] dddd [o] LT', - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - m : translate, - mm : translate, - h : translate, - hh : translate, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : translate, - y : 'rok', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return pl; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt-br.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt-br.js deleted file mode 100644 index 84e6cdd1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt-br.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : brazilian portuguese (pt-br) -//! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var pt_br = moment.defineLocale('pt-br', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : '%s atrás', - s : 'poucos segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº' - }); - - return pt_br; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt.js deleted file mode 100644 index b7fcd5ab..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/pt.js +++ /dev/null @@ -1,65 +0,0 @@ -//! moment.js locale configuration -//! locale : portuguese (pt) -//! author : Jefferson : https://github.com/jalex79 - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var pt = moment.defineLocale('pt', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return pt; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ro.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ro.js deleted file mode 100644 index 09ffc193..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ro.js +++ /dev/null @@ -1,75 +0,0 @@ -//! moment.js locale configuration -//! locale : romanian (ro) -//! author : Vlad Gurdiga : https://github.com/gurdiga -//! author : Valentin Agachi : https://github.com/avaly - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; - } - - var ro = moment.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - m : 'un minut', - mm : relativeTimeWithPlural, - h : 'o oră', - hh : relativeTimeWithPlural, - d : 'o zi', - dd : relativeTimeWithPlural, - M : 'o lună', - MM : relativeTimeWithPlural, - y : 'un an', - yy : relativeTimeWithPlural - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ro; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ru.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ru.js deleted file mode 100644 index ec3df2e0..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ru.js +++ /dev/null @@ -1,175 +0,0 @@ -//! moment.js locale configuration -//! locale : russian (ru) -//! author : Viktorminator : https://github.com/Viktorminator -//! Author : Menelion Elensúle : https://github.com/Oire -//! author : Коренберг Марк : https://github.com/socketpair - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } - var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; - - // http://new.gramota.ru/spravka/rules/139-prop : § 103 - // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 - // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 - var ru = moment.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - monthsRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsStrictRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortStrictRegex: /^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сегодня в] LT', - nextDay: '[Завтра в] LT', - lastDay: '[Вчера в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'час', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - ordinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ru; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/se.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/se.js deleted file mode 100644 index 06be0d6b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/se.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : Northern Sami (se) -//! authors : Bård Rolstad Henriksen : https://github.com/karamell - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - - var se = moment.defineLocale('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return se; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/si.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/si.js deleted file mode 100644 index 8a771644..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/si.js +++ /dev/null @@ -1,71 +0,0 @@ -//! moment.js locale configuration -//! locale : Sinhalese (si) -//! author : Sampath Sitinamaluwa : https://github.com/sampathsris - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - /*jshint -W100*/ - var si = moment.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - ordinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } - }); - - return si; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sk.js deleted file mode 100644 index 52838a3a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sk.js +++ /dev/null @@ -1,150 +0,0 @@ -//! moment.js locale configuration -//! locale : slovak (sk) -//! author : Martin Minka : https://github.com/k2s -//! based on work of petrbela : https://github.com/petrbela - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); - function plural(n) { - return (n > 1) && (n < 5); - } - function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } - } - - var sk = moment.defineLocale('sk', { - months : months, - monthsShort : monthsShort, - weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), - weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'), - weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return sk; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sl.js deleted file mode 100644 index a6bb706c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sl.js +++ /dev/null @@ -1,162 +0,0 @@ -//! moment.js locale configuration -//! locale : slovenian (sl) -//! author : Robert Sedovšek : https://github.com/sedovsek - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } - } - - var sl = moment.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return sl; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sq.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sq.js deleted file mode 100644 index 68dbc146..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sq.js +++ /dev/null @@ -1,70 +0,0 @@ -//! moment.js locale configuration -//! locale : Albanian (sq) -//! author : Flakërim Ismani : https://github.com/flakerimi -//! author: Menelion Elensúle: https://github.com/Oire (tests) -//! author : Oerd Cukalla : https://github.com/oerd (fixes) - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var sq = moment.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return sq; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr-cyrl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr-cyrl.js deleted file mode 100644 index 42f9ed4b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr-cyrl.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Serbian-cyrillic (sr-cyrl) -//! author : Milan Janačković : https://github.com/milan-j - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var translator = { - words: { //Different grammatical cases - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr_cyrl = moment.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'дан', - dd : translator.translate, - M : 'месец', - MM : translator.translate, - y : 'годину', - yy : translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return sr_cyrl; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr.js deleted file mode 100644 index d334e78d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sr.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Serbian-latin (sr) -//! author : Milan Janačković : https://github.com/milan-j - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr = moment.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return sr; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ss.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ss.js deleted file mode 100644 index 0839239b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ss.js +++ /dev/null @@ -1,89 +0,0 @@ -//! moment.js locale configuration -//! locale : siSwati (ss) -//! author : Nicolai Davies : https://github.com/nicolaidavies - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - - var ss = moment.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - ordinalParse: /\d{1,2}/, - ordinal : '%d', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return ss; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sv.js deleted file mode 100644 index a21237dc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sv.js +++ /dev/null @@ -1,69 +0,0 @@ -//! moment.js locale configuration -//! locale : swedish (sv) -//! author : Jens Alm : https://github.com/ulmus - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var sv = moment.defineLocale('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return sv; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sw.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sw.js deleted file mode 100644 index 1460edd4..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/sw.js +++ /dev/null @@ -1,59 +0,0 @@ -//! moment.js locale configuration -//! locale : swahili (sw) -//! author : Fahad Kassim : https://github.com/fadsel - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var sw = moment.defineLocale('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return sw; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ta.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ta.js deleted file mode 100644 index 27665095..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/ta.js +++ /dev/null @@ -1,129 +0,0 @@ -//! moment.js locale configuration -//! locale : tamil (ta) -//! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404 - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var symbolMap = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' - }, numberMap = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' - }; - - var ta = moment.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, HH:mm', - LLLL : 'dddd, D MMMM YYYY, HH:mm' - }, - calendar : { - sameDay : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - ordinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return ta; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/te.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/te.js deleted file mode 100644 index f5d16209..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/te.js +++ /dev/null @@ -1,89 +0,0 @@ -//! moment.js locale configuration -//! locale : telugu (te) -//! author : Krishna Chaitanya Thota : https://github.com/kcthota - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var te = moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - ordinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - return te; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/th.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/th.js deleted file mode 100644 index fc4e8f8b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/th.js +++ /dev/null @@ -1,67 +0,0 @@ -//! moment.js locale configuration -//! locale : thai (th) -//! author : Kridsada Thanabulpong : https://github.com/sirn - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var th = moment.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H นาฬิกา m นาที', - LTS : 'H นาฬิกา m นาที s วินาที', - L : 'YYYY/MM/DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H นาฬิกา m นาที', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } - }); - - return th; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tl-ph.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tl-ph.js deleted file mode 100644 index d101fd92..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tl-ph.js +++ /dev/null @@ -1,62 +0,0 @@ -//! moment.js locale configuration -//! locale : Tagalog/Filipino (tl-ph) -//! author : Dan Hagman - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var tl_ph = moment.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: '[Ngayon sa] LT', - nextDay: '[Bukas sa] LT', - nextWeek: 'dddd [sa] LT', - lastDay: '[Kahapon sa] LT', - lastWeek: 'dddd [huling linggo] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return tl_ph; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tlh.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tlh.js deleted file mode 100644 index 660d70d1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tlh.js +++ /dev/null @@ -1,120 +0,0 @@ -//! moment.js locale configuration -//! locale : Klingon (tlh) -//! author : Dominika Kruk : https://github.com/amaranthrose - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - - function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; - } - - function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; - } - - function translate(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } - } - - function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; - } - - var tlh = moment.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - m : 'wa’ tup', - mm : translate, - h : 'wa’ rep', - hh : translate, - d : 'wa’ jaj', - dd : translate, - M : 'wa’ jar', - MM : translate, - y : 'wa’ DIS', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return tlh; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tr.js deleted file mode 100644 index 638edbb0..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tr.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : turkish (tr) -//! authors : Erhan Gundogan : https://github.com/erhangundogan, -//! Burak Yiğit Kaya: https://github.com/BYK - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var suffixes = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' - }; - - var tr = moment.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[haftaya] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen hafta] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return tr; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzl.js deleted file mode 100644 index ddbbf017..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzl.js +++ /dev/null @@ -1,91 +0,0 @@ -//! moment.js locale configuration -//! locale : talossan (tzl) -//! author : Robin van der Vliet : https://github.com/robin0van0der0v with the help of Iustì Canun - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - - // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. - // This is currently too difficult (maybe even impossible) to add. - var tzl = moment.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); - } - - return tzl; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm-latn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm-latn.js deleted file mode 100644 index 712f5f5e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm-latn.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn) -//! author : Abdel Said : https://github.com/abdelsaid - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var tzm_latn = moment.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return tzm_latn; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm.js deleted file mode 100644 index 6b8acc08..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/tzm.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : Morocco Central Atlas Tamaziɣt (tzm) -//! author : Abdel Said : https://github.com/abdelsaid - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var tzm = moment.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - return tzm; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uk.js deleted file mode 100644 index 80c34973..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uk.js +++ /dev/null @@ -1,146 +0,0 @@ -//! moment.js locale configuration -//! locale : ukrainian (uk) -//! author : zemlanin : https://github.com/zemlanin -//! Author : Menelion Elensúle : https://github.com/Oire - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + plural(format[key], +number); - } - } - function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }, - nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; - } - function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; - } - - var uk = moment.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY р.', - LLL : 'D MMMM YYYY р., HH:mm', - LLLL : 'dddd, D MMMM YYYY р., HH:mm' - }, - calendar : { - sameDay: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'годину', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'місяць', - MM : relativeTimeWithPlural, - y : 'рік', - yy : relativeTimeWithPlural - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - ordinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - return uk; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uz.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uz.js deleted file mode 100644 index fcf594e6..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/uz.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : uzbek (uz) -//! author : Sardor Muminov : https://github.com/muminoff - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var uz = moment.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } - }); - - return uz; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/vi.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/vi.js deleted file mode 100644 index d3ee6ea0..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/vi.js +++ /dev/null @@ -1,79 +0,0 @@ -//! moment.js locale configuration -//! locale : vietnamese (vi) -//! author : Bang Nguyen : https://github.com/bangnk - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var vi = moment.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return vi; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/x-pseudo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/x-pseudo.js deleted file mode 100644 index ce45b8aa..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/x-pseudo.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : pseudo (x-pseudo) -//! author : Andrew Hood : https://github.com/andrewhood125 - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var x_pseudo = moment.defineLocale('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return x_pseudo; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-cn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-cn.js deleted file mode 100644 index cbc3f870..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-cn.js +++ /dev/null @@ -1,127 +0,0 @@ -//! moment.js locale configuration -//! locale : chinese (zh-cn) -//! author : suupic : https://github.com/suupic -//! author : Zeno Zeng : https://github.com/zenozeng - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var zh_cn = moment.defineLocale('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah点mm分', - LTS : 'Ah点m分s秒', - L : 'YYYY-MM-DD', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah点mm分', - LLLL : 'YYYY年MMMD日ddddAh点mm分', - l : 'YYYY-MM-DD', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah点mm分', - llll : 'YYYY年MMMD日ddddAh点mm分' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : function () { - return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT'; - }, - nextDay : function () { - return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT'; - }, - lastDay : function () { - return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT'; - }, - nextWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - lastWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - sameElse : 'LL' - }, - ordinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - return zh_cn; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-tw.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-tw.js deleted file mode 100644 index 664f5ec1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/locale/zh-tw.js +++ /dev/null @@ -1,101 +0,0 @@ -//! moment.js locale configuration -//! locale : traditional chinese (zh-tw) -//! author : Ben : https://github.com/ben-lin - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - - var zh_tw = moment.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah點mm分', - LTS : 'Ah點m分s秒', - L : 'YYYY年MMMD日', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah點mm分', - LLLL : 'YYYY年MMMD日ddddAh點mm分', - l : 'YYYY年MMMD日', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah點mm分', - llll : 'YYYY年MMMD日ddddAh點mm分' - }, - meridiemParse: /早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - ordinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - m : '1分鐘', - mm : '%d分鐘', - h : '1小時', - hh : '%d小時', - d : '1天', - dd : '%d天', - M : '1個月', - MM : '%d個月', - y : '1年', - yy : '%d年' - } - }); - - return zh_tw; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.js deleted file mode 100644 index a3474229..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.js +++ /dev/null @@ -1,8021 +0,0 @@ -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - //! moment.js locale configuration - //! locale : afrikaans (af) - //! author : Werner Mollentze : https://github.com/wernerm - - var af = moment.defineLocale('af', { - months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'), - weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), - weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), - meridiemParse: /vm|nm/i, - isPM : function (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? 'nm' : 'NM'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Vandag om] LT', - nextDay : '[Môre om] LT', - nextWeek : 'dddd [om] LT', - lastDay : '[Gister om] LT', - lastWeek : '[Laas] dddd [om] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'oor %s', - past : '%s gelede', - s : '\'n paar sekondes', - m : '\'n minuut', - mm : '%d minute', - h : '\'n uur', - hh : '%d ure', - d : '\'n dag', - dd : '%d dae', - M : '\'n maand', - MM : '%d maande', - y : '\'n jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter - }, - week : { - dow : 1, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. - } - }); - - //! moment.js locale configuration - //! locale : Moroccan Arabic (ar-ma) - //! author : ElFadili Yassine : https://github.com/ElFadiliY - //! author : Abdel Said : https://github.com/abdelsaid - - var ar_ma = moment.defineLocale('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Arabic Saudi Arabia (ar-sa) - //! author : Suhail Alkowaileet : https://github.com/xsoh - - var ar_sa__symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, ar_sa__numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }; - - var ar_sa = moment.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return ar_sa__numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ar_sa__symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Tunisian Arabic (ar-tn) - - var ar_tn = moment.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%d سنوات' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! Locale: Arabic (ar) - //! Author: Abdel Said: https://github.com/abdelsaid - //! Changes in months, weekdays: Ahmed Elkhatib - //! Native plural forms: forabi https://github.com/forabi - - var ar__symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, ar__numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, ar__months = [ - 'كانون الثاني يناير', - 'شباط فبراير', - 'آذار مارس', - 'نيسان أبريل', - 'أيار مايو', - 'حزيران يونيو', - 'تموز يوليو', - 'آب أغسطس', - 'أيلول سبتمبر', - 'تشرين الأول أكتوبر', - 'تشرين الثاني نوفمبر', - 'كانون الأول ديسمبر' - ]; - - var ar = moment.defineLocale('ar', { - months : ar__months, - monthsShort : ar__months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/\u200FM/\u200FYYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return ar__numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ar__symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : azerbaijani (az) - //! author : topchiyev : https://github.com/topchiyev - - var az__suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' - }; - - var az = moment.defineLocale('az', { - months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'), - monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'), - weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } - }, - ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (az__suffixes[a] || az__suffixes[b] || az__suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : belarusian (be) - //! author : Dmitry Demidov : https://github.com/demidov91 - //! author: Praleska: http://praleska.pro/ - //! Author : Menelion Elensúle : https://github.com/Oire - - function be__plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function be__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + be__plural(format[key], +number); - } - } - - var be = moment.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : be__relativeTimeWithPlural, - mm : be__relativeTimeWithPlural, - h : be__relativeTimeWithPlural, - hh : be__relativeTimeWithPlural, - d : 'дзень', - dd : be__relativeTimeWithPlural, - M : 'месяц', - MM : be__relativeTimeWithPlural, - y : 'год', - yy : be__relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - ordinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : bulgarian (bg) - //! author : Krasen Borisov : https://github.com/kraz - - var bg = moment.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bengali (bn) - //! author : Kaushik Gandhi : https://github.com/kaushikgandhi - - var bn__symbolMap = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' - }, - bn__numberMap = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' - }; - - var bn = moment.defineLocale('bn', { - months : 'জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'), - longDateFormat : { - LT : 'A h:mm সময়', - LTS : 'A h:mm:ss সময়', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm সময়', - LLLL : 'dddd, D MMMM YYYY, A h:mm সময়' - }, - calendar : { - sameDay : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return bn__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return bn__symbolMap[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : tibetan (bo) - //! author : Thupten N. Chakrishar : https://github.com/vajradog - - var bo__symbolMap = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' - }, - bo__numberMap = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' - }; - - var bo = moment.defineLocale('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return bo__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return bo__symbolMap[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; - } else { - return 'མཚན་མོ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : breton (br) - //! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou - - function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); - } - function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } - } - function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; - } - function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; - } - function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); - } - - var br = moment.defineLocale('br', { - months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'), - monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'), - weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'), - weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), - weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h[e]mm A', - LTS : 'h[e]mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D [a viz] MMMM YYYY', - LLL : 'D [a viz] MMMM YYYY h[e]mm A', - LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A' - }, - calendar : { - sameDay : '[Hiziv da] LT', - nextDay : '[Warc\'hoazh da] LT', - nextWeek : 'dddd [da] LT', - lastDay : '[Dec\'h da] LT', - lastWeek : 'dddd [paset da] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'a-benn %s', - past : '%s \'zo', - s : 'un nebeud segondennoù', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - ordinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : bosnian (bs) - //! author : Nedim Cholich : https://github.com/frontyard - //! based on (hr) translation by Bojan Marković - - function bs__translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var bs = moment.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : bs__translate, - mm : bs__translate, - h : bs__translate, - hh : bs__translate, - d : 'dan', - dd : bs__translate, - M : 'mjesec', - MM : bs__translate, - y : 'godinu', - yy : bs__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : catalan (ca) - //! author : Juan G. Hurtado : https://github.com/juanghurtado - - var ca = moment.defineLocale('ca', { - months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'fa %s', - s : 'uns segons', - m : 'un minut', - mm : '%d minuts', - h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', - M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - ordinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : czech (cs) - //! author : petrbela : https://github.com/petrbela - - var cs__months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), - cs__monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); - function cs__plural(n) { - return (n > 1) && (n < 5) && (~~(n / 10) !== 1); - } - function cs__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } - } - - var cs = moment.defineLocale('cs', { - months : cs__months, - monthsShort : cs__monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(cs__months, cs__monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(cs__monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(cs__months)), - weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), - weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), - weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : cs__translate, - m : cs__translate, - mm : cs__translate, - h : cs__translate, - hh : cs__translate, - d : cs__translate, - dd : cs__translate, - M : cs__translate, - MM : cs__translate, - y : cs__translate, - yy : cs__translate - }, - ordinalParse : /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : chuvash (cv) - //! author : Anatoly Mironov : https://github.com/mirontoli - - var cv = moment.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - ordinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Welsh (cy) - //! author : Robert Allen - - var cy = moment.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : danish (da) - //! author : Ulrik Nielsen : https://github.com/mrbase - - var da = moment.defineLocale('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd [d.] D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[I dag kl.] LT', - nextDay : '[I morgen kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[I går kl.] LT', - lastWeek : '[sidste] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : austrian german (de-at) - //! author : lluchs : https://github.com/lluchs - //! author: Menelion Elensúle: https://github.com/Oire - //! author : Martin Groller : https://github.com/MadMG - //! author : Mikolaj Dadela : https://github.com/mik01aj - - function de_at__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de_at = moment.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : de_at__processRelativeTime, - mm : '%d Minuten', - h : de_at__processRelativeTime, - hh : '%d Stunden', - d : de_at__processRelativeTime, - dd : de_at__processRelativeTime, - M : de_at__processRelativeTime, - MM : de_at__processRelativeTime, - y : de_at__processRelativeTime, - yy : de_at__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : german (de) - //! author : lluchs : https://github.com/lluchs - //! author: Menelion Elensúle: https://github.com/Oire - //! author : Mikolaj Dadela : https://github.com/mik01aj - - function de__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de = moment.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : de__processRelativeTime, - mm : '%d Minuten', - h : de__processRelativeTime, - hh : '%d Stunden', - d : de__processRelativeTime, - dd : de__processRelativeTime, - M : de__processRelativeTime, - MM : de__processRelativeTime, - y : de__processRelativeTime, - yy : de__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : dhivehi (dv) - //! author : Jawish Hameed : https://github.com/jawish - - var dv__months = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ], dv__weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - var dv = moment.defineLocale('dv', { - months : dv__months, - monthsShort : dv__months, - weekdays : dv__weekdays, - weekdaysShort : dv__weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - //! moment.js locale configuration - //! locale : modern greek (el) - //! author : Aggelos Karalias : https://github.com/mehiel - - var el = moment.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - ordinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : australian english (en-au) - - var en_au = moment.defineLocale('en-au', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : canadian english (en-ca) - //! author : Jonathan Abourbih : https://github.com/jonbca - - var en_ca = moment.defineLocale('en-ca', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'YYYY-MM-DD', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - //! moment.js locale configuration - //! locale : great britain english (en-gb) - //! author : Chris Gedrim : https://github.com/chrisgedrim - - var en_gb = moment.defineLocale('en-gb', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Irish english (en-ie) - //! author : Chris Cartlidge : https://github.com/chriscartlidge - - var en_ie = moment.defineLocale('en-ie', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : New Zealand english (en-nz) - - var en_nz = moment.defineLocale('en-nz', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : esperanto (eo) - //! author : Colin Dean : https://github.com/colindean - //! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko. - //! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni! - - var eo = moment.defineLocale('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato'.split('_'), - weekdaysShort : 'Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Ĵa_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-an de] MMMM, YYYY', - LLL : 'D[-an de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-an de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'je %s', - past : 'antaŭ %s', - s : 'sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - ordinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : spanish (es) - //! author : Julio Napurí : https://github.com/julionc - - var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), - es__monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - - var es = moment.defineLocale('es', { - months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return es__monthsShort[m.month()]; - } else { - return monthsShortDot[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : estonian (et) - //! author : Henry Kehlmann : https://github.com/madhenry - //! improvements : Illimar Tambek : https://github.com/ragulka - - function et__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; - } - - var et = moment.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : et__processRelativeTime, - m : et__processRelativeTime, - mm : et__processRelativeTime, - h : et__processRelativeTime, - hh : et__processRelativeTime, - d : et__processRelativeTime, - dd : '%d päeva', - M : et__processRelativeTime, - MM : et__processRelativeTime, - y : et__processRelativeTime, - yy : et__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : euskara (eu) - //! author : Eneko Illarramendi : https://github.com/eillarra - - var eu = moment.defineLocale('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Persian (fa) - //! author : Ebrahim Byagowi : https://github.com/ebraminio - - var fa__symbolMap = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' - }, fa__numberMap = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' - }; - - var fa = moment.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - meridiemParse: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چندین ثانیه', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return fa__numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return fa__symbolMap[match]; - }).replace(/,/g, '،'); - }, - ordinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : finnish (fi) - //! author : Tarmo Aidantausta : https://github.com/bleadof - - var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; - function fi__translate(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; - } - function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; - } - - var fi = moment.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : fi__translate, - m : fi__translate, - mm : fi__translate, - h : fi__translate, - hh : fi__translate, - d : fi__translate, - dd : fi__translate, - M : fi__translate, - MM : fi__translate, - y : fi__translate, - yy : fi__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : faroese (fo) - //! author : Ragnar Johannesen : https://github.com/ragnar123 - - var fo = moment.defineLocale('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D. MMMM, YYYY HH:mm' - }, - calendar : { - sameDay : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - m : 'ein minutt', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaði', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : canadian french (fr-ca) - //! author : Jonathan Abourbih : https://github.com/jonbca - - var fr_ca = moment.defineLocale('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - } - }); - - //! moment.js locale configuration - //! locale : swiss french (fr) - //! author : Gaspard Bucher : https://github.com/gaspard - - var fr_ch = moment.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : french (fr) - //! author : John Fischer : https://github.com/jfroffice - - var fr = moment.defineLocale('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : ''); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : frisian (fy) - //! author : Robin van der Vliet : https://github.com/robin0van0der0v - - var fy__monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - fy__monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - - var fy = moment.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return fy__monthsShortWithoutDots[m.month()]; - } else { - return fy__monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : great britain scottish gealic (gd) - //! author : Jon Ashdown : https://github.com/jonashdown - - var gd__months = [ - 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd' - ]; - - var gd__monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - - var gd__weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - - var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - - var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - - var gd = moment.defineLocale('gd', { - months : gd__months, - monthsShort : gd__monthsShort, - monthsParseExact : true, - weekdays : gd__weekdays, - weekdaysShort : weekdaysShort, - weekdaysMin : weekdaysMin, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - ordinalParse : /\d{1,2}(d|na|mh)/, - ordinal : function (number) { - var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : galician (gl) - //! author : Juan G. Hurtado : https://github.com/juanghurtado - - var gl = moment.defineLocale('gl', { - months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'), - monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'), - monthsParseExact: true, - weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'), - weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str === 'uns segundos') { - return 'nuns segundos'; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Hebrew (he) - //! author : Tomer Cohen : https://github.com/tomer - //! author : Moshe Simantov : https://github.com/DevelopmentIL - //! author : Tal Ater : https://github.com/TalAter - - var he = moment.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [ב]MMMM YYYY', - LLL : 'D [ב]MMMM YYYY HH:mm', - LLLL : 'dddd, D [ב]MMMM YYYY HH:mm', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } - }); - - //! moment.js locale configuration - //! locale : hindi (hi) - //! author : Mayank Singhal : https://github.com/mayanksinghal - - var hi__symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - hi__numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var hi = moment.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm बजे', - LTS : 'A h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, A h:mm बजे' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return hi__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return hi__symbolMap[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : hrvatski (hr) - //! author : Bojan Marković : https://github.com/bmarkovic - - function hr__translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var hr = moment.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : hr__translate, - mm : hr__translate, - h : hr__translate, - hh : hr__translate, - d : 'dan', - dd : hr__translate, - M : 'mjesec', - MM : hr__translate, - y : 'godinu', - yy : hr__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : hungarian (hu) - //! author : Adam Brunner : https://github.com/adambrunner - - var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); - function hu__translate(number, withoutSuffix, key, isFuture) { - var num = number, - suffix; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; - } - function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; - } - - var hu = moment.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : hu__translate, - m : hu__translate, - mm : hu__translate, - h : hu__translate, - hh : hu__translate, - d : hu__translate, - dd : hu__translate, - M : hu__translate, - MM : hu__translate, - y : hu__translate, - yy : hu__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Armenian (hy-am) - //! author : Armendarabyan : https://github.com/armendarabyan - - var hy_am = moment.defineLocale('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY թ.', - LLL : 'D MMMM YYYY թ., HH:mm', - LLLL : 'dddd, D MMMM YYYY թ., HH:mm' - }, - calendar : { - sameDay: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bahasa Indonesia (id) - //! author : Mohammad Satrio Utomo : https://github.com/tyok - //! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan - - var id = moment.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : icelandic (is) - //! author : Hinrik Örn Sigurðsson : https://github.com/hinrik - - function is__plural(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; - } - function is__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (is__plural(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (is__plural(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (is__plural(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (is__plural(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (is__plural(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } - } - - var is = moment.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : is__translate, - m : is__translate, - mm : is__translate, - h : 'klukkustund', - hh : is__translate, - d : is__translate, - dd : is__translate, - M : is__translate, - MM : is__translate, - y : is__translate, - yy : is__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : italian (it) - //! author : Lorenzo : https://github.com/aliem - //! author: Mattia Larentis: https://github.com/nostalgiaz - - var it = moment.defineLocale('it', { - months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), - monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), - weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'), - weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Me_Gi_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Oggi alle] LT', - nextDay: '[Domani alle] LT', - nextWeek: 'dddd [alle] LT', - lastDay: '[Ieri alle] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[la scorsa] dddd [alle] LT'; - default: - return '[lo scorso] dddd [alle] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : function (s) { - return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; - }, - past : '%s fa', - s : 'alcuni secondi', - m : 'un minuto', - mm : '%d minuti', - h : 'un\'ora', - hh : '%d ore', - d : 'un giorno', - dd : '%d giorni', - M : 'un mese', - MM : '%d mesi', - y : 'un anno', - yy : '%d anni' - }, - ordinalParse : /\d{1,2}º/, - ordinal: '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : japanese (ja) - //! author : LI Long : https://github.com/baryon - - var ja = moment.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'Ah時m分', - LTS : 'Ah時m分s秒', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah時m分', - LLLL : 'YYYY年M月D日Ah時m分 dddd' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : '[来週]dddd LT', - lastDay : '[昨日] LT', - lastWeek : '[前週]dddd LT', - sameElse : 'L' - }, - ordinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } - }); - - //! moment.js locale configuration - //! locale : Boso Jowo (jv) - //! author : Rony Lantip : https://github.com/lantip - //! reference: http://jv.wikipedia.org/wiki/Basa_Jawa - - var jv = moment.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Georgian (ka) - //! author : Irakli Janiashvili : https://github.com/irakli-janiashvili - - var ka = moment.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } - }); - - //! moment.js locale configuration - //! locale : kazakh (kk) - //! authors : Nurlan Rakhimzhanov : https://github.com/nurlan - - var kk__suffixes = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' - }; - - var kk = moment.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (kk__suffixes[number] || kk__suffixes[a] || kk__suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : khmer (km) - //! author : Kruy Vanna : https://github.com/kruyvanna - - var km = moment.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : korean (ko) - //! - //! authors - //! - //! - Kyungwook, Park : https://github.com/kyungw00k - //! - Jeeeyul Lee - - var ko = moment.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h시 m분', - LTS : 'A h시 m분 s초', - L : 'YYYY.MM.DD', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h시 m분', - LLLL : 'YYYY년 MMMM D일 dddd A h시 m분' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '일분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - ordinalParse : /\d{1,2}일/, - ordinal : '%d일', - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } - }); - - //! moment.js locale configuration - //! locale : kyrgyz (ky) - //! author : Chyngyz Arystan uulu : https://github.com/chyngyz - - - var ky__suffixes = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' - }; - - var ky = moment.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кече саат] LT', - lastWeek : '[Өткен аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (ky__suffixes[number] || ky__suffixes[a] || ky__suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Luxembourgish (lb) - //! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz - - function lb__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; - } - function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; - } - /** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ - function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } - } - - var lb = moment.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - m : lb__processRelativeTime, - mm : '%d Minutten', - h : lb__processRelativeTime, - hh : '%d Stonnen', - d : lb__processRelativeTime, - dd : '%d Deeg', - M : lb__processRelativeTime, - MM : '%d Méint', - y : lb__processRelativeTime, - yy : '%d Joer' - }, - ordinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : lao (lo) - //! author : Ryan Hart : https://github.com/ryanhart2 - - var lo = moment.defineLocale('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'ວັນdddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - ordinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } - }); - - //! moment.js locale configuration - //! locale : Lithuanian (lt) - //! author : Mindaugas Mozūras : https://github.com/mmozuras - - var lt__units = { - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' - }; - function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } - } - function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); - } - function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); - } - function forms(key) { - return lt__units[key].split('_'); - } - function lt__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } - } - var lt = moment.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_') - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - m : translateSingular, - mm : lt__translate, - h : translateSingular, - hh : lt__translate, - d : translateSingular, - dd : lt__translate, - M : translateSingular, - MM : lt__translate, - y : translateSingular, - yy : lt__translate - }, - ordinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : latvian (lv) - //! author : Kristaps Karlsons : https://github.com/skakri - //! author : Jānis Elmeris : https://github.com/JanisE - - var lv__units = { - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') - }; - /** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ - function format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number !== 11 ? forms[0] : forms[1]; - } - } - function lv__relativeTimeWithPlural(number, withoutSuffix, key) { - return number + ' ' + format(lv__units[key], number, withoutSuffix); - } - function relativeTimeWithSingular(number, withoutSuffix, key) { - return format(lv__units[key], number, withoutSuffix); - } - function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; - } - - var lv = moment.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - m : relativeTimeWithSingular, - mm : lv__relativeTimeWithPlural, - h : relativeTimeWithSingular, - hh : lv__relativeTimeWithPlural, - d : relativeTimeWithSingular, - dd : lv__relativeTimeWithPlural, - M : relativeTimeWithSingular, - MM : lv__relativeTimeWithPlural, - y : relativeTimeWithSingular, - yy : lv__relativeTimeWithPlural - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Montenegrin (me) - //! author : Miodrag Nikač : https://github.com/miodragnikac - - var me__translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = me__translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + me__translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var me = moment.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - m : me__translator.translate, - mm : me__translator.translate, - h : me__translator.translate, - hh : me__translator.translate, - d : 'dan', - dd : me__translator.translate, - M : 'mjesec', - MM : me__translator.translate, - y : 'godinu', - yy : me__translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : macedonian (mk) - //! author : Borislav Mickov : https://github.com/B0k0 - - var mk = moment.defineLocale('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : malayalam (ml) - //! author : Floyd Pink : https://github.com/floydpink - - var ml = moment.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), - longDateFormat : { - LT : 'A h:mm -നു', - LTS : 'A h:mm:ss -നു', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm -നു', - LLLL : 'dddd, D MMMM YYYY, A h:mm -നു' - }, - calendar : { - sameDay : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } - }); - - //! moment.js locale configuration - //! locale : Marathi (mr) - //! author : Harshad Kale : https://github.com/kalehv - //! author : Vivek Athalye : https://github.com/vnathalye - - var mr__symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - mr__numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - function relativeTimeMr(number, withoutSuffix, string, isFuture) - { - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); - } - - var mr = moment.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm वाजता', - LTS : 'A h:mm:ss वाजता', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm वाजता', - LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return mr__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return mr__symbolMap[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bahasa Malaysia (ms-MY) - //! author : Weldan Jamili : https://github.com/weldan - - var ms_my = moment.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bahasa Malaysia (ms-MY) - //! author : Weldan Jamili : https://github.com/weldan - - var ms = moment.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Burmese (my) - //! author : Squar team, mysquar.com - - var my__symbolMap = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' - }, my__numberMap = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' - }; - - var my = moment.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return my__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return my__symbolMap[match]; - }); - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : norwegian bokmål (nb) - //! authors : Espen Hovlandsdal : https://github.com/rexxars - //! Sigurd Gartmann : https://github.com/sigurdga - - var nb = moment.defineLocale('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : nepali/nepalese - //! author : suvash : https://github.com/suvash - - var ne__symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - ne__numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var ne = moment.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'Aको h:mm बजे', - LTS : 'Aको h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, Aको h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return ne__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ne__symbolMap[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : dutch (nl) - //! author : Joris Röling : https://github.com/jjupiter - - var nl__monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - nl__monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - - var nl = moment.defineLocale('nl', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return nl__monthsShortWithoutDots[m.month()]; - } else { - return nl__monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : norwegian nynorsk (nn) - //! author : https://github.com/mechuwind - - var nn = moment.defineLocale('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : punjabi india (pa-in) - //! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit - - var pa_in__symbolMap = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' - }, - pa_in__numberMap = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' - }; - - var pa_in = moment.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calender but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - longDateFormat : { - LT : 'A h:mm ਵਜੇ', - LTS : 'A h:mm:ss ਵਜੇ', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm ਵਜੇ', - LLLL : 'dddd, D MMMM YYYY, A h:mm ਵਜੇ' - }, - calendar : { - sameDay : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return pa_in__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return pa_in__symbolMap[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : polish (pl) - //! author : Rafal Hirsz : https://github.com/evoL - - var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); - function pl__plural(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); - } - function pl__translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (pl__plural(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (pl__plural(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (pl__plural(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (pl__plural(number) ? 'lata' : 'lat'); - } - } - - var pl = moment.defineLocale('pl', { - months : function (momentToFormat, format) { - if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'nie_pon_wt_śr_czw_pt_sb'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: '[W] dddd [o] LT', - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - m : pl__translate, - mm : pl__translate, - h : pl__translate, - hh : pl__translate, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : pl__translate, - y : 'rok', - yy : pl__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : brazilian portuguese (pt-br) - //! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira - - var pt_br = moment.defineLocale('pt-br', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : '%s atrás', - s : 'poucos segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº' - }); - - //! moment.js locale configuration - //! locale : portuguese (pt) - //! author : Jefferson : https://github.com/jalex79 - - var pt = moment.defineLocale('pt', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : romanian (ro) - //! author : Vlad Gurdiga : https://github.com/gurdiga - //! author : Valentin Agachi : https://github.com/avaly - - function ro__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; - } - - var ro = moment.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - m : 'un minut', - mm : ro__relativeTimeWithPlural, - h : 'o oră', - hh : ro__relativeTimeWithPlural, - d : 'o zi', - dd : ro__relativeTimeWithPlural, - M : 'o lună', - MM : ro__relativeTimeWithPlural, - y : 'un an', - yy : ro__relativeTimeWithPlural - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : russian (ru) - //! author : Viktorminator : https://github.com/Viktorminator - //! Author : Menelion Elensúle : https://github.com/Oire - //! author : Коренберг Марк : https://github.com/socketpair - - function ru__plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function ru__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + ru__plural(format[key], +number); - } - } - var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; - - // http://new.gramota.ru/spravka/rules/139-prop : § 103 - // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 - // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 - var ru = moment.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - monthsRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsStrictRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortStrictRegex: /^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сегодня в] LT', - nextDay: '[Завтра в] LT', - lastDay: '[Вчера в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - m : ru__relativeTimeWithPlural, - mm : ru__relativeTimeWithPlural, - h : 'час', - hh : ru__relativeTimeWithPlural, - d : 'день', - dd : ru__relativeTimeWithPlural, - M : 'месяц', - MM : ru__relativeTimeWithPlural, - y : 'год', - yy : ru__relativeTimeWithPlural - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - ordinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Northern Sami (se) - //! authors : Bård Rolstad Henriksen : https://github.com/karamell - - - var se = moment.defineLocale('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Sinhalese (si) - //! author : Sampath Sitinamaluwa : https://github.com/sampathsris - - /*jshint -W100*/ - var si = moment.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - ordinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } - }); - - //! moment.js locale configuration - //! locale : slovak (sk) - //! author : Martin Minka : https://github.com/k2s - //! based on work of petrbela : https://github.com/petrbela - - var sk__months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - sk__monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); - function sk__plural(n) { - return (n > 1) && (n < 5); - } - function sk__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } - } - - var sk = moment.defineLocale('sk', { - months : sk__months, - monthsShort : sk__monthsShort, - weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), - weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'), - weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : sk__translate, - m : sk__translate, - mm : sk__translate, - h : sk__translate, - hh : sk__translate, - d : sk__translate, - dd : sk__translate, - M : sk__translate, - MM : sk__translate, - y : sk__translate, - yy : sk__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : slovenian (sl) - //! author : Robert Sedovšek : https://github.com/sedovsek - - function sl__processRelativeTime(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } - } - - var sl = moment.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : sl__processRelativeTime, - m : sl__processRelativeTime, - mm : sl__processRelativeTime, - h : sl__processRelativeTime, - hh : sl__processRelativeTime, - d : sl__processRelativeTime, - dd : sl__processRelativeTime, - M : sl__processRelativeTime, - MM : sl__processRelativeTime, - y : sl__processRelativeTime, - yy : sl__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Albanian (sq) - //! author : Flakërim Ismani : https://github.com/flakerimi - //! author: Menelion Elensúle: https://github.com/Oire (tests) - //! author : Oerd Cukalla : https://github.com/oerd (fixes) - - var sq = moment.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Serbian-cyrillic (sr-cyrl) - //! author : Milan Janačković : https://github.com/milan-j - - var sr_cyrl__translator = { - words: { //Different grammatical cases - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = sr_cyrl__translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + sr_cyrl__translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr_cyrl = moment.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - m : sr_cyrl__translator.translate, - mm : sr_cyrl__translator.translate, - h : sr_cyrl__translator.translate, - hh : sr_cyrl__translator.translate, - d : 'дан', - dd : sr_cyrl__translator.translate, - M : 'месец', - MM : sr_cyrl__translator.translate, - y : 'годину', - yy : sr_cyrl__translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Serbian-latin (sr) - //! author : Milan Janačković : https://github.com/milan-j - - var sr__translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = sr__translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + sr__translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr = moment.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - m : sr__translator.translate, - mm : sr__translator.translate, - h : sr__translator.translate, - hh : sr__translator.translate, - d : 'dan', - dd : sr__translator.translate, - M : 'mesec', - MM : sr__translator.translate, - y : 'godinu', - yy : sr__translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : siSwati (ss) - //! author : Nicolai Davies : https://github.com/nicolaidavies - - - var ss = moment.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - ordinalParse: /\d{1,2}/, - ordinal : '%d', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : swedish (sv) - //! author : Jens Alm : https://github.com/ulmus - - var sv = moment.defineLocale('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : swahili (sw) - //! author : Fahad Kassim : https://github.com/fadsel - - var sw = moment.defineLocale('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : tamil (ta) - //! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404 - - var ta__symbolMap = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' - }, ta__numberMap = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' - }; - - var ta = moment.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, HH:mm', - LLLL : 'dddd, D MMMM YYYY, HH:mm' - }, - calendar : { - sameDay : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - ordinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return ta__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ta__symbolMap[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : telugu (te) - //! author : Krishna Chaitanya Thota : https://github.com/kcthota - - var te = moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - ordinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : thai (th) - //! author : Kridsada Thanabulpong : https://github.com/sirn - - var th = moment.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H นาฬิกา m นาที', - LTS : 'H นาฬิกา m นาที s วินาที', - L : 'YYYY/MM/DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H นาฬิกา m นาที', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } - }); - - //! moment.js locale configuration - //! locale : Tagalog/Filipino (tl-ph) - //! author : Dan Hagman - - var tl_ph = moment.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: '[Ngayon sa] LT', - nextDay: '[Bukas sa] LT', - nextWeek: 'dddd [sa] LT', - lastDay: '[Kahapon sa] LT', - lastWeek: 'dddd [huling linggo] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Klingon (tlh) - //! author : Dominika Kruk : https://github.com/amaranthrose - - var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - - function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; - } - - function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; - } - - function tlh__translate(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } - } - - function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; - } - - var tlh = moment.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - m : 'wa’ tup', - mm : tlh__translate, - h : 'wa’ rep', - hh : tlh__translate, - d : 'wa’ jaj', - dd : tlh__translate, - M : 'wa’ jar', - MM : tlh__translate, - y : 'wa’ DIS', - yy : tlh__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : turkish (tr) - //! authors : Erhan Gundogan : https://github.com/erhangundogan, - //! Burak Yiğit Kaya: https://github.com/BYK - - var tr__suffixes = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' - }; - - var tr = moment.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[haftaya] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen hafta] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (tr__suffixes[a] || tr__suffixes[b] || tr__suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : talossan (tzl) - //! author : Robin van der Vliet : https://github.com/robin0van0der0v with the help of Iustì Canun - - - // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. - // This is currently too difficult (maybe even impossible) to add. - var tzl = moment.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : tzl__processRelativeTime, - m : tzl__processRelativeTime, - mm : tzl__processRelativeTime, - h : tzl__processRelativeTime, - hh : tzl__processRelativeTime, - d : tzl__processRelativeTime, - dd : tzl__processRelativeTime, - M : tzl__processRelativeTime, - MM : tzl__processRelativeTime, - y : tzl__processRelativeTime, - yy : tzl__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - function tzl__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); - } - - //! moment.js locale configuration - //! locale : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn) - //! author : Abdel Said : https://github.com/abdelsaid - - var tzm_latn = moment.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Morocco Central Atlas Tamaziɣt (tzm) - //! author : Abdel Said : https://github.com/abdelsaid - - var tzm = moment.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : ukrainian (uk) - //! author : zemlanin : https://github.com/zemlanin - //! Author : Menelion Elensúle : https://github.com/Oire - - function uk__plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function uk__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + uk__plural(format[key], +number); - } - } - function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }, - nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; - } - function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; - } - - var uk = moment.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY р.', - LLL : 'D MMMM YYYY р., HH:mm', - LLLL : 'dddd, D MMMM YYYY р., HH:mm' - }, - calendar : { - sameDay: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - m : uk__relativeTimeWithPlural, - mm : uk__relativeTimeWithPlural, - h : 'годину', - hh : uk__relativeTimeWithPlural, - d : 'день', - dd : uk__relativeTimeWithPlural, - M : 'місяць', - MM : uk__relativeTimeWithPlural, - y : 'рік', - yy : uk__relativeTimeWithPlural - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - ordinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : uzbek (uz) - //! author : Sardor Muminov : https://github.com/muminoff - - var uz = moment.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : vietnamese (vi) - //! author : Bang Nguyen : https://github.com/bangnk - - var vi = moment.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : pseudo (x-pseudo) - //! author : Andrew Hood : https://github.com/andrewhood125 - - var x_pseudo = moment.defineLocale('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : chinese (zh-cn) - //! author : suupic : https://github.com/suupic - //! author : Zeno Zeng : https://github.com/zenozeng - - var zh_cn = moment.defineLocale('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah点mm分', - LTS : 'Ah点m分s秒', - L : 'YYYY-MM-DD', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah点mm分', - LLLL : 'YYYY年MMMD日ddddAh点mm分', - l : 'YYYY-MM-DD', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah点mm分', - llll : 'YYYY年MMMD日ddddAh点mm分' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : function () { - return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT'; - }, - nextDay : function () { - return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT'; - }, - lastDay : function () { - return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT'; - }, - nextWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - lastWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - sameElse : 'LL' - }, - ordinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : traditional chinese (zh-tw) - //! author : Ben : https://github.com/ben-lin - - var zh_tw = moment.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah點mm分', - LTS : 'Ah點m分s秒', - L : 'YYYY年MMMD日', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah點mm分', - LLLL : 'YYYY年MMMD日ddddAh點mm分', - l : 'YYYY年MMMD日', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah點mm分', - llll : 'YYYY年MMMD日ddddAh點mm分' - }, - meridiemParse: /早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - ordinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - m : '1分鐘', - mm : '%d分鐘', - h : '1小時', - hh : '%d小時', - d : '1天', - dd : '%d天', - M : '1個月', - MM : '%d個月', - y : '1年', - yy : '%d年' - } - }); - - moment.locale('en'); - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.min.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.min.js deleted file mode 100644 index e58d3bea..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/locales.min.js +++ /dev/null @@ -1,73 +0,0 @@ -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module&&"function"==typeof require?b(require("../moment")):"function"==typeof define&&define.amd?define(["moment"],b):b(a.moment)}(this,function(a){"use strict"; -//! moment.js locale configuration -//! locale : belarusian (be) -//! author : Dmitry Demidov : https://github.com/demidov91 -//! author: Praleska: http://praleska.pro/ -//! Author : Menelion Elensúle : https://github.com/Oire -function b(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:c?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:c?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===d?c?"хвіліна":"хвіліну":"h"===d?c?"гадзіна":"гадзіну":a+" "+b(e[d],+a)} -//! moment.js locale configuration -//! locale : breton (br) -//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou -function d(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+g(d[c],a)}function e(a){switch(f(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function f(a){return a>9?f(a%10):a}function g(a,b){return 2===b?h(a):a}function h(a){var b={m:"v",b:"v",d:"z"};return void 0===b[a.charAt(0)]?a:b[a.charAt(0)]+a.substring(1)} -//! moment.js locale configuration -//! locale : bosnian (bs) -//! author : Nedim Cholich : https://github.com/frontyard -//! based on (hr) translation by Bojan Marković -function i(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function j(a){return a>1&&5>a&&1!==~~(a/10)}function k(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekund":"pár sekundami";case"m":return b?"minuta":d?"minutu":"minutou";case"mm":return b||d?e+(j(a)?"minuty":"minut"):e+"minutami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(j(a)?"hodiny":"hodin"):e+"hodinami";break;case"d":return b||d?"den":"dnem";case"dd":return b||d?e+(j(a)?"dny":"dní"):e+"dny";break;case"M":return b||d?"měsíc":"měsícem";case"MM":return b||d?e+(j(a)?"měsíce":"měsíců"):e+"měsíci";break;case"y":return b||d?"rok":"rokem";case"yy":return b||d?e+(j(a)?"roky":"let"):e+"lety"}} -//! moment.js locale configuration -//! locale : austrian german (de-at) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Martin Groller : https://github.com/MadMG -//! author : Mikolaj Dadela : https://github.com/mik01aj -function l(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]} -//! moment.js locale configuration -//! locale : german (de) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Mikolaj Dadela : https://github.com/mik01aj -function m(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}function n(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)} -//! moment.js locale configuration -//! locale : estonian (et) -//! author : Henry Kehlmann : https://github.com/madhenry -//! improvements : Illimar Tambek : https://github.com/ragulka -function o(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}function p(a,b,c,d){var e="";switch(c){case"s":return d?"muutaman sekunnin":"muutama sekunti";case"m":return d?"minuutin":"minuutti";case"mm":e=d?"minuutin":"minuuttia";break;case"h":return d?"tunnin":"tunti";case"hh":e=d?"tunnin":"tuntia";break;case"d":return d?"päivän":"päivä";case"dd":e=d?"päivän":"päivää";break;case"M":return d?"kuukauden":"kuukausi";case"MM":e=d?"kuukauden":"kuukautta";break;case"y":return d?"vuoden":"vuosi";case"yy":e=d?"vuoden":"vuotta"}return e=q(a,d)+" "+e}function q(a,b){return 10>a?b?va[a]:ua[a]:a} -//! moment.js locale configuration -//! locale : hrvatski (hr) -//! author : Bojan Marković : https://github.com/bmarkovic -function r(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function s(a,b,c,d){var e=a;switch(c){case"s":return d||b?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" óra":" órája");case"hh":return e+(d||b?" óra":" órája");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hónap":" hónapja");case"MM":return e+(d||b?" hónap":" hónapja");case"y":return"egy"+(d||b?" év":" éve");case"yy":return e+(d||b?" év":" éve")}return""}function t(a){return(a?"":"[múlt] ")+"["+Fa[this.day()]+"] LT[-kor]"} -//! moment.js locale configuration -//! locale : icelandic (is) -//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik -function u(a){return a%100===11?!0:a%10===1?!1:!0}function v(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return b?"mínúta":"mínútu";case"mm":return u(a)?e+(b||d?"mínútur":"mínútum"):b?e+"mínúta":e+"mínútu";case"hh":return u(a)?e+(b||d?"klukkustundir":"klukkustundum"):e+"klukkustund";case"d":return b?"dagur":d?"dag":"degi";case"dd":return u(a)?b?e+"dagar":e+(d?"daga":"dögum"):b?e+"dagur":e+(d?"dag":"degi");case"M":return b?"mánuður":d?"mánuð":"mánuði";case"MM":return u(a)?b?e+"mánuðir":e+(d?"mánuði":"mánuðum"):b?e+"mánuður":e+(d?"mánuð":"mánuði");case"y":return b||d?"ár":"ári";case"yy":return u(a)?e+(b||d?"ár":"árum"):e+(b||d?"ár":"ári")}} -//! moment.js locale configuration -//! locale : Luxembourgish (lb) -//! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz -function w(a,b,c,d){var e={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return b?e[c][0]:e[c][1]}function x(a){var b=a.substr(0,a.indexOf(" "));return z(b)?"a "+a:"an "+a}function y(a){var b=a.substr(0,a.indexOf(" "));return z(b)?"viru "+a:"virun "+a}function z(a){if(a=parseInt(a,10),isNaN(a))return!1;if(0>a)return!0;if(10>a)return a>=4&&7>=a?!0:!1;if(100>a){var b=a%10,c=a/10;return z(0===b?c:b)}if(1e4>a){for(;a>=10;)a/=10;return z(a)}return a/=1e3,z(a)}function A(a,b,c,d){return b?"kelios sekundės":d?"kelių sekundžių":"kelias sekundes"}function B(a,b,c,d){return b?D(c)[0]:d?D(c)[1]:D(c)[2]}function C(a){return a%10===0||a>10&&20>a}function D(a){return Ia[a].split("_")}function E(a,b,c,d){var e=a+" ";return 1===a?e+B(a,b,c[0],d):b?e+(C(a)?D(c)[1]:D(c)[0]):d?e+D(c)[1]:e+(C(a)?D(c)[1]:D(c)[2])}function F(a,b,c){return c?b%10===1&&11!==b?a[2]:a[3]:b%10===1&&11!==b?a[0]:a[1]}function G(a,b,c){return a+" "+F(Ja[c],a,b)}function H(a,b,c){return F(Ja[c],a,b)}function I(a,b){return b?"dažas sekundes":"dažām sekundēm"}function J(a,b,c,d){var e="";if(b)switch(c){case"s":e="काही सेकंद";break;case"m":e="एक मिनिट";break;case"mm":e="%d मिनिटे";break;case"h":e="एक तास";break;case"hh":e="%d तास";break;case"d":e="एक दिवस";break;case"dd":e="%d दिवस";break;case"M":e="एक महिना";break;case"MM":e="%d महिने";break;case"y":e="एक वर्ष";break;case"yy":e="%d वर्षे"}else switch(c){case"s":e="काही सेकंदां";break;case"m":e="एका मिनिटा";break;case"mm":e="%d मिनिटां";break;case"h":e="एका तासा";break;case"hh":e="%d तासां";break;case"d":e="एका दिवसा";break;case"dd":e="%d दिवसां";break;case"M":e="एका महिन्या";break;case"MM":e="%d महिन्यां";break;case"y":e="एका वर्षा";break;case"yy":e="%d वर्षां"}return e.replace(/%d/i,a)}function K(a){return 5>a%10&&a%10>1&&~~(a/10)%10!==1}function L(a,b,c){var d=a+" ";switch(c){case"m":return b?"minuta":"minutę";case"mm":return d+(K(a)?"minuty":"minut");case"h":return b?"godzina":"godzinę";case"hh":return d+(K(a)?"godziny":"godzin");case"MM":return d+(K(a)?"miesiące":"miesięcy");case"yy":return d+(K(a)?"lata":"lat")}} -//! moment.js locale configuration -//! locale : romanian (ro) -//! author : Vlad Gurdiga : https://github.com/gurdiga -//! author : Valentin Agachi : https://github.com/avaly -function M(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]} -//! moment.js locale configuration -//! locale : russian (ru) -//! author : Viktorminator : https://github.com/Viktorminator -//! Author : Menelion Elensúle : https://github.com/Oire -//! author : Коренберг Марк : https://github.com/socketpair -function N(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function O(a,b,c){var d={mm:b?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===c?b?"минута":"минуту":a+" "+N(d[c],+a)}function P(a){return a>1&&5>a}function Q(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekúnd":"pár sekundami";case"m":return b?"minúta":d?"minútu":"minútou";case"mm":return b||d?e+(P(a)?"minúty":"minút"):e+"minútami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(P(a)?"hodiny":"hodín"):e+"hodinami";break;case"d":return b||d?"deň":"dňom";case"dd":return b||d?e+(P(a)?"dni":"dní"):e+"dňami";break;case"M":return b||d?"mesiac":"mesiacom";case"MM":return b||d?e+(P(a)?"mesiace":"mesiacov"):e+"mesiacmi";break;case"y":return b||d?"rok":"rokom";case"yy":return b||d?e+(P(a)?"roky":"rokov"):e+"rokmi"}} -//! moment.js locale configuration -//! locale : slovenian (sl) -//! author : Robert Sedovšek : https://github.com/sedovsek -function R(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nekaj sekund":"nekaj sekundami";case"m":return b?"ena minuta":"eno minuto";case"mm":return e+=1===a?b?"minuta":"minuto":2===a?b||d?"minuti":"minutama":5>a?b||d?"minute":"minutami":b||d?"minut":"minutami";case"h":return b?"ena ura":"eno uro";case"hh":return e+=1===a?b?"ura":"uro":2===a?b||d?"uri":"urama":5>a?b||d?"ure":"urami":b||d?"ur":"urami";case"d":return b||d?"en dan":"enim dnem";case"dd":return e+=1===a?b||d?"dan":"dnem":2===a?b||d?"dni":"dnevoma":b||d?"dni":"dnevi";case"M":return b||d?"en mesec":"enim mesecem";case"MM":return e+=1===a?b||d?"mesec":"mesecem":2===a?b||d?"meseca":"mesecema":5>a?b||d?"mesece":"meseci":b||d?"mesecev":"meseci";case"y":return b||d?"eno leto":"enim letom";case"yy":return e+=1===a?b||d?"leto":"letom":2===a?b||d?"leti":"letoma":5>a?b||d?"leta":"leti":b||d?"let":"leti"}}function S(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"leS":-1!==a.indexOf("jar")?b.slice(0,-3)+"waQ":-1!==a.indexOf("DIS")?b.slice(0,-3)+"nem":b+" pIq"}function T(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"Hu’":-1!==a.indexOf("jar")?b.slice(0,-3)+"wen":-1!==a.indexOf("DIS")?b.slice(0,-3)+"ben":b+" ret"}function U(a,b,c,d){var e=V(a);switch(c){case"mm":return e+" tup";case"hh":return e+" rep";case"dd":return e+" jaj";case"MM":return e+" jar";case"yy":return e+" DIS"}}function V(a){var b=Math.floor(a%1e3/100),c=Math.floor(a%100/10),d=a%10,e="";return b>0&&(e+=cb[b]+"vatlh"),c>0&&(e+=(""!==e?" ":"")+cb[c]+"maH"),d>0&&(e+=(""!==e?" ":"")+cb[d]),""===e?"pagh":e}function W(a,b,c,d){var e={s:["viensas secunds","'iensas secunds"],m:["'n míut","'iens míut"],mm:[a+" míuts",""+a+" míuts"],h:["'n þora","'iensa þora"],hh:[a+" þoras",""+a+" þoras"],d:["'n ziua","'iensa ziua"],dd:[a+" ziuas",""+a+" ziuas"],M:["'n mes","'iens mes"],MM:[a+" mesen",""+a+" mesen"],y:["'n ar","'iens ar"],yy:[a+" ars",""+a+" ars"]};return d?e[c][0]:b?e[c][0]:e[c][1]} -//! moment.js locale configuration -//! locale : ukrainian (uk) -//! author : zemlanin : https://github.com/zemlanin -//! Author : Menelion Elensúle : https://github.com/Oire -function X(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Y(a,b,c){var d={mm:b?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:b?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===c?b?"хвилина":"хвилину":"h"===c?b?"година":"годину":a+" "+X(d[c],+a)}function Z(a,b){var c={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},d=/(\[[ВвУу]\]) ?dddd/.test(b)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function $(a){return function(){return a+"о"+(11===this.hours()?"б":"")+"] LT"}} -//! moment.js locale configuration -//! locale : afrikaans (af) -//! author : Werner Mollentze : https://github.com/wernerm -var _=(a.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(a){return/^nm$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"vm":"VM":c?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[Môre om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),a.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),aa={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},ba=(a.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(a){return a.replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return aa[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return _[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),a.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),ca={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},da=function(a){return 0===a?0:1===a?1:2===a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5},ea={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},fa=function(a){return function(b,c,d,e){var f=da(b),g=ea[a][da(b)];return 2===f&&(g=g[c?0:1]),g.replace(/%d/i,b)}},ga=["كانون الثاني يناير","شباط فبراير","آذار مارس","نيسان أبريل","أيار مايو","حزيران يونيو","تموز يوليو","آب أغسطس","أيلول سبتمبر","تشرين الأول أكتوبر","تشرين الثاني نوفمبر","كانون الأول ديسمبر"],ha=(a.defineLocale("ar",{months:ga,monthsShort:ga,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:fa("s"),m:fa("m"),mm:fa("m"),h:fa("h"),hh:fa("h"),d:fa("d"),dd:fa("d"),M:fa("M"),MM:fa("M"),y:fa("y"),yy:fa("y")},preparse:function(a){return a.replace(/\u200f/g,"").replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return ca[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return ba[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),{1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"}),ia=(a.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"birneçə saniyyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(a){return/^(gündüz|axşam)$/.test(a)},meridiem:function(a,b,c){return 4>a?"gecə":12>a?"səhər":17>a?"gündüz":"axşam"},ordinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(a){if(0===a)return a+"-ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(ha[b]||ha[c]||ha[d])},week:{dow:1,doy:7}}),a.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:c,mm:c,h:c,hh:c,d:"дзень",dd:c,M:"месяц",MM:c,y:"год",yy:c},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(a){return/^(дня|вечара)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночы":12>a?"раніцы":17>a?"дня":"вечара"},ordinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a%10!==2&&a%10!==3||a%100===12||a%100===13?a+"-ы":a+"-і";case"D":return a+"-га";default:return a}},week:{dow:1,doy:7}}),a.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[В изминалата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[В изминалия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),{1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"}),ja={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"},ka=(a.defineLocale("bn",{months:"জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি".split("_"),weekdaysMin:"রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(a){return a.replace(/[১২৩৪৫৬৭৮৯০]/g,function(a){return ja[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return ia[a]})},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(a,b){return 12===a&&(a=0),"রাত"===b&&a>=4||"দুপুর"===b&&5>a||"বিকাল"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"রাত":10>a?"সকাল":17>a?"দুপুর":20>a?"বিকাল":"রাত"},week:{dow:0,doy:6}}),{1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"}),la={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"},ma=(a.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(a){return a.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,function(a){return la[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return ka[a]})},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(a,b){return 12===a&&(a=0),"མཚན་མོ"===b&&a>=4||"ཉིན་གུང"===b&&5>a||"དགོང་དག"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"མཚན་མོ":10>a?"ཞོགས་ཀས":17>a?"ཉིན་གུང":20>a?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}}),a.defineLocale("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h[e]mm A",LTS:"h[e]mm:ss A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY h[e]mm A",LLLL:"dddd, D [a viz] MMMM YYYY h[e]mm A"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondennoù",m:"ur vunutenn",mm:d,h:"un eur",hh:"%d eur",d:"un devezh",dd:d,M:"ur miz",MM:d,y:"ur bloaz",yy:e},ordinalParse:/\d{1,2}(añ|vet)/,ordinal:function(a){var b=1===a?"añ":"vet";return a+b},week:{dow:1,doy:4}}),a.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:i,mm:i,h:i,hh:i,d:"dan",dd:i,M:"mjesec",MM:i,y:"godinu",yy:i},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),a.defineLocale("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd D MMMM YYYY H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(a,b){var c=1===a?"r":2===a?"n":3===a?"r":4===a?"t":"è";return("w"===b||"W"===b)&&(c="a"),a+c},week:{dow:1,doy:4}}),"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_")),na="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),oa=(a.defineLocale("cs",{months:ma,monthsShort:na,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(ma,na),shortMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(na),longMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(ma),weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:k,m:k,mm:k,h:k,hh:k,d:k,dd:k,M:k,MM:k,y:k,yy:k},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(a){var b=/сехет$/i.exec(a)?"рен":/ҫул$/i.exec(a)?"тан":"ран";return a+b},past:"%s каялла",s:"пӗр-ик ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},ordinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}}),a.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},ordinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(a){var b=a,c="",d=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return b>20?c=40===b||50===b||60===b||80===b||100===b?"fed":"ain":b>0&&(c=d[b]),a+c},week:{dow:1,doy:4}}),a.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY HH:mm"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:l,mm:"%d Minuten",h:l,hh:"%d Stunden",d:l,dd:l,M:l,MM:l,y:l,yy:l},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:m,mm:"%d Minuten",h:m,hh:"%d Stunden",d:m,dd:m,M:m,MM:m,y:m,yy:m},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"]),pa=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],qa=(a.defineLocale("dv",{months:oa,monthsShort:oa,weekdays:pa,weekdaysShort:pa,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(a){return"މފ"===a},meridiem:function(a,b,c){return 12>a?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(a){return a.replace(/،/g,",")},postformat:function(a){return a.replace(/,/g,"،")},week:{dow:7,doy:12}}),a.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(a,b,c){return a>11?c?"μμ":"ΜΜ":c?"πμ":"ΠΜ"},isPM:function(a){return"μ"===(a+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){switch(this.day()){case 6:return"[το προηγούμενο] dddd [{}] LT";default:return"[την προηγούμενη] dddd [{}] LT"}},sameElse:"L"},calendar:function(a,b){var c=this._calendarEl[a],d=b&&b.hours();return n(c)&&(c=c.apply(b)),c.replace("{}",d%12===1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}}),a.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),a.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),a.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),a.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),a.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"),weekdays:"Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato".split("_"), -weekdaysShort:"Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Ĵa_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd, [la] D[-an de] MMMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(a){return"p"===a.charAt(0).toLowerCase()},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd [je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasinta] dddd [je] LT",sameElse:"L"},relativeTime:{future:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}}),"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_")),ra="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),sa=(a.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?ra[a.month()]:qa[a.month()]},monthsParseExact:!0,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),a.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:o,m:o,mm:o,h:o,hh:o,d:o,dd:"%d päeva",M:o,MM:o,y:o,yy:o},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"}),ta={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"},ua=(a.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(a){return/بعد از ظهر/.test(a)},meridiem:function(a,b,c){return 12>a?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چندین ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(a){return a.replace(/[۰-۹]/g,function(a){return ta[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return sa[a]}).replace(/,/g,"،")},ordinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}}),"nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" ")),va=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",ua[7],ua[8],ua[9]],wa=(a.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:p,m:p,mm:p,h:p,hh:p,d:p,dd:p,M:p,MM:p,y:p,yy:p},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",m:"ein minutt",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaði",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")}}),a.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")},week:{dow:1,doy:4}}),a.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|)/,ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}}),"jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_")),xa="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),ya=(a.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?xa[a.month()]:wa[a.month()]},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"]),za=["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],Aa=["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],Ba=["Did","Dil","Dim","Dic","Dia","Dih","Dis"],Ca=["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],Da=(a.defineLocale("gd",{months:ya,monthsShort:za,monthsParseExact:!0,weekdays:Aa,weekdaysShort:Ba,weekdaysMin:Ca,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},ordinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(a){var b=1===a?"d":a%10===2?"na":"mh";return a+b},week:{dow:1,doy:4}}),a.defineLocale("gl",{months:"Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"),monthsShort:"Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.".split("_"),monthsParseExact:!0,weekdays:"Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mér._Xov._Ven._Sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mé_Xo_Ve_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd D MMMM YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:7}}),a.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(a){return 2===a?"שעתיים":a+" שעות"},d:"יום",dd:function(a){return 2===a?"יומיים":a+" ימים"},M:"חודש",MM:function(a){return 2===a?"חודשיים":a+" חודשים"},y:"שנה",yy:function(a){return 2===a?"שנתיים":a%10===0&&10!==a?a+" שנה":a+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(a){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(a)},meridiem:function(a,b,c){return 5>a?"לפנות בוקר":10>a?"בבוקר":12>a?c?'לפנה"צ':"לפני הצהריים":18>a?c?'אחה"צ':"אחרי הצהריים":"בערב"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Ea={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Fa=(a.defineLocale("hi",{months:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Ea[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Da[a]})},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात"===b?4>a?a:a+12:"सुबह"===b?a:"दोपहर"===b?a>=10?a:a+12:"शाम"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात":10>a?"सुबह":17>a?"दोपहर":20>a?"शाम":"रात"},week:{dow:0,doy:6}}),a.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:r,mm:r,h:r,hh:r,d:"dan",dd:r,M:"mjesec",MM:r,y:"godinu",yy:r},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),"vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ")),Ga=(a.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(a){return"u"===a.charAt(1).toLowerCase()},meridiem:function(a,b,c){return 12>a?c===!0?"de":"DE":c===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return t.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return t.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:s,m:s,mm:s,h:s,hh:s,d:s,dd:s,M:s,MM:s,y:s,yy:s},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),a.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(a){return/^(ցերեկվա|երեկոյան)$/.test(a)},meridiem:function(a){return 4>a?"գիշերվա":12>a?"առավոտվա":17>a?"ցերեկվա":"երեկոյան"},ordinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(a,b){switch(b){case"DDD":case"w":case"W":case"DDDo":return 1===a?a+"-ին":a+"-րդ";default:return a}},week:{dow:1,doy:7}}),a.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(a,b){return 12===a&&(a=0),"pagi"===b?a:"siang"===b?a>=11?a:a+12:"sore"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"siang":19>a?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}}),a.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:v,m:v,mm:v,h:"klukkustund",hh:v,d:v,dd:v,M:v,MM:v,y:v,yy:v},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"Do_Lu_Ma_Me_Gi_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){switch(this.day()){case 0:return"[la scorsa] dddd [alle] LT";default:return"[lo scorso] dddd [alle] LT"}},sameElse:"L"},relativeTime:{future:function(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"alcuni secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),a.defineLocale("ja",{months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"Ah時m分",LTS:"Ah時m分s秒",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah時m分",LLLL:"YYYY年M月D日Ah時m分 dddd"},meridiemParse:/午前|午後/i,isPM:function(a){return"午後"===a},meridiem:function(a,b,c){return 12>a?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},ordinalParse:/\d{1,2}日/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";default:return a}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}}),a.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(a,b){return 12===a&&(a=0),"enjing"===b?a:"siyang"===b?a>=11?a:a+12:"sonten"===b||"ndalu"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"enjing":15>a?"siyang":19>a?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}}),a.defineLocale("ka",{months:{standalone:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),format:"იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს".split("_")},monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(a){return/(წამი|წუთი|საათი|წელი)/.test(a)?a.replace(/ი$/,"ში"):a+"ში"},past:function(a){return/(წამი|წუთი|საათი|დღე|თვე)/.test(a)?a.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(a)?a.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(a){return 0===a?a:1===a?a+"-ლი":20>a||100>=a&&a%20===0||a%100===0?"მე-"+a:a+"-ე"},week:{dow:1,doy:7}}),{0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"}),Ha=(a.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(Ga[a]||Ga[b]||Ga[c])},week:{dow:1,doy:7}}),a.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysMin:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}}),a.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 m분",LTS:"A h시 m분 s초",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h시 m분",LLLL:"YYYY년 MMMM D일 dddd A h시 m분"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"일분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},ordinalParse:/\d{1,2}일/,ordinal:"%d일",meridiemParse:/오전|오후/,isPM:function(a){return"오후"===a},meridiem:function(a,b,c){return 12>a?"오전":"오후"}}),{0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"}),Ia=(a.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кече саат] LT",lastWeek:"[Өткен аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(Ha[a]||Ha[b]||Ha[c])},week:{dow:1,doy:7}}),a.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"), -monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:x,past:y,s:"e puer Sekonnen",m:w,mm:"%d Minutten",h:w,hh:"%d Stonnen",d:w,dd:"%d Deeg",M:w,MM:"%d Méint",y:w,yy:"%d Joer"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(a){return"ຕອນແລງ"===a},meridiem:function(a,b,c){return 12>a?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},ordinalParse:/(ທີ່)\d{1,2}/,ordinal:function(a){return"ທີ່"+a}}),{m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"}),Ja=(a.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_")},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:A,m:B,mm:E,h:B,hh:E,d:B,dd:E,M:B,MM:E,y:B,yy:E},ordinalParse:/\d{1,2}-oji/,ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}}),{m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")}),Ka=(a.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:I,m:H,mm:G,h:H,hh:G,d:H,dd:G,M:H,MM:G,y:H,yy:G},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=Ka.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+Ka.correctGrammaticalCase(a,d)}}),La=(a.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var a=["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",m:Ka.translate,mm:Ka.translate,h:Ka.translate,hh:Ka.translate,d:"dan",dd:Ka.translate,M:"mjesec",MM:Ka.translate,y:"godinu",yy:Ka.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),a.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"после %s",past:"пред %s",s:"неколку секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеци",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),a.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(a,b){return 12===a&&(a=0),"രാത്രി"===b&&a>=4||"ഉച്ച കഴിഞ്ഞ്"===b||"വൈകുന്നേരം"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"രാത്രി":12>a?"രാവിലെ":17>a?"ഉച്ച കഴിഞ്ഞ്":20>a?"വൈകുന്നേരം":"രാത്രി"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Ma={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Na=(a.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:J,m:J,mm:J,h:J,hh:J,d:J,dd:J,M:J,MM:J,y:J,yy:J},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Ma[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return La[a]})},meridiemParse:/रात्री|सकाळी|दुपारी|सायंकाळी/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात्री"===b?4>a?a:a+12:"सकाळी"===b?a:"दुपारी"===b?a>=10?a:a+12:"सायंकाळी"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात्री":10>a?"सकाळी":17>a?"दुपारी":20>a?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}}),a.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}}),a.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}}),{1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"}),Oa={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"},Pa=(a.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(a){return a.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,function(a){return Oa[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Na[a]})},week:{dow:1,doy:4}}),a.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Qa={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Ra=(a.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Qa[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Pa[a]})},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(a,b){return 12===a&&(a=0),"राति"===b?4>a?a:a+12:"बिहान"===b?a:"दिउँसो"===b?a>=10?a:a+12:"साँझ"===b?a+12:void 0},meridiem:function(a,b,c){return 3>a?"राति":12>a?"बिहान":16>a?"दिउँसो":20>a?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}}),"jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_")),Sa="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),Ta=(a.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?Sa[a.month()]:Ra[a.month()]},monthsParseExact:!0,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),a.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"sun_mån_tys_ons_tor_fre_lau".split("_"),weekdaysMin:"su_må_ty_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"}),Ua={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"},Va=(a.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(a){return a.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,function(a){return Ua[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Ta[a]})},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(a,b){return 12===a&&(a=0),"ਰਾਤ"===b?4>a?a:a+12:"ਸਵੇਰ"===b?a:"ਦੁਪਹਿਰ"===b?a>=10?a:a+12:"ਸ਼ਾਮ"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"ਰਾਤ":10>a?"ਸਵੇਰ":17>a?"ਦੁਪਹਿਰ":20>a?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}}),"styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_")),Wa="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),Xa=(a.defineLocale("pl",{months:function(a,b){return""===b?"("+Wa[a.month()]+"|"+Va[a.month()]+")":/D MMMM/.test(b)?Wa[a.month()]:Va[a.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"nie_pon_wt_śr_czw_pt_sb".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:L,mm:L,h:L,hh:L,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:L,y:"rok",yy:L},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("pt-br",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº"}),a.defineLocale("pt",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),a.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",m:"un minut",mm:M,h:"o oră",hh:M,d:"o zi",dd:M,M:"o lună",MM:M,y:"un an",yy:M},week:{dow:1,doy:7}}),[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i]),Ya=(a.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:Xa,longMonthsParse:Xa,shortMonthsParse:Xa,monthsRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i,monthsShortRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i,monthsStrictRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i,monthsShortStrictRegex:/^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";switch(this.day()){case 0:return"[В следующее] dddd [в] LT";case 1:case 2:case 4:return"[В следующий] dddd [в] LT";case 3:case 5:case 6:return"[В следующую] dddd [в] LT"}},lastWeek:function(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:O,mm:O,h:"час",hh:O,d:"день",dd:O,M:"месяц",MM:O,y:"год",yy:O},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(a){return/^(дня|вечера)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночи":12>a?"утра":17>a?"дня":"вечера"},ordinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-й";case"D":return a+"-го";case"w":case"W":return a+"-я";default:return a}},week:{dow:1,doy:7}}),a.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},ordinalParse:/\d{1,2} වැනි/,ordinal:function(a){return a+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(a){return"ප.ව."===a||"පස් වරු"===a},meridiem:function(a,b,c){return a>11?c?"ප.ව.":"පස් වරු":c?"පෙ.ව.":"පෙර වරු"}}),"január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_")),Za="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_"),$a=(a.defineLocale("sk",{months:Ya,monthsShort:Za,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:Q,m:Q,mm:Q,h:Q,hh:Q,d:Q,dd:Q,M:Q,MM:Q,y:Q,yy:Q},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:R,m:R,mm:R,h:R,hh:R,d:R,dd:R,M:R,MM:R,y:R,yy:R},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),a.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"), -monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(a){return"M"===a.charAt(0)},meridiem:function(a,b,c){return 12>a?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=$a.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+$a.correctGrammaticalCase(a,d)}}),_a=(a.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){var a=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",m:$a.translate,mm:$a.translate,h:$a.translate,hh:$a.translate,d:"дан",dd:$a.translate,M:"месец",MM:$a.translate,y:"годину",yy:$a.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{words:{m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=_a.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+_a.correctGrammaticalCase(a,d)}}),ab=(a.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var a=["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:_a.translate,mm:_a.translate,h:_a.translate,hh:_a.translate,d:"dan",dd:_a.translate,M:"mesec",MM:_a.translate,y:"godinu",yy:_a.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),a.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(a,b,c){return 11>a?"ekuseni":15>a?"emini":19>a?"entsambama":"ebusuku"},meridiemHour:function(a,b){return 12===a&&(a=0),"ekuseni"===b?a:"emini"===b?a>=11?a:a+12:"entsambama"===b||"ebusuku"===b?0===a?0:a+12:void 0},ordinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}}),a.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinalParse:/\d{1,2}(e|a)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":"e";return a+c},week:{dow:1,doy:4}}),a.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"masiku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}}),{1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"}),bb={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"},cb=(a.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},ordinalParse:/\d{1,2}வது/,ordinal:function(a){return a+"வது"},preparse:function(a){return a.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,function(a){return bb[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return ab[a]})},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(a,b,c){return 2>a?" யாமம்":6>a?" வைகறை":10>a?" காலை":14>a?" நண்பகல்":18>a?" எற்பாடு":22>a?" மாலை":" யாமம்"},meridiemHour:function(a,b){return 12===a&&(a=0),"யாமம்"===b?2>a?a:a+12:"வைகறை"===b||"காலை"===b?a:"நண்பகல்"===b&&a>=10?a:a+12},week:{dow:0,doy:6}}),a.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},ordinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(a,b){return 12===a&&(a=0),"రాత్రి"===b?4>a?a:a+12:"ఉదయం"===b?a:"మధ్యాహ్నం"===b?a>=10?a:a+12:"సాయంత్రం"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"రాత్రి":10>a?"ఉదయం":17>a?"మధ్యాహ్నం":20>a?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}}),a.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H นาฬิกา m นาที",LTS:"H นาฬิกา m นาที s วินาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H นาฬิกา m นาที",LLLL:"วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(a){return"หลังเที่ยง"===a},meridiem:function(a,b,c){return 12>a?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}}),a.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),"pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_")),db=(a.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:S,past:T,s:"puS lup",m:"wa’ tup",mm:U,h:"wa’ rep",hh:U,d:"wa’ jaj",dd:U,M:"wa’ jar",MM:U,y:"wa’ DIS",yy:U},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"});a.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinalParse:/\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,ordinal:function(a){if(0===a)return a+"'ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(db[b]||db[c]||db[d])},week:{dow:1,doy:7}}),a.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(a){return"d'o"===a.toLowerCase()},meridiem:function(a,b,c){return a>11?c?"d'o":"D'O":c?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:W,m:W,mm:W,h:W,hh:W,d:W,dd:W,M:W,MM:W,y:W,yy:W},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),a.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}}),a.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}}),a.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:Z,weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:$("[Сьогодні "),nextDay:$("[Завтра "),lastDay:$("[Вчора "),nextWeek:$("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return $("[Минулої] dddd [").call(this);case 1:case 2:case 4:return $("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:Y,mm:Y,h:"годину",hh:Y,d:"день",dd:Y,M:"місяць",MM:Y,y:"рік",yy:Y},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(a){return/^(дня|вечора)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночі":12>a?"ранку":17>a?"дня":"вечора"},ordinalParse:/\d{1,2}-(й|го)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-й";case"D":return a+"-го";default:return a}},week:{dow:1,doy:7}}),a.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}}),a.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(a){return/^ch$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"sa":"SA":c?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần rồi lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),a.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),a.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah点mm分",LTS:"Ah点m分s秒",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah点mm分",LLLL:"YYYY年MMMD日ddddAh点mm分",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah点mm分",llll:"YYYY年MMMD日ddddAh点mm分"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(a,b){return 12===a&&(a=0),"凌晨"===b||"早上"===b||"上午"===b?a:"下午"===b||"晚上"===b?a+12:a>=11?a:a+12},meridiem:function(a,b,c){var d=100*a+b;return 600>d?"凌晨":900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var b,c;return b=a().startOf("week"),c=this.diff(b,"days")>=7?"[下]":"[本]",0===this.minutes()?c+"dddAh点整":c+"dddAh点mm"},lastWeek:function(){var b,c;return b=a().startOf("week"),c=this.unix()=11?a:a+12:"下午"===b||"晚上"===b?a+12:void 0},meridiem:function(a,b,c){var d=100*a+b;return 900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinalParse:/\d{1,2}(日|月|週)/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"週";default:return a}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"1分鐘",mm:"%d分鐘",h:"1小時",hh:"%d小時",d:"1天",dd:"%d天",M:"1個月",MM:"%d個月",y:"1年",yy:"%d年"}});a.locale("en")}); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.js deleted file mode 100644 index b8f0313f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.js +++ /dev/null @@ -1,12051 +0,0 @@ -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, function () { 'use strict'; - - var hookCallback; - - function utils_hooks__hooks () { - return hookCallback.apply(null, arguments); - } - - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback (callback) { - hookCallback = callback; - } - - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } - - function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; - } - - function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - return res; - } - - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - function create_utc__createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } - - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso : false, - parsedDateParts : [], - meridiem : null - }; - } - - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; - } - - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; - - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; - } - - function valid__isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }); - m._isValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); - - if (m._strict) { - m._isValid = m._isValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - } - return m._isValid; - } - - function valid__createInvalid (flags) { - var m = create_utc__createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } - - return m; - } - - function isUndefined(input) { - return input === void 0; - } - - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = utils_hooks__hooks.momentProperties = []; - - function copyConfig(to, from) { - var i, prop, val; - - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; - } - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - if (!isUndefined(from._offset)) { - to._offset = from._offset; - } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); - } - if (!isUndefined(from._locale)) { - to._locale = from._locale; - } - - if (momentProperties.length > 0) { - for (i in momentProperties) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; - } - - var updateInProgress = false; - - // Moment prototype object - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - utils_hooks__hooks.updateOffset(this); - updateInProgress = false; - } - } - - function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); - } - - function absFloor (number) { - if (number < 0) { - return Math.ceil(number); - } else { - return Math.floor(number); - } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } - - return value; - } - - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; - } - } - return diffs + lengthDiff; - } - - function warn(msg) { - if (utils_hooks__hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - - return extend(function () { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(null, msg); - } - if (firstTime) { - warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } - - var deprecations = {}; - - function deprecateSimple(name, msg) { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - utils_hooks__hooks.suppressDeprecationWarnings = false; - utils_hooks__hooks.deprecationHandler = null; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - function isObject(input) { - return Object.prototype.toString.call(input) === '[object Object]'; - } - - function locale_set__set (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _ordinalParseLenient. - this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); - } - - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - return res; - } - - function Locale(config) { - if (config != null) { - this.set(config); - } - } - - var keys; - - if (Object.keys) { - keys = Object.keys; - } else { - keys = function (obj) { - var i, res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; - } - - // internal storage for locale config files - var locales = {}; - var globalLocale; - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; - } - - function loadLocale(name) { - var oldLocale = null; - // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && (typeof module !== 'undefined') && - module && module.exports) { - try { - oldLocale = globalLocale._abbr; - require('./locale/' + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - locale_locales__getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; - } - - // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - function locale_locales__getSetGlobalLocale (key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = locale_locales__getLocale(key); - } - else { - data = defineLocale(key, values); - } - - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } - - return globalLocale._abbr; - } - - function defineLocale (name, config) { - if (config !== null) { - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale'); - config = mergeConfigs(locales[name]._config, config); - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - config = mergeConfigs(locales[config.parentLocale]._config, config); - } else { - // treat as if there is no base config - deprecateSimple('parentLocaleUndefined', - 'specified parentLocale is not defined yet'); - } - } - locales[name] = new Locale(config); - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } - - function updateLocale(name, config) { - if (config != null) { - var locale; - if (locales[name] != null) { - config = mergeConfigs(locales[name]._config, config); - } - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } - } - } - return locales[name]; - } - - // returns locale data - function locale_locales__getLocale (key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } - - return chooseLocale(key); - } - - function locale_locales__listLocales() { - return keys(locales); - } - - var aliases = {}; - - function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } - - function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; - } - - function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - get_set__set(this, unit, value); - utils_hooks__hooks.updateOffset(this, keepTime); - return this; - } else { - return get_set__get(this, unit); - } - }; - } - - function get_set__get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; - } - - function get_set__set (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } - } - - // MOMENTS - - function getSet (units, value) { - var unit; - if (typeof units === 'object') { - for (unit in units) { - this.set(unit, units[unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; - } - - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; - } - - var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; - - var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - - var formatFunctions = {}; - - var formatTokenFunctions = {}; - - // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - function addFormatToken (token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; - } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; - } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; - } - } - - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); - } - - function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; - - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } - - return function (mom) { - var output = '', i; - for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; - } - return output; - }; - } - - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } - - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - - return formatFunctions[format](m); - } - - function expandFormat(format, locale) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; - } - - var match1 = /\d/; // 0 - 9 - var match2 = /\d\d/; // 00 - 99 - var match3 = /\d{3}/; // 000 - 999 - var match4 = /\d{4}/; // 0000 - 9999 - var match6 = /[+-]?\d{6}/; // -999999 - 999999 - var match1to2 = /\d\d?/; // 0 - 99 - var match3to4 = /\d\d\d\d?/; // 999 - 9999 - var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 - var match1to3 = /\d{1,3}/; // 0 - 999 - var match1to4 = /\d{1,4}/; // 0 - 9999 - var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - - var matchUnsigned = /\d+/; // 0 - inf - var matchSigned = /[+-]?\d+/; // -inf - inf - - var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z - var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - - var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 - - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months - var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; - - - var regexes = {}; - - function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; - } - - function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } - - return regexes[token](config._strict, config._locale); - } - - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); - } - - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } - - var tokens = {}; - - function addParseToken (token, callback) { - var i, func = callback; - if (typeof token === 'string') { - token = [token]; - } - if (typeof callback === 'number') { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } - } - - function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } - - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } - - var YEAR = 0; - var MONTH = 1; - var DATE = 2; - var HOUR = 3; - var MINUTE = 4; - var SECOND = 5; - var MILLISECOND = 6; - var WEEK = 7; - var WEEKDAY = 8; - - var indexOf; - - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } - - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); - } - - // FORMATTING - - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); - - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); - - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); - - // ALIASES - - addUnitAlias('month', 'M'); - - // PARSING - - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); - - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; - }); - - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); - - // LOCALES - - var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; - var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); - function localeMonths (m, format) { - return isArray(this._months) ? this._months[m.month()] : - this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); - function localeMonthsShort (m, format) { - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : - this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - function units_month__handleStrictParse(monthName, format, strict) { - var i, ii, mom, llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = create_utc__createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return units_month__handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } - - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } - } - - // MOMENTS - - function setMonth (mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (typeof value !== 'number') { - return mom; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } - - function getSetMonth (value) { - if (value != null) { - setMonth(this, value); - utils_hooks__hooks.updateOffset(this, true); - return this; - } else { - return get_set__get(this, 'Month'); - } - } - - function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); - } - - var defaultMonthsShortRegex = matchWord; - function monthsShortRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - return this._monthsShortStrictRegex && isStrict ? - this._monthsShortStrictRegex : this._monthsShortRegex; - } - } - - var defaultMonthsRegex = matchWord; - function monthsRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - return this._monthsStrictRegex && isStrict ? - this._monthsStrictRegex : this._monthsRegex; - } - } - - function computeMonthsParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var shortPieces = [], longPieces = [], mixedPieces = [], - i, mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - } - - function checkOverflow (m) { - var overflow; - var a = m._a; - - if (a && getParsingFlags(m).overflow === -2) { - overflow = - a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : - a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : - a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : - a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : - a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : - a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : - -1; - - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } - - getParsingFlags(m).overflow = overflow; - } - - return m; - } - - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - - var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; - - var isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/] - ]; - - // iso time formats and regexes - var isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/] - ]; - - var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; - - // date from iso format - function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; - - if (match) { - getParsingFlags(config).iso = true; - - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - if (dateFormat == null) { - config._isValid = false; - return; - } - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - if (timeFormat == null) { - config._isValid = false; - return; - } - } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } - } - - // date from iso format or fallback - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - utils_hooks__hooks.createFromInputFallback(config); - } - } - - utils_hooks__hooks.createFromInputFallback = deprecate( - 'moment construction falls back to js Date. This is ' + - 'discouraged and will be removed in upcoming major ' + - 'release. Please refer to ' + - 'https://github.com/moment/moment/issues/1407 for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } - ); - - function createDate (y, m, d, h, M, s, ms) { - //can't just apply() to create a date: - //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var date = new Date(y, m, d, h, M, s, ms); - - //the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - return date; - } - - function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - - //the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; - } - - // FORMATTING - - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; - }); - - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); - - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - - // ALIASES - - addUnitAlias('year', 'y'); - - // PARSING - - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); - - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); - }); - - // HELPERS - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } - - // HOOKS - - utils_hooks__hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; - - // MOMENTS - - var getSetYear = makeGetSet('FullYear', true); - - function getIsLeapYear () { - return isLeapYear(this.year()); - } - - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - - return -fwdlw + fwd - 1; - } - - //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, resDayOfYear; - - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } - - return { - year: resYear, - dayOfYear: resDayOfYear - }; - } - - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, resYear; - - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } - - return { - week: resWeek, - year: resYear - }; - } - - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(utils_hooks__hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } - - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; - - if (config._d) { - return; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //if the day of the year is set, figure out what it is - if (config._dayOfYear) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse)) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } - } - - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - - weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); - week = defaults(w.w, 1); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } - } - - // constant that refers to the ISO standard - utils_hooks__hooks.ISO_8601 = function () {}; - - // date from string and format string - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === utils_hooks__hooks.ISO_8601) { - configFromISO(config); - return; - } - - config._a = []; - getParsingFlags(config).empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } - else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } - - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } - - // clear _12h flag if hour is <= 12 - if (getParsingFlags(config).bigHour === true && - config._a[HOUR] <= 12 && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } - - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - - configFromArray(config); - checkOverflow(config); - } - - - function meridiemFixWrap (locale, hour, meridiem) { - var isPm; - - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } - } - - // date from string and array of format strings - function configFromStringAndArray(config) { - var tempConfig, - bestMoment, - - scoreToBeat, - i, - currentScore; - - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - - if (!valid__isValid(tempConfig)) { - continue; - } - - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; - - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - - getParsingFlags(tempConfig).score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - - extend(config, bestMoment || tempConfig); - } - - function configFromObject(config) { - if (config._d) { - return; - } - - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - - configFromArray(config); - } - - function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; - } - - function prepareConfig (config) { - var input = config._i, - format = config._f; - - config._locale = config._locale || locale_locales__getLocale(config._l); - - if (input === null || (format === undefined && input === '')) { - return valid__createInvalid({nullInput: true}); - } - - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } - - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else if (isDate(input)) { - config._d = input; - } else { - configFromInput(config); - } - - if (!valid__isValid(config)) { - config._d = null; - } - - return config; - } - - function configFromInput(config) { - var input = config._i; - if (input === undefined) { - config._d = new Date(utils_hooks__hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (typeof(input) === 'object') { - configFromObject(config); - } else if (typeof(input) === 'number') { - // from milliseconds - config._d = new Date(input); - } else { - utils_hooks__hooks.createFromInputFallback(config); - } - } - - function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - - if (typeof(locale) === 'boolean') { - strict = locale; - locale = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - - return createFromConfig(c); - } - - function local__createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } - - var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - var prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return local__createLocal(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - return res; - } - - // TODO: Use [].sort instead? - function min () { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); - } - - function max () { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); - } - - var now = function () { - return Date.now ? Date.now() : +(new Date()); - }; - - function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - - this._data = {}; - - this._locale = locale_locales__getLocale(); - - this._bubble(); - } - - function isDuration (obj) { - return obj instanceof Duration; - } - - // FORMATTING - - function offset (token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); - }); - } - - offset('Z', ':'); - offset('ZZ', ''); - - // PARSING - - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); - - // HELPERS - - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; - - function offsetFromString(matcher, string) { - var matches = ((string || '').match(matcher) || []); - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); - - return parts[0] === '+' ? minutes : -minutes; - } - - // Return a moment from input, that is local/utc/zone equivalent to model. - function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - utils_hooks__hooks.updateOffset(res, false); - return res; - } else { - return local__createLocal(input).local(); - } - } - - function getDateOffset (m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; - } - - // HOOKS - - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - utils_hooks__hooks.updateOffset = function () {}; - - // MOMENTS - - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - function getSetOffset (input, keepLocalTime) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - } else if (Math.abs(input) < 16) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - utils_hooks__hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } - - function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } - } - - function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } - - function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; - - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; - } - - function setOffsetToParsedOffset () { - if (this._tzm) { - this.utcOffset(this._tzm); - } else if (typeof this._i === 'string') { - this.utcOffset(offsetFromString(matchOffset, this._i)); - } - return this; - } - - function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? local__createLocal(input).utcOffset() : 0; - - return (this.utcOffset() - input) % 60 === 0; - } - - function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); - } - - function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}; - - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; - } - - function isLocal () { - return this.isValid() ? !this._isUTC : false; - } - - function isUtcOffset () { - return this.isValid() ? this._isUTC : false; - } - - function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } - - // ASP.NET json date format regex - var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; - - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; - - function create__createDuration (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; - - if (isDuration(input)) { - duration = { - ms : input._milliseconds, - d : input._days, - M : input._months - }; - } else if (typeof input === 'number') { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : 0, - d : toInt(match[DATE]) * sign, - h : toInt(match[HOUR]) * sign, - m : toInt(match[MINUTE]) * sign, - s : toInt(match[SECOND]) * sign, - ms : toInt(match[MILLISECOND]) * sign - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : parseIso(match[2], sign), - M : parseIso(match[3], sign), - w : parseIso(match[4], sign), - d : parseIso(match[5], sign), - h : parseIso(match[6], sign), - m : parseIso(match[7], sign), - s : parseIso(match[8], sign) - }; - } else if (duration == null) {// checks for null or undefined - duration = {}; - } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); - - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } - - ret = new Duration(duration); - - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } - - return ret; - } - - create__createDuration.fn = Duration.prototype; - - function parseIso (inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - } - - function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; - - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } - - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); - - return res; - } - - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } - - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - - return res; - } - - function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } - - // TODO: remove 'name' arg after deprecation is removed - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); - tmp = val; val = period; period = tmp; - } - - val = typeof val === 'string' ? +val : val; - dur = create__createDuration(val, period); - add_subtract__addSubtract(this, dur, direction); - return this; - }; - } - - function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - updateOffset = updateOffset == null ? true : updateOffset; - - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - utils_hooks__hooks.updateOffset(mom, days || months); - } - } - - var add_subtract__add = createAdder(1, 'add'); - var add_subtract__subtract = createAdder(-1, 'subtract'); - - function moment_calendar__calendar (time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || local__createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - diff = this.diff(sod, 'days', true), - format = diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - - var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]); - - return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); - } - - function clone () { - return new Moment(this); - } - - function isAfter (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - - function isBefore (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } - - function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); - } - - function isSame (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units || 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } - } - - function isSameOrAfter (input, units) { - return this.isSame(input, units) || this.isAfter(input,units); - } - - function isSameOrBefore (input, units) { - return this.isSame(input, units) || this.isBefore(input,units); - } - - function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); - - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - return asFloat ? output : absFloor(output); - } - - function monthDiff (a, b) { - // difference in months - var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); - } - - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; - } - - utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString () { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } - - function moment_format__toISOString () { - var m = this.clone().utc(); - if (0 < m.year() && m.year() <= 9999) { - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } else { - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } else { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } - - function moment_format__format (inputString) { - if (!inputString) { - inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat; - } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } - - function from (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function fromNow (withoutSuffix) { - return this.from(local__createLocal(), withoutSuffix); - } - - function to (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function toNow (withoutSuffix) { - return this.to(local__createLocal(), withoutSuffix); - } - - // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - function locale (key) { - var newLocaleData; - - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = locale_locales__getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } - } - - var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } - ); - - function localeData () { - return this._locale; - } - - function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; - } - - function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } - - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; - } - - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); - } - - function to_type__valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); - } - - function unix () { - return Math.floor(this.valueOf() / 1000); - } - - function toDate () { - return this._offset ? new Date(this.valueOf()) : this._d; - } - - function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; - } - - function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; - } - - function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } - - function moment_valid__isValid () { - return valid__isValid(this); - } - - function parsingFlags () { - return extend({}, getParsingFlags(this)); - } - - function invalidAt () { - return getParsingFlags(this).overflow; - } - - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; - } - - // FORMATTING - - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); - - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); - - function addWeekYearFormatToken (token, getter) { - addFormatToken(0, [token, token.length], 0, getter); - } - - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - - // ALIASES - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); - - // PARSING - - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); - - addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); - }); - - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - - // MOMENTS - - function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); - } - - function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); - } - - function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); - } - - function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } - - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } - } - - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; - } - - // FORMATTING - - addFormatToken('Q', 0, 'Qo', 'quarter'); - - // ALIASES - - addUnitAlias('quarter', 'Q'); - - // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); - - // MOMENTS - - function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - } - - // FORMATTING - - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - - // ALIASES - - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); - - // PARSING - - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); - - addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - }); - - // HELPERS - - // LOCALES - - function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } - - var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - }; - - function localeFirstDayOfWeek () { - return this._week.dow; - } - - function localeFirstDayOfYear () { - return this._week.doy; - } - - // MOMENTS - - function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - // FORMATTING - - addFormatToken('D', ['DD', 2], 'Do', 'date'); - - // ALIASES - - addUnitAlias('date', 'D'); - - // PARSING - - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; - }); - - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); - }); - - // MOMENTS - - var getSetDayOfMonth = makeGetSet('Date', true); - - // FORMATTING - - addFormatToken('d', 0, 'do', 'day'); - - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); - - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); - - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); - - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); - - // ALIASES - - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); - - // PARSING - - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); - - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } - }); - - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); - - // HELPERS - - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } - - return null; - } - - // LOCALES - - var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); - function localeWeekdays (m, format) { - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; - } - - var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); - function localeWeekdaysShort (m) { - return this._weekdaysShort[m.day()]; - } - - var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); - function localeWeekdaysMin (m) { - return this._weekdaysMin[m.day()]; - } - - function day_of_week__handleStrictParse(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; - - for (i = 0; i < 7; ++i) { - mom = create_utc__createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return day_of_week__handleStrictParse.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - - mom = create_utc__createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); - } - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - } - - // MOMENTS - - function getSetDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } - - function getSetLocaleDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } - - function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); - } - - var defaultWeekdaysRegex = matchWord; - function weekdaysRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - return this._weekdaysStrictRegex && isStrict ? - this._weekdaysStrictRegex : this._weekdaysRegex; - } - } - - var defaultWeekdaysShortRegex = matchWord; - function weekdaysShortRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - return this._weekdaysShortStrictRegex && isStrict ? - this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } - } - - var defaultWeekdaysMinRegex = matchWord; - function weekdaysMinRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - return this._weekdaysMinStrictRegex && isStrict ? - this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } - } - - - function computeWeekdaysParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], - i, mom, minp, shortp, longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); - } - - // FORMATTING - - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - - // ALIASES - - addUnitAlias('dayOfYear', 'DDD'); - - // PARSING - - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); - - // HELPERS - - // MOMENTS - - function getSetDayOfYear (input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); - } - - // FORMATTING - - function hFormat() { - return this.hours() % 12 || 12; - } - - function kFormat() { - return this.hours() || 24; - } - - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); - - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); - - addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); - - addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); - } - - meridiem('a', true); - meridiem('A', false); - - // ALIASES - - addUnitAlias('hour', 'h'); - - // PARSING - - function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; - } - - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); - - addParseToken(['H', 'HH'], HOUR); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); - - // LOCALES - - function localeIsPM (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); - } - - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; - function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - } - - - // MOMENTS - - // Setting the hour should keep the time, because the user explicitly - // specified which hour he wants. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - var getSetHour = makeGetSet('Hours', true); - - // FORMATTING - - addFormatToken('m', ['mm', 2], 0, 'minute'); - - // ALIASES - - addUnitAlias('minute', 'm'); - - // PARSING - - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); - - // MOMENTS - - var getSetMinute = makeGetSet('Minutes', false); - - // FORMATTING - - addFormatToken('s', ['ss', 2], 0, 'second'); - - // ALIASES - - addUnitAlias('second', 's'); - - // PARSING - - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); - - // MOMENTS - - var getSetSecond = makeGetSet('Seconds', false); - - // FORMATTING - - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); - - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); - - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); - - - // ALIASES - - addUnitAlias('millisecond', 'ms'); - - // PARSING - - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); - - var token; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } - - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } - - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } - // MOMENTS - - var getSetMillisecond = makeGetSet('Milliseconds', false); - - // FORMATTING - - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); - - // MOMENTS - - function getZoneAbbr () { - return this._isUTC ? 'UTC' : ''; - } - - function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } - - var momentPrototype__proto = Moment.prototype; - - momentPrototype__proto.add = add_subtract__add; - momentPrototype__proto.calendar = moment_calendar__calendar; - momentPrototype__proto.clone = clone; - momentPrototype__proto.diff = diff; - momentPrototype__proto.endOf = endOf; - momentPrototype__proto.format = moment_format__format; - momentPrototype__proto.from = from; - momentPrototype__proto.fromNow = fromNow; - momentPrototype__proto.to = to; - momentPrototype__proto.toNow = toNow; - momentPrototype__proto.get = getSet; - momentPrototype__proto.invalidAt = invalidAt; - momentPrototype__proto.isAfter = isAfter; - momentPrototype__proto.isBefore = isBefore; - momentPrototype__proto.isBetween = isBetween; - momentPrototype__proto.isSame = isSame; - momentPrototype__proto.isSameOrAfter = isSameOrAfter; - momentPrototype__proto.isSameOrBefore = isSameOrBefore; - momentPrototype__proto.isValid = moment_valid__isValid; - momentPrototype__proto.lang = lang; - momentPrototype__proto.locale = locale; - momentPrototype__proto.localeData = localeData; - momentPrototype__proto.max = prototypeMax; - momentPrototype__proto.min = prototypeMin; - momentPrototype__proto.parsingFlags = parsingFlags; - momentPrototype__proto.set = getSet; - momentPrototype__proto.startOf = startOf; - momentPrototype__proto.subtract = add_subtract__subtract; - momentPrototype__proto.toArray = toArray; - momentPrototype__proto.toObject = toObject; - momentPrototype__proto.toDate = toDate; - momentPrototype__proto.toISOString = moment_format__toISOString; - momentPrototype__proto.toJSON = toJSON; - momentPrototype__proto.toString = toString; - momentPrototype__proto.unix = unix; - momentPrototype__proto.valueOf = to_type__valueOf; - momentPrototype__proto.creationData = creationData; - - // Year - momentPrototype__proto.year = getSetYear; - momentPrototype__proto.isLeapYear = getIsLeapYear; - - // Week Year - momentPrototype__proto.weekYear = getSetWeekYear; - momentPrototype__proto.isoWeekYear = getSetISOWeekYear; - - // Quarter - momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; - - // Month - momentPrototype__proto.month = getSetMonth; - momentPrototype__proto.daysInMonth = getDaysInMonth; - - // Week - momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; - momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; - momentPrototype__proto.weeksInYear = getWeeksInYear; - momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; - - // Day - momentPrototype__proto.date = getSetDayOfMonth; - momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; - momentPrototype__proto.weekday = getSetLocaleDayOfWeek; - momentPrototype__proto.isoWeekday = getSetISODayOfWeek; - momentPrototype__proto.dayOfYear = getSetDayOfYear; - - // Hour - momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; - - // Minute - momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; - - // Second - momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; - - // Millisecond - momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; - - // Offset - momentPrototype__proto.utcOffset = getSetOffset; - momentPrototype__proto.utc = setOffsetToUTC; - momentPrototype__proto.local = setOffsetToLocal; - momentPrototype__proto.parseZone = setOffsetToParsedOffset; - momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; - momentPrototype__proto.isDST = isDaylightSavingTime; - momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted; - momentPrototype__proto.isLocal = isLocal; - momentPrototype__proto.isUtcOffset = isUtcOffset; - momentPrototype__proto.isUtc = isUtc; - momentPrototype__proto.isUTC = isUtc; - - // Timezone - momentPrototype__proto.zoneAbbr = getZoneAbbr; - momentPrototype__proto.zoneName = getZoneName; - - // Deprecations - momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); - momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); - momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); - momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone); - - var momentPrototype = momentPrototype__proto; - - function moment_moment__createUnix (input) { - return local__createLocal(input * 1000); - } - - function moment_moment__createInZone () { - return local__createLocal.apply(null, arguments).parseZone(); - } - - var defaultCalendar = { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }; - - function locale_calendar__calendar (key, mom, now) { - var output = this._calendar[key]; - return isFunction(output) ? output.call(mom, now) : output; - } - - var defaultLongDateFormat = { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }; - - function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - - return this._longDateFormat[key]; - } - - var defaultInvalidDate = 'Invalid date'; - - function invalidDate () { - return this._invalidDate; - } - - var defaultOrdinal = '%d'; - var defaultOrdinalParse = /\d{1,2}/; - - function ordinal (number) { - return this._ordinal.replace('%d', number); - } - - function preParsePostFormat (string) { - return string; - } - - var defaultRelativeTime = { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }; - - function relative__relativeTime (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (isFunction(output)) ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); - } - - function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - - var prototype__proto = Locale.prototype; - - prototype__proto._calendar = defaultCalendar; - prototype__proto.calendar = locale_calendar__calendar; - prototype__proto._longDateFormat = defaultLongDateFormat; - prototype__proto.longDateFormat = longDateFormat; - prototype__proto._invalidDate = defaultInvalidDate; - prototype__proto.invalidDate = invalidDate; - prototype__proto._ordinal = defaultOrdinal; - prototype__proto.ordinal = ordinal; - prototype__proto._ordinalParse = defaultOrdinalParse; - prototype__proto.preparse = preParsePostFormat; - prototype__proto.postformat = preParsePostFormat; - prototype__proto._relativeTime = defaultRelativeTime; - prototype__proto.relativeTime = relative__relativeTime; - prototype__proto.pastFuture = pastFuture; - prototype__proto.set = locale_set__set; - - // Month - prototype__proto.months = localeMonths; - prototype__proto._months = defaultLocaleMonths; - prototype__proto.monthsShort = localeMonthsShort; - prototype__proto._monthsShort = defaultLocaleMonthsShort; - prototype__proto.monthsParse = localeMonthsParse; - prototype__proto._monthsRegex = defaultMonthsRegex; - prototype__proto.monthsRegex = monthsRegex; - prototype__proto._monthsShortRegex = defaultMonthsShortRegex; - prototype__proto.monthsShortRegex = monthsShortRegex; - - // Week - prototype__proto.week = localeWeek; - prototype__proto._week = defaultLocaleWeek; - prototype__proto.firstDayOfYear = localeFirstDayOfYear; - prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; - - // Day of Week - prototype__proto.weekdays = localeWeekdays; - prototype__proto._weekdays = defaultLocaleWeekdays; - prototype__proto.weekdaysMin = localeWeekdaysMin; - prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin; - prototype__proto.weekdaysShort = localeWeekdaysShort; - prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort; - prototype__proto.weekdaysParse = localeWeekdaysParse; - - prototype__proto._weekdaysRegex = defaultWeekdaysRegex; - prototype__proto.weekdaysRegex = weekdaysRegex; - prototype__proto._weekdaysShortRegex = defaultWeekdaysShortRegex; - prototype__proto.weekdaysShortRegex = weekdaysShortRegex; - prototype__proto._weekdaysMinRegex = defaultWeekdaysMinRegex; - prototype__proto.weekdaysMinRegex = weekdaysMinRegex; - - // Hours - prototype__proto.isPM = localeIsPM; - prototype__proto._meridiemParse = defaultLocaleMeridiemParse; - prototype__proto.meridiem = localeMeridiem; - - function lists__get (format, index, field, setter) { - var locale = locale_locales__getLocale(); - var utc = create_utc__createUTC().set(setter, index); - return locale[field](utc, format); - } - - function listMonthsImpl (format, index, field) { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return lists__get(format, index, field, 'month'); - } - - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = lists__get(format, i, field, 'month'); - } - return out; - } - - // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - function listWeekdaysImpl (localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } - - var locale = locale_locales__getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return lists__get(format, (index + shift) % 7, field, 'day'); - } - - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = lists__get(format, (i + shift) % 7, field, 'day'); - } - return out; - } - - function lists__listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); - } - - function lists__listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } - - function lists__listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } - - function lists__listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - - function lists__listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } - - locale_locales__getSetGlobalLocale('en', { - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - // Side effect imports - utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); - utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); - - var mathAbs = Math.abs; - - function duration_abs__abs () { - var data = this._data; - - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); - - return this; - } - - function duration_add_subtract__addSubtract (duration, input, value, direction) { - var other = create__createDuration(input, value); - - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - - return duration._bubble(); - } - - // supports only 2.0-style add(1, 's') or add(duration) - function duration_add_subtract__add (input, value) { - return duration_add_subtract__addSubtract(this, input, value, 1); - } - - // supports only 2.0-style subtract(1, 's') or subtract(duration) - function duration_add_subtract__subtract (input, value) { - return duration_add_subtract__addSubtract(this, input, value, -1); - } - - function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } - - function bubble () { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } - - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; - - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - - hours = absFloor(minutes / 60); - data.hours = hours % 24; - - days += absFloor(hours / 24); - - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - data.days = days; - data.months = months; - data.years = years; - - return this; - } - - function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; - } - - function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; - } - - function as (units) { - var days; - var months; - var milliseconds = this._milliseconds; - - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } - } - - // TODO: Use this.as('ms')? - function duration_as__valueOf () { - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); - } - - function makeAs (alias) { - return function () { - return this.as(alias); - }; - } - - var asMilliseconds = makeAs('ms'); - var asSeconds = makeAs('s'); - var asMinutes = makeAs('m'); - var asHours = makeAs('h'); - var asDays = makeAs('d'); - var asWeeks = makeAs('w'); - var asMonths = makeAs('M'); - var asYears = makeAs('y'); - - function duration_get__get (units) { - units = normalizeUnits(units); - return this[units + 's'](); - } - - function makeGetter(name) { - return function () { - return this._data[name]; - }; - } - - var milliseconds = makeGetter('milliseconds'); - var seconds = makeGetter('seconds'); - var minutes = makeGetter('minutes'); - var hours = makeGetter('hours'); - var days = makeGetter('days'); - var duration_get__months = makeGetter('months'); - var years = makeGetter('years'); - - function weeks () { - return absFloor(this.days() / 7); - } - - var round = Math.round; - var thresholds = { - s: 45, // seconds to minute - m: 45, // minutes to hour - h: 22, // hours to day - d: 26, // days to month - M: 11 // months to year - }; - - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } - - function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { - var duration = create__createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - - var a = seconds < thresholds.s && ['s', seconds] || - minutes <= 1 && ['m'] || - minutes < thresholds.m && ['mm', minutes] || - hours <= 1 && ['h'] || - hours < thresholds.h && ['hh', hours] || - days <= 1 && ['d'] || - days < thresholds.d && ['dd', days] || - months <= 1 && ['M'] || - months < thresholds.M && ['MM', months] || - years <= 1 && ['y'] || ['yy', years]; - - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); - } - - // This function allows you to set a threshold for relative time strings - function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - return true; - } - - function humanize (withSuffix) { - var locale = this.localeData(); - var output = duration_humanize__relativeTime(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); - } - - var iso_string__abs = Math.abs; - - function iso_string__toISOString() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - var seconds = iso_string__abs(this._milliseconds) / 1000; - var days = iso_string__abs(this._days); - var months = iso_string__abs(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); - } - - var duration_prototype__proto = Duration.prototype; - - duration_prototype__proto.abs = duration_abs__abs; - duration_prototype__proto.add = duration_add_subtract__add; - duration_prototype__proto.subtract = duration_add_subtract__subtract; - duration_prototype__proto.as = as; - duration_prototype__proto.asMilliseconds = asMilliseconds; - duration_prototype__proto.asSeconds = asSeconds; - duration_prototype__proto.asMinutes = asMinutes; - duration_prototype__proto.asHours = asHours; - duration_prototype__proto.asDays = asDays; - duration_prototype__proto.asWeeks = asWeeks; - duration_prototype__proto.asMonths = asMonths; - duration_prototype__proto.asYears = asYears; - duration_prototype__proto.valueOf = duration_as__valueOf; - duration_prototype__proto._bubble = bubble; - duration_prototype__proto.get = duration_get__get; - duration_prototype__proto.milliseconds = milliseconds; - duration_prototype__proto.seconds = seconds; - duration_prototype__proto.minutes = minutes; - duration_prototype__proto.hours = hours; - duration_prototype__proto.days = days; - duration_prototype__proto.weeks = weeks; - duration_prototype__proto.months = duration_get__months; - duration_prototype__proto.years = years; - duration_prototype__proto.humanize = humanize; - duration_prototype__proto.toISOString = iso_string__toISOString; - duration_prototype__proto.toString = iso_string__toISOString; - duration_prototype__proto.toJSON = iso_string__toISOString; - duration_prototype__proto.locale = locale; - duration_prototype__proto.localeData = localeData; - - // Deprecations - duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); - duration_prototype__proto.lang = lang; - - // Side effect imports - - // FORMATTING - - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); - - // PARSING - - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); - - // Side effect imports - - ; - - //! moment.js - //! version : 2.13.0 - //! authors : Tim Wood, Iskren Chernev, Moment.js contributors - //! license : MIT - //! momentjs.com - - utils_hooks__hooks.version = '2.13.0'; - - setHookCallback(local__createLocal); - - utils_hooks__hooks.fn = momentPrototype; - utils_hooks__hooks.min = min; - utils_hooks__hooks.max = max; - utils_hooks__hooks.now = now; - utils_hooks__hooks.utc = create_utc__createUTC; - utils_hooks__hooks.unix = moment_moment__createUnix; - utils_hooks__hooks.months = lists__listMonths; - utils_hooks__hooks.isDate = isDate; - utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; - utils_hooks__hooks.invalid = valid__createInvalid; - utils_hooks__hooks.duration = create__createDuration; - utils_hooks__hooks.isMoment = isMoment; - utils_hooks__hooks.weekdays = lists__listWeekdays; - utils_hooks__hooks.parseZone = moment_moment__createInZone; - utils_hooks__hooks.localeData = locale_locales__getLocale; - utils_hooks__hooks.isDuration = isDuration; - utils_hooks__hooks.monthsShort = lists__listMonthsShort; - utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; - utils_hooks__hooks.defineLocale = defineLocale; - utils_hooks__hooks.updateLocale = updateLocale; - utils_hooks__hooks.locales = locale_locales__listLocales; - utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; - utils_hooks__hooks.normalizeUnits = normalizeUnits; - utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; - utils_hooks__hooks.prototype = momentPrototype; - - var moment__default = utils_hooks__hooks; - - //! moment.js locale configuration - //! locale : afrikaans (af) - //! author : Werner Mollentze : https://github.com/wernerm - - var af = moment__default.defineLocale('af', { - months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'), - weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), - weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), - meridiemParse: /vm|nm/i, - isPM : function (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? 'nm' : 'NM'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Vandag om] LT', - nextDay : '[Môre om] LT', - nextWeek : 'dddd [om] LT', - lastDay : '[Gister om] LT', - lastWeek : '[Laas] dddd [om] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'oor %s', - past : '%s gelede', - s : '\'n paar sekondes', - m : '\'n minuut', - mm : '%d minute', - h : '\'n uur', - hh : '%d ure', - d : '\'n dag', - dd : '%d dae', - M : '\'n maand', - MM : '%d maande', - y : '\'n jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter - }, - week : { - dow : 1, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. - } - }); - - //! moment.js locale configuration - //! locale : Moroccan Arabic (ar-ma) - //! author : ElFadili Yassine : https://github.com/ElFadiliY - //! author : Abdel Said : https://github.com/abdelsaid - - var ar_ma = moment__default.defineLocale('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Arabic Saudi Arabia (ar-sa) - //! author : Suhail Alkowaileet : https://github.com/xsoh - - var ar_sa__symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, ar_sa__numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }; - - var ar_sa = moment__default.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return ar_sa__numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ar_sa__symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Tunisian Arabic (ar-tn) - - var ar_tn = moment__default.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%d سنوات' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! Locale: Arabic (ar) - //! Author: Abdel Said: https://github.com/abdelsaid - //! Changes in months, weekdays: Ahmed Elkhatib - //! Native plural forms: forabi https://github.com/forabi - - var ar__symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' - }, ar__numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' - }, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; - }, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] - }, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; - }, ar__months = [ - 'كانون الثاني يناير', - 'شباط فبراير', - 'آذار مارس', - 'نيسان أبريل', - 'أيار مايو', - 'حزيران يونيو', - 'تموز يوليو', - 'آب أغسطس', - 'أيلول سبتمبر', - 'تشرين الأول أكتوبر', - 'تشرين الثاني نوفمبر', - 'كانون الأول ديسمبر' - ]; - - var ar = moment__default.defineLocale('ar', { - months : ar__months, - monthsShort : ar__months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/\u200FM/\u200FYYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return ar__numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ar__symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : azerbaijani (az) - //! author : topchiyev : https://github.com/topchiyev - - var az__suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' - }; - - var az = moment__default.defineLocale('az', { - months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'), - monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'), - weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } - }, - ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (az__suffixes[a] || az__suffixes[b] || az__suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : belarusian (be) - //! author : Dmitry Demidov : https://github.com/demidov91 - //! author: Praleska: http://praleska.pro/ - //! Author : Menelion Elensúle : https://github.com/Oire - - function be__plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function be__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + be__plural(format[key], +number); - } - } - - var be = moment__default.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : be__relativeTimeWithPlural, - mm : be__relativeTimeWithPlural, - h : be__relativeTimeWithPlural, - hh : be__relativeTimeWithPlural, - d : 'дзень', - dd : be__relativeTimeWithPlural, - M : 'месяц', - MM : be__relativeTimeWithPlural, - y : 'год', - yy : be__relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - ordinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : bulgarian (bg) - //! author : Krasen Borisov : https://github.com/kraz - - var bg = moment__default.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bengali (bn) - //! author : Kaushik Gandhi : https://github.com/kaushikgandhi - - var bn__symbolMap = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' - }, - bn__numberMap = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' - }; - - var bn = moment__default.defineLocale('bn', { - months : 'জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'), - longDateFormat : { - LT : 'A h:mm সময়', - LTS : 'A h:mm:ss সময়', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm সময়', - LLLL : 'dddd, D MMMM YYYY, A h:mm সময়' - }, - calendar : { - sameDay : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return bn__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return bn__symbolMap[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : tibetan (bo) - //! author : Thupten N. Chakrishar : https://github.com/vajradog - - var bo__symbolMap = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' - }, - bo__numberMap = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' - }; - - var bo = moment__default.defineLocale('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return bo__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return bo__symbolMap[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; - } else { - return 'མཚན་མོ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : breton (br) - //! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou - - function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); - } - function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } - } - function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; - } - function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; - } - function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); - } - - var br = moment__default.defineLocale('br', { - months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'), - monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'), - weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'), - weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), - weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h[e]mm A', - LTS : 'h[e]mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D [a viz] MMMM YYYY', - LLL : 'D [a viz] MMMM YYYY h[e]mm A', - LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A' - }, - calendar : { - sameDay : '[Hiziv da] LT', - nextDay : '[Warc\'hoazh da] LT', - nextWeek : 'dddd [da] LT', - lastDay : '[Dec\'h da] LT', - lastWeek : 'dddd [paset da] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'a-benn %s', - past : '%s \'zo', - s : 'un nebeud segondennoù', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - ordinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : bosnian (bs) - //! author : Nedim Cholich : https://github.com/frontyard - //! based on (hr) translation by Bojan Marković - - function bs__translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var bs = moment__default.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : bs__translate, - mm : bs__translate, - h : bs__translate, - hh : bs__translate, - d : 'dan', - dd : bs__translate, - M : 'mjesec', - MM : bs__translate, - y : 'godinu', - yy : bs__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : catalan (ca) - //! author : Juan G. Hurtado : https://github.com/juanghurtado - - var ca = moment__default.defineLocale('ca', { - months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'fa %s', - s : 'uns segons', - m : 'un minut', - mm : '%d minuts', - h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', - M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - ordinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : czech (cs) - //! author : petrbela : https://github.com/petrbela - - var cs__months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), - cs__monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); - function cs__plural(n) { - return (n > 1) && (n < 5) && (~~(n / 10) !== 1); - } - function cs__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (cs__plural(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } - } - - var cs = moment__default.defineLocale('cs', { - months : cs__months, - monthsShort : cs__monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(cs__months, cs__monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(cs__monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(cs__months)), - weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), - weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), - weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : cs__translate, - m : cs__translate, - mm : cs__translate, - h : cs__translate, - hh : cs__translate, - d : cs__translate, - dd : cs__translate, - M : cs__translate, - MM : cs__translate, - y : cs__translate, - yy : cs__translate - }, - ordinalParse : /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : chuvash (cv) - //! author : Anatoly Mironov : https://github.com/mirontoli - - var cv = moment__default.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - ordinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Welsh (cy) - //! author : Robert Allen - - var cy = moment__default.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : danish (da) - //! author : Ulrik Nielsen : https://github.com/mrbase - - var da = moment__default.defineLocale('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd [d.] D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[I dag kl.] LT', - nextDay : '[I morgen kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[I går kl.] LT', - lastWeek : '[sidste] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : austrian german (de-at) - //! author : lluchs : https://github.com/lluchs - //! author: Menelion Elensúle: https://github.com/Oire - //! author : Martin Groller : https://github.com/MadMG - //! author : Mikolaj Dadela : https://github.com/mik01aj - - function de_at__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de_at = moment__default.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : de_at__processRelativeTime, - mm : '%d Minuten', - h : de_at__processRelativeTime, - hh : '%d Stunden', - d : de_at__processRelativeTime, - dd : de_at__processRelativeTime, - M : de_at__processRelativeTime, - MM : de_at__processRelativeTime, - y : de_at__processRelativeTime, - yy : de_at__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : german (de) - //! author : lluchs : https://github.com/lluchs - //! author: Menelion Elensúle: https://github.com/Oire - //! author : Mikolaj Dadela : https://github.com/mik01aj - - function de__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - - var de = moment__default.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : de__processRelativeTime, - mm : '%d Minuten', - h : de__processRelativeTime, - hh : '%d Stunden', - d : de__processRelativeTime, - dd : de__processRelativeTime, - M : de__processRelativeTime, - MM : de__processRelativeTime, - y : de__processRelativeTime, - yy : de__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : dhivehi (dv) - //! author : Jawish Hameed : https://github.com/jawish - - var dv__months = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ], dv__weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - var dv = moment__default.defineLocale('dv', { - months : dv__months, - monthsShort : dv__months, - weekdays : dv__weekdays, - weekdaysShort : dv__weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : modern greek (el) - //! author : Aggelos Karalias : https://github.com/mehiel - - var el = moment__default.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - ordinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : australian english (en-au) - - var en_au = moment__default.defineLocale('en-au', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : canadian english (en-ca) - //! author : Jonathan Abourbih : https://github.com/jonbca - - var en_ca = moment__default.defineLocale('en-ca', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'YYYY-MM-DD', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - //! moment.js locale configuration - //! locale : great britain english (en-gb) - //! author : Chris Gedrim : https://github.com/chrisgedrim - - var en_gb = moment__default.defineLocale('en-gb', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Irish english (en-ie) - //! author : Chris Cartlidge : https://github.com/chriscartlidge - - var en_ie = moment__default.defineLocale('en-ie', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : New Zealand english (en-nz) - - var en_nz = moment__default.defineLocale('en-nz', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : esperanto (eo) - //! author : Colin Dean : https://github.com/colindean - //! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko. - //! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni! - - var eo = moment__default.defineLocale('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato'.split('_'), - weekdaysShort : 'Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Ĵa_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-an de] MMMM, YYYY', - LLL : 'D[-an de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-an de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'je %s', - past : 'antaŭ %s', - s : 'sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - ordinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : spanish (es) - //! author : Julio Napurí : https://github.com/julionc - - var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), - es__monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - - var es = moment__default.defineLocale('es', { - months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return es__monthsShort[m.month()]; - } else { - return monthsShortDot[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : estonian (et) - //! author : Henry Kehlmann : https://github.com/madhenry - //! improvements : Illimar Tambek : https://github.com/ragulka - - function et__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; - } - - var et = moment__default.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : et__processRelativeTime, - m : et__processRelativeTime, - mm : et__processRelativeTime, - h : et__processRelativeTime, - hh : et__processRelativeTime, - d : et__processRelativeTime, - dd : '%d päeva', - M : et__processRelativeTime, - MM : et__processRelativeTime, - y : et__processRelativeTime, - yy : et__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : euskara (eu) - //! author : Eneko Illarramendi : https://github.com/eillarra - - var eu = moment__default.defineLocale('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Persian (fa) - //! author : Ebrahim Byagowi : https://github.com/ebraminio - - var fa__symbolMap = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' - }, fa__numberMap = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' - }; - - var fa = moment__default.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - meridiemParse: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چندین ثانیه', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return fa__numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return fa__symbolMap[match]; - }).replace(/,/g, '،'); - }, - ordinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : finnish (fi) - //! author : Tarmo Aidantausta : https://github.com/bleadof - - var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; - function fi__translate(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; - } - function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; - } - - var fi = moment__default.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : fi__translate, - m : fi__translate, - mm : fi__translate, - h : fi__translate, - hh : fi__translate, - d : fi__translate, - dd : fi__translate, - M : fi__translate, - MM : fi__translate, - y : fi__translate, - yy : fi__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : faroese (fo) - //! author : Ragnar Johannesen : https://github.com/ragnar123 - - var fo = moment__default.defineLocale('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D. MMMM, YYYY HH:mm' - }, - calendar : { - sameDay : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - m : 'ein minutt', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaði', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : canadian french (fr-ca) - //! author : Jonathan Abourbih : https://github.com/jonbca - - var fr_ca = moment__default.defineLocale('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - } - }); - - //! moment.js locale configuration - //! locale : swiss french (fr) - //! author : Gaspard Bucher : https://github.com/gaspard - - var fr_ch = moment__default.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : french (fr) - //! author : John Fischer : https://github.com/jfroffice - - var fr = moment__default.defineLocale('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : ''); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : frisian (fy) - //! author : Robin van der Vliet : https://github.com/robin0van0der0v - - var fy__monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - fy__monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - - var fy = moment__default.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return fy__monthsShortWithoutDots[m.month()]; - } else { - return fy__monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : great britain scottish gealic (gd) - //! author : Jon Ashdown : https://github.com/jonashdown - - var gd__months = [ - 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd' - ]; - - var gd__monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - - var gd__weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - - var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - - var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - - var gd = moment__default.defineLocale('gd', { - months : gd__months, - monthsShort : gd__monthsShort, - monthsParseExact : true, - weekdays : gd__weekdays, - weekdaysShort : weekdaysShort, - weekdaysMin : weekdaysMin, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - ordinalParse : /\d{1,2}(d|na|mh)/, - ordinal : function (number) { - var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : galician (gl) - //! author : Juan G. Hurtado : https://github.com/juanghurtado - - var gl = moment__default.defineLocale('gl', { - months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'), - monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'), - monthsParseExact: true, - weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'), - weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str === 'uns segundos') { - return 'nuns segundos'; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Hebrew (he) - //! author : Tomer Cohen : https://github.com/tomer - //! author : Moshe Simantov : https://github.com/DevelopmentIL - //! author : Tal Ater : https://github.com/TalAter - - var he = moment__default.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [ב]MMMM YYYY', - LLL : 'D [ב]MMMM YYYY HH:mm', - LLLL : 'dddd, D [ב]MMMM YYYY HH:mm', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } - }); - - //! moment.js locale configuration - //! locale : hindi (hi) - //! author : Mayank Singhal : https://github.com/mayanksinghal - - var hi__symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - hi__numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var hi = moment__default.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm बजे', - LTS : 'A h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, A h:mm बजे' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return hi__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return hi__symbolMap[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : hrvatski (hr) - //! author : Bojan Marković : https://github.com/bmarkovic - - function hr__translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } - } - - var hr = moment__default.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : hr__translate, - mm : hr__translate, - h : hr__translate, - hh : hr__translate, - d : 'dan', - dd : hr__translate, - M : 'mjesec', - MM : hr__translate, - y : 'godinu', - yy : hr__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : hungarian (hu) - //! author : Adam Brunner : https://github.com/adambrunner - - var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); - function hu__translate(number, withoutSuffix, key, isFuture) { - var num = number, - suffix; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; - } - function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; - } - - var hu = moment__default.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : hu__translate, - m : hu__translate, - mm : hu__translate, - h : hu__translate, - hh : hu__translate, - d : hu__translate, - dd : hu__translate, - M : hu__translate, - MM : hu__translate, - y : hu__translate, - yy : hu__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Armenian (hy-am) - //! author : Armendarabyan : https://github.com/armendarabyan - - var hy_am = moment__default.defineLocale('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY թ.', - LLL : 'D MMMM YYYY թ., HH:mm', - LLLL : 'dddd, D MMMM YYYY թ., HH:mm' - }, - calendar : { - sameDay: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bahasa Indonesia (id) - //! author : Mohammad Satrio Utomo : https://github.com/tyok - //! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan - - var id = moment__default.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : icelandic (is) - //! author : Hinrik Örn Sigurðsson : https://github.com/hinrik - - function is__plural(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; - } - function is__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (is__plural(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (is__plural(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (is__plural(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (is__plural(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (is__plural(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } - } - - var is = moment__default.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : is__translate, - m : is__translate, - mm : is__translate, - h : 'klukkustund', - hh : is__translate, - d : is__translate, - dd : is__translate, - M : is__translate, - MM : is__translate, - y : is__translate, - yy : is__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : italian (it) - //! author : Lorenzo : https://github.com/aliem - //! author: Mattia Larentis: https://github.com/nostalgiaz - - var it = moment__default.defineLocale('it', { - months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), - monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), - weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'), - weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Me_Gi_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Oggi alle] LT', - nextDay: '[Domani alle] LT', - nextWeek: 'dddd [alle] LT', - lastDay: '[Ieri alle] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[la scorsa] dddd [alle] LT'; - default: - return '[lo scorso] dddd [alle] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : function (s) { - return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; - }, - past : '%s fa', - s : 'alcuni secondi', - m : 'un minuto', - mm : '%d minuti', - h : 'un\'ora', - hh : '%d ore', - d : 'un giorno', - dd : '%d giorni', - M : 'un mese', - MM : '%d mesi', - y : 'un anno', - yy : '%d anni' - }, - ordinalParse : /\d{1,2}º/, - ordinal: '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : japanese (ja) - //! author : LI Long : https://github.com/baryon - - var ja = moment__default.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'Ah時m分', - LTS : 'Ah時m分s秒', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah時m分', - LLLL : 'YYYY年M月D日Ah時m分 dddd' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : '[来週]dddd LT', - lastDay : '[昨日] LT', - lastWeek : '[前週]dddd LT', - sameElse : 'L' - }, - ordinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } - }); - - //! moment.js locale configuration - //! locale : Boso Jowo (jv) - //! author : Rony Lantip : https://github.com/lantip - //! reference: http://jv.wikipedia.org/wiki/Basa_Jawa - - var jv = moment__default.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Georgian (ka) - //! author : Irakli Janiashvili : https://github.com/irakli-janiashvili - - var ka = moment__default.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } - }); - - //! moment.js locale configuration - //! locale : kazakh (kk) - //! authors : Nurlan Rakhimzhanov : https://github.com/nurlan - - var kk__suffixes = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' - }; - - var kk = moment__default.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (kk__suffixes[number] || kk__suffixes[a] || kk__suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : khmer (km) - //! author : Kruy Vanna : https://github.com/kruyvanna - - var km = moment__default.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : korean (ko) - //! - //! authors - //! - //! - Kyungwook, Park : https://github.com/kyungw00k - //! - Jeeeyul Lee - - var ko = moment__default.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h시 m분', - LTS : 'A h시 m분 s초', - L : 'YYYY.MM.DD', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h시 m분', - LLLL : 'YYYY년 MMMM D일 dddd A h시 m분' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '일분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - ordinalParse : /\d{1,2}일/, - ordinal : '%d일', - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } - }); - - //! moment.js locale configuration - //! locale : kyrgyz (ky) - //! author : Chyngyz Arystan uulu : https://github.com/chyngyz - - - var ky__suffixes = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' - }; - - var ky = moment__default.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кече саат] LT', - lastWeek : '[Өткен аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (ky__suffixes[number] || ky__suffixes[a] || ky__suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Luxembourgish (lb) - //! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz - - function lb__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } - function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; - } - function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; - } - /** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ - function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } - } - - var lb = moment__default.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - m : lb__processRelativeTime, - mm : '%d Minutten', - h : lb__processRelativeTime, - hh : '%d Stonnen', - d : lb__processRelativeTime, - dd : '%d Deeg', - M : lb__processRelativeTime, - MM : '%d Méint', - y : lb__processRelativeTime, - yy : '%d Joer' - }, - ordinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : lao (lo) - //! author : Ryan Hart : https://github.com/ryanhart2 - - var lo = moment__default.defineLocale('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'ວັນdddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - ordinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } - }); - - //! moment.js locale configuration - //! locale : Lithuanian (lt) - //! author : Mindaugas Mozūras : https://github.com/mmozuras - - var lt__units = { - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' - }; - function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } - } - function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); - } - function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); - } - function forms(key) { - return lt__units[key].split('_'); - } - function lt__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } - } - var lt = moment__default.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_') - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - m : translateSingular, - mm : lt__translate, - h : translateSingular, - hh : lt__translate, - d : translateSingular, - dd : lt__translate, - M : translateSingular, - MM : lt__translate, - y : translateSingular, - yy : lt__translate - }, - ordinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : latvian (lv) - //! author : Kristaps Karlsons : https://github.com/skakri - //! author : Jānis Elmeris : https://github.com/JanisE - - var lv__units = { - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') - }; - /** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ - function lv__format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number !== 11 ? forms[0] : forms[1]; - } - } - function lv__relativeTimeWithPlural(number, withoutSuffix, key) { - return number + ' ' + lv__format(lv__units[key], number, withoutSuffix); - } - function relativeTimeWithSingular(number, withoutSuffix, key) { - return lv__format(lv__units[key], number, withoutSuffix); - } - function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; - } - - var lv = moment__default.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - m : relativeTimeWithSingular, - mm : lv__relativeTimeWithPlural, - h : relativeTimeWithSingular, - hh : lv__relativeTimeWithPlural, - d : relativeTimeWithSingular, - dd : lv__relativeTimeWithPlural, - M : relativeTimeWithSingular, - MM : lv__relativeTimeWithPlural, - y : relativeTimeWithSingular, - yy : lv__relativeTimeWithPlural - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Montenegrin (me) - //! author : Miodrag Nikač : https://github.com/miodragnikac - - var me__translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = me__translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + me__translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var me = moment__default.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - m : me__translator.translate, - mm : me__translator.translate, - h : me__translator.translate, - hh : me__translator.translate, - d : 'dan', - dd : me__translator.translate, - M : 'mjesec', - MM : me__translator.translate, - y : 'godinu', - yy : me__translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : macedonian (mk) - //! author : Borislav Mickov : https://github.com/B0k0 - - var mk = moment__default.defineLocale('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : malayalam (ml) - //! author : Floyd Pink : https://github.com/floydpink - - var ml = moment__default.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), - longDateFormat : { - LT : 'A h:mm -നു', - LTS : 'A h:mm:ss -നു', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm -നു', - LLLL : 'dddd, D MMMM YYYY, A h:mm -നു' - }, - calendar : { - sameDay : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } - }); - - //! moment.js locale configuration - //! locale : Marathi (mr) - //! author : Harshad Kale : https://github.com/kalehv - //! author : Vivek Athalye : https://github.com/vnathalye - - var mr__symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - mr__numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - function relativeTimeMr(number, withoutSuffix, string, isFuture) - { - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); - } - - var mr = moment__default.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm वाजता', - LTS : 'A h:mm:ss वाजता', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm वाजता', - LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return mr__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return mr__symbolMap[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bahasa Malaysia (ms-MY) - //! author : Weldan Jamili : https://github.com/weldan - - var ms_my = moment__default.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Bahasa Malaysia (ms-MY) - //! author : Weldan Jamili : https://github.com/weldan - - var locale_ms = moment__default.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Burmese (my) - //! author : Squar team, mysquar.com - - var my__symbolMap = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' - }, my__numberMap = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' - }; - - var my = moment__default.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return my__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return my__symbolMap[match]; - }); - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : norwegian bokmål (nb) - //! authors : Espen Hovlandsdal : https://github.com/rexxars - //! Sigurd Gartmann : https://github.com/sigurdga - - var nb = moment__default.defineLocale('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : nepali/nepalese - //! author : suvash : https://github.com/suvash - - var ne__symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' - }, - ne__numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' - }; - - var ne = moment__default.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'Aको h:mm बजे', - LTS : 'Aको h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, Aको h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return ne__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ne__symbolMap[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : dutch (nl) - //! author : Joris Röling : https://github.com/jjupiter - - var nl__monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - nl__monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - - var nl = moment__default.defineLocale('nl', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return nl__monthsShortWithoutDots[m.month()]; - } else { - return nl__monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : norwegian nynorsk (nn) - //! author : https://github.com/mechuwind - - var nn = moment__default.defineLocale('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : punjabi india (pa-in) - //! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit - - var pa_in__symbolMap = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' - }, - pa_in__numberMap = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' - }; - - var pa_in = moment__default.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calender but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - longDateFormat : { - LT : 'A h:mm ਵਜੇ', - LTS : 'A h:mm:ss ਵਜੇ', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm ਵਜੇ', - LLLL : 'dddd, D MMMM YYYY, A h:mm ਵਜੇ' - }, - calendar : { - sameDay : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return pa_in__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return pa_in__symbolMap[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : polish (pl) - //! author : Rafal Hirsz : https://github.com/evoL - - var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); - function pl__plural(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); - } - function pl__translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (pl__plural(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (pl__plural(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (pl__plural(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (pl__plural(number) ? 'lata' : 'lat'); - } - } - - var pl = moment__default.defineLocale('pl', { - months : function (momentToFormat, format) { - if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'nie_pon_wt_śr_czw_pt_sb'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: '[W] dddd [o] LT', - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - m : pl__translate, - mm : pl__translate, - h : pl__translate, - hh : pl__translate, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : pl__translate, - y : 'rok', - yy : pl__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : brazilian portuguese (pt-br) - //! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira - - var pt_br = moment__default.defineLocale('pt-br', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : '%s atrás', - s : 'poucos segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº' - }); - - //! moment.js locale configuration - //! locale : portuguese (pt) - //! author : Jefferson : https://github.com/jalex79 - - var pt = moment__default.defineLocale('pt', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : romanian (ro) - //! author : Vlad Gurdiga : https://github.com/gurdiga - //! author : Valentin Agachi : https://github.com/avaly - - function ro__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; - } - - var ro = moment__default.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - m : 'un minut', - mm : ro__relativeTimeWithPlural, - h : 'o oră', - hh : ro__relativeTimeWithPlural, - d : 'o zi', - dd : ro__relativeTimeWithPlural, - M : 'o lună', - MM : ro__relativeTimeWithPlural, - y : 'un an', - yy : ro__relativeTimeWithPlural - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : russian (ru) - //! author : Viktorminator : https://github.com/Viktorminator - //! Author : Menelion Elensúle : https://github.com/Oire - //! author : Коренберг Марк : https://github.com/socketpair - - function ru__plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function ru__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + ru__plural(format[key], +number); - } - } - var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; - - // http://new.gramota.ru/spravka/rules/139-prop : § 103 - // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 - // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 - var ru = moment__default.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - monthsRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsStrictRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortStrictRegex: /^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сегодня в] LT', - nextDay: '[Завтра в] LT', - lastDay: '[Вчера в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - m : ru__relativeTimeWithPlural, - mm : ru__relativeTimeWithPlural, - h : 'час', - hh : ru__relativeTimeWithPlural, - d : 'день', - dd : ru__relativeTimeWithPlural, - M : 'месяц', - MM : ru__relativeTimeWithPlural, - y : 'год', - yy : ru__relativeTimeWithPlural - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - ordinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Northern Sami (se) - //! authors : Bård Rolstad Henriksen : https://github.com/karamell - - - var se = moment__default.defineLocale('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Sinhalese (si) - //! author : Sampath Sitinamaluwa : https://github.com/sampathsris - - /*jshint -W100*/ - var si = moment__default.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - ordinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } - }); - - //! moment.js locale configuration - //! locale : slovak (sk) - //! author : Martin Minka : https://github.com/k2s - //! based on work of petrbela : https://github.com/petrbela - - var sk__months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - sk__monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); - function sk__plural(n) { - return (n > 1) && (n < 5); - } - function sk__translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (sk__plural(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } - } - - var sk = moment__default.defineLocale('sk', { - months : sk__months, - monthsShort : sk__monthsShort, - weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), - weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'), - weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : sk__translate, - m : sk__translate, - mm : sk__translate, - h : sk__translate, - hh : sk__translate, - d : sk__translate, - dd : sk__translate, - M : sk__translate, - MM : sk__translate, - y : sk__translate, - yy : sk__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : slovenian (sl) - //! author : Robert Sedovšek : https://github.com/sedovsek - - function sl__processRelativeTime(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } - } - - var sl = moment__default.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : sl__processRelativeTime, - m : sl__processRelativeTime, - mm : sl__processRelativeTime, - h : sl__processRelativeTime, - hh : sl__processRelativeTime, - d : sl__processRelativeTime, - dd : sl__processRelativeTime, - M : sl__processRelativeTime, - MM : sl__processRelativeTime, - y : sl__processRelativeTime, - yy : sl__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Albanian (sq) - //! author : Flakërim Ismani : https://github.com/flakerimi - //! author: Menelion Elensúle: https://github.com/Oire (tests) - //! author : Oerd Cukalla : https://github.com/oerd (fixes) - - var sq = moment__default.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Serbian-cyrillic (sr-cyrl) - //! author : Milan Janačković : https://github.com/milan-j - - var sr_cyrl__translator = { - words: { //Different grammatical cases - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = sr_cyrl__translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + sr_cyrl__translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr_cyrl = moment__default.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - m : sr_cyrl__translator.translate, - mm : sr_cyrl__translator.translate, - h : sr_cyrl__translator.translate, - hh : sr_cyrl__translator.translate, - d : 'дан', - dd : sr_cyrl__translator.translate, - M : 'месец', - MM : sr_cyrl__translator.translate, - y : 'годину', - yy : sr_cyrl__translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Serbian-latin (sr) - //! author : Milan Janačković : https://github.com/milan-j - - var sr__translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = sr__translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + sr__translator.correctGrammaticalCase(number, wordKey); - } - } - }; - - var sr = moment__default.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - m : sr__translator.translate, - mm : sr__translator.translate, - h : sr__translator.translate, - hh : sr__translator.translate, - d : 'dan', - dd : sr__translator.translate, - M : 'mesec', - MM : sr__translator.translate, - y : 'godinu', - yy : sr__translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : siSwati (ss) - //! author : Nicolai Davies : https://github.com/nicolaidavies - - - var ss = moment__default.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - ordinalParse: /\d{1,2}/, - ordinal : '%d', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : swedish (sv) - //! author : Jens Alm : https://github.com/ulmus - - var sv = moment__default.defineLocale('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : swahili (sw) - //! author : Fahad Kassim : https://github.com/fadsel - - var sw = moment__default.defineLocale('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : tamil (ta) - //! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404 - - var ta__symbolMap = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' - }, ta__numberMap = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' - }; - - var ta = moment__default.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, HH:mm', - LLLL : 'dddd, D MMMM YYYY, HH:mm' - }, - calendar : { - sameDay : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - ordinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return ta__numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return ta__symbolMap[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : telugu (te) - //! author : Krishna Chaitanya Thota : https://github.com/kcthota - - var te = moment__default.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - ordinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : thai (th) - //! author : Kridsada Thanabulpong : https://github.com/sirn - - var th = moment__default.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H นาฬิกา m นาที', - LTS : 'H นาฬิกา m นาที s วินาที', - L : 'YYYY/MM/DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H นาฬิกา m นาที', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } - }); - - //! moment.js locale configuration - //! locale : Tagalog/Filipino (tl-ph) - //! author : Dan Hagman - - var tl_ph = moment__default.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: '[Ngayon sa] LT', - nextDay: '[Bukas sa] LT', - nextWeek: 'dddd [sa] LT', - lastDay: '[Kahapon sa] LT', - lastWeek: 'dddd [huling linggo] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Klingon (tlh) - //! author : Dominika Kruk : https://github.com/amaranthrose - - var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - - function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; - } - - function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; - } - - function tlh__translate(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } - } - - function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; - } - - var tlh = moment__default.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - m : 'wa’ tup', - mm : tlh__translate, - h : 'wa’ rep', - hh : tlh__translate, - d : 'wa’ jaj', - dd : tlh__translate, - M : 'wa’ jar', - MM : tlh__translate, - y : 'wa’ DIS', - yy : tlh__translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : turkish (tr) - //! authors : Erhan Gundogan : https://github.com/erhangundogan, - //! Burak Yiğit Kaya: https://github.com/BYK - - var tr__suffixes = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' - }; - - var tr = moment__default.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[haftaya] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen hafta] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (tr__suffixes[a] || tr__suffixes[b] || tr__suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : talossan (tzl) - //! author : Robin van der Vliet : https://github.com/robin0van0der0v with the help of Iustì Canun - - - // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. - // This is currently too difficult (maybe even impossible) to add. - var tzl = moment__default.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : tzl__processRelativeTime, - m : tzl__processRelativeTime, - mm : tzl__processRelativeTime, - h : tzl__processRelativeTime, - hh : tzl__processRelativeTime, - d : tzl__processRelativeTime, - dd : tzl__processRelativeTime, - M : tzl__processRelativeTime, - MM : tzl__processRelativeTime, - y : tzl__processRelativeTime, - yy : tzl__processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - function tzl__processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); - } - - //! moment.js locale configuration - //! locale : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn) - //! author : Abdel Said : https://github.com/abdelsaid - - var tzm_latn = moment__default.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : Morocco Central Atlas Tamaziɣt (tzm) - //! author : Abdel Said : https://github.com/abdelsaid - - var tzm = moment__default.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : ukrainian (uk) - //! author : zemlanin : https://github.com/zemlanin - //! Author : Menelion Elensúle : https://github.com/Oire - - function uk__plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); - } - function uk__relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + uk__plural(format[key], +number); - } - } - function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }, - nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; - } - function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; - } - - var uk = moment__default.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY р.', - LLL : 'D MMMM YYYY р., HH:mm', - LLLL : 'dddd, D MMMM YYYY р., HH:mm' - }, - calendar : { - sameDay: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - m : uk__relativeTimeWithPlural, - mm : uk__relativeTimeWithPlural, - h : 'годину', - hh : uk__relativeTimeWithPlural, - d : 'день', - dd : uk__relativeTimeWithPlural, - M : 'місяць', - MM : uk__relativeTimeWithPlural, - y : 'рік', - yy : uk__relativeTimeWithPlural - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - ordinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : uzbek (uz) - //! author : Sardor Muminov : https://github.com/muminoff - - var uz = moment__default.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : vietnamese (vi) - //! author : Bang Nguyen : https://github.com/bangnk - - var vi = moment__default.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : pseudo (x-pseudo) - //! author : Andrew Hood : https://github.com/andrewhood125 - - var x_pseudo = moment__default.defineLocale('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : chinese (zh-cn) - //! author : suupic : https://github.com/suupic - //! author : Zeno Zeng : https://github.com/zenozeng - - var zh_cn = moment__default.defineLocale('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah点mm分', - LTS : 'Ah点m分s秒', - L : 'YYYY-MM-DD', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah点mm分', - LLLL : 'YYYY年MMMD日ddddAh点mm分', - l : 'YYYY-MM-DD', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah点mm分', - llll : 'YYYY年MMMD日ddddAh点mm分' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : function () { - return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT'; - }, - nextDay : function () { - return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT'; - }, - lastDay : function () { - return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT'; - }, - nextWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment__default().startOf('week'); - prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - lastWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment__default().startOf('week'); - prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - sameElse : 'LL' - }, - ordinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } - }); - - //! moment.js locale configuration - //! locale : traditional chinese (zh-tw) - //! author : Ben : https://github.com/ben-lin - - var zh_tw = moment__default.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah點mm分', - LTS : 'Ah點m分s秒', - L : 'YYYY年MMMD日', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah點mm分', - LLLL : 'YYYY年MMMD日ddddAh點mm分', - l : 'YYYY年MMMD日', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah點mm分', - llll : 'YYYY年MMMD日ddddAh點mm分' - }, - meridiemParse: /早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - ordinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - m : '1分鐘', - mm : '%d分鐘', - h : '1小時', - hh : '%d小時', - d : '1天', - dd : '%d天', - M : '1個月', - MM : '%d個月', - y : '1年', - yy : '%d年' - } - }); - - var moment_with_locales = moment__default; - moment_with_locales.locale('en'); - - return moment_with_locales; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.min.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.min.js deleted file mode 100644 index 4b3fe51a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment-with-locales.min.js +++ /dev/null @@ -1,76 +0,0 @@ -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return ce.apply(null,arguments)}function b(a){ce=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in ee)d=ee[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),fe===!1&&(fe=!0,a.updateOffset(this),fe=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(b,c){var d=!0;return g(function(){return null!=a.deprecationHandler&&a.deprecationHandler(null,b),d&&(t(b+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),d=!1),c.apply(this,arguments)},c)}function v(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),ge[b]||(t(c),ge[b]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!ke[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=ie._abbr,require("./locale/"+a),E(b)}catch(c){}return ke[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(ie=c)),ie._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=ke[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(ke[a]._config,b)):null!=b.parentLocale&&(null!=ke[b.parentLocale]?b=z(ke[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),ke[a]=new A(b),E(a),ke[a]):(delete ke[a],null)}function G(a,b){if(null!=b){var c;null!=ke[a]&&(b=z(ke[a]._config,b)),c=new A(b),c.parentLocale=ke[a],ke[a]=c,E(a)}else null!=ke[a]&&(null!=ke[a].parentLocale?ke[a]=ke[a].parentLocale:null!=ke[a]&&delete ke[a]);return ke[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ie;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return he(ke)}function J(a,b){var c=a.toLowerCase();le[c]=le[c+"s"]=le[b]=a}function K(a){return"string"==typeof a?le[a]||le[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(pe[a]=e),b&&(pe[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(pe[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(me);for(b=0,c=d.length;c>b;b++)pe[d[b]]?d[b]=pe[d[b]]:d[b]=S(d[b]);return function(b){var e,f="";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),oe[b]=oe[b]||T(b),oe[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(ne.lastIndex=0;d>=0&&ne.test(a);)a=a.replace(ne,c),ne.lastIndex=0,d-=1;return a}function W(a,b,c){He[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(He,a)?He[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;cd;++d)f=h([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=je.call(this._shortMonthsParse,g),-1!==e?e:null):(e=je.call(this._longMonthsParse,g),-1!==e?e:null):"MMM"===b?(e=je.call(this._shortMonthsParse,g),-1!==e?e:(e=je.call(this._longMonthsParse,g),-1!==e?e:null)):(e=je.call(this._longMonthsParse,g),-1!==e?e:(e=je.call(this._shortMonthsParse,g),-1!==e?e:null))}function fa(a,b,c){var d,e,f;if(this._monthsParseExact)return ea.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ga(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ha(b){return null!=b?(ga(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ia(){return ba(this.year(),this.month())}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ka(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function la(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function ma(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Ke]<0||c[Ke]>11?Ke:c[Le]<1||c[Le]>ba(c[Je],c[Ke])?Le:c[Me]<0||c[Me]>24||24===c[Me]&&(0!==c[Ne]||0!==c[Oe]||0!==c[Pe])?Me:c[Ne]<0||c[Ne]>59?Ne:c[Oe]<0||c[Oe]>59?Oe:c[Pe]<0||c[Pe]>999?Pe:-1,j(a)._overflowDayOfYear&&(Je>b||b>Le)&&(b=Le),j(a)._overflowWeeks&&-1===b&&(b=Qe),j(a)._overflowWeekday&&-1===b&&(b=Re),j(a).overflow=b),a}function na(a){var b,c,d,e,f,g,h=a._i,i=Xe.exec(h)||Ye.exec(h);if(i){for(j(a).iso=!0,b=0,c=$e.length;c>b;b++)if($e[b][1].exec(i[1])){e=$e[b][0],d=$e[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=_e.length;c>b;b++)if(_e[b][1].exec(i[3])){f=(i[2]||" ")+_e[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Ze.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ca(a)}else a._isValid=!1}function oa(b){var c=af.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(na(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function pa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function qa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ra(a){return sa(a)?366:365}function sa(a){return a%4===0&&a%100!==0||a%400===0}function ta(){return sa(this.year())}function ua(a,b,c){var d=7+b-c,e=(7+qa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=ra(f)+j):j>ra(a)?(f=a+1,g=j-ra(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(ra(a)-d+e)/7}function ya(a,b,c){return null!=a?a:null!=b?b:c}function za(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function Aa(a){var b,c,d,e,f=[];if(!a._d){for(d=za(a),a._w&&null==a._a[Le]&&null==a._a[Ke]&&Ba(a),a._dayOfYear&&(e=ya(a._a[Je],d[Je]),a._dayOfYear>ra(e)&&(j(a)._overflowDayOfYear=!0),c=qa(e,0,a._dayOfYear),a._a[Ke]=c.getUTCMonth(),a._a[Le]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Me]&&0===a._a[Ne]&&0===a._a[Oe]&&0===a._a[Pe]&&(a._nextDay=!0,a._a[Me]=0),a._d=(a._useUTC?qa:pa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Me]=24)}}function Ba(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ya(b.GG,a._a[Je],wa(Ka(),1,4).year),d=ya(b.W,1),e=ya(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ya(b.gg,a._a[Je],wa(Ka(),f,g).year),d=ya(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>xa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[Je]=h.year,a._dayOfYear=h.dayOfYear)}function Ca(b){if(b._f===a.ISO_8601)return void na(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(me)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),pe[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Me]<=12&&b._a[Me]>0&&(j(b).bigHour=void 0),j(b).parsedDateParts=b._a.slice(0),j(b).meridiem=b._meridiem,b._a[Me]=Da(b._locale,b._a[Me],b._meridiem),Aa(b),ma(b)}function Da(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Ea(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function Fa(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),Aa(a)}}function Ga(a){var b=new o(ma(Ha(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ha(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(ma(b)):(c(e)?Ea(a):e?Ca(a):d(b)?a._d=b:Ia(a),k(a)||(a._d=null),a))}function Ia(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(f.valueOf()):"string"==typeof f?oa(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),Aa(b)):"object"==typeof f?Fa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ja(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Ga(f)}function Ka(a,b,c,d){return Ja(a,b,c,d,!1)}function La(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ka();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Ra(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(ff)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Sa(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?b.valueOf():Ka(b).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+f),a.updateOffset(e,!1),e):Ka(b).local()}function Ta(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ua(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Ra(Ee,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ta(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?jb(this,db(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ta(this):null!=b?this:NaN}function Va(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Wa(a){return this.utcOffset(0,a)}function Xa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ta(this),"m")),this}function Ya(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ra(De,this._i)),this}function Za(a){return this.isValid()?(a=a?Ka(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function $a(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ha(a),a._a){var b=a._isUTC?h(a._a):Ka(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ab(){return this.isValid()?!this._isUTC:!1}function bb(){return this.isValid()?this._isUTC:!1}function cb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function db(a,b){var c,d,e,g=a,h=null;return Pa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=gf.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Le])*c,h:r(h[Me])*c,m:r(h[Ne])*c,s:r(h[Oe])*c,ms:r(h[Pe])*c}):(h=hf.exec(a))?(c="-"===h[1]?-1:1,g={y:eb(h[2],c),M:eb(h[3],c),w:eb(h[4],c),d:eb(h[5],c),h:eb(h[6],c),m:eb(h[7],c),s:eb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=gb(Ka(g.from),Ka(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Oa(g),Pa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function eb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function fb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function gb(a,b){var c;return a.isValid()&&b.isValid()?(b=Sa(b,a),a.isBefore(b)?c=fb(a,b):(c=fb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function hb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function ib(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=db(c,d),jb(this,e,a),this}}function jb(b,c,d,e){var f=c._milliseconds,g=hb(c._days),h=hb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&ga(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function kb(a,b){var c=a||Ka(),d=Sa(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ka(c)))}function lb(){return new o(this)}function mb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function ub(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function vb(){var a=this.clone().utc();return 0f&&(b=f),Vb.call(this,a,b,c,d,e))}function Vb(a,b,c,d,e){var f=va(a,b,c,d,e),g=qa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Wb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Xb(a){return wa(a,this._week.dow,this._week.doy).week}function Yb(){return this._week.dow}function Zb(){return this._week.doy}function $b(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function _b(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ac(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function bc(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function cc(a){return this._weekdaysShort[a.day()]}function dc(a){return this._weekdaysMin[a.day()]}function ec(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=h([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=je.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),-1!==e?e:(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:(e=je.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:(e=je.call(this._weekdaysParse,g),-1!==e?e:(e=je.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=je.call(this._minWeekdaysParse,g),-1!==e?e:(e=je.call(this._weekdaysParse,g),-1!==e?e:(e=je.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function fc(a,b,c){var d,e,f;if(this._weekdaysParseExact)return ec.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=h([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function gc(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ac(a,this.localeData()),this.add(a-b,"d")):b}function hc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function ic(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function jc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex}function kc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function lc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function mc(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],i=[],j=[],k=[];for(b=0;7>b;b++)c=h([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),i.push(e),j.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),i.sort(a),j.sort(a),k.sort(a),b=0;7>b;b++)i[b]=Z(i[b]),j[b]=Z(j[b]),k[b]=Z(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function nc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oc(){return this.hours()%12||12}function pc(){return this.hours()||24}function qc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function rc(a,b){return b._meridiemParse}function sc(a){return"p"===(a+"").toLowerCase().charAt(0)}function tc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function uc(a,b){b[Pe]=r(1e3*("0."+a))}function vc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}function xc(a){return Ka(1e3*a)}function yc(){return Ka.apply(null,arguments).parseZone()}function zc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function Ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function Bc(){return this._invalidDate}function Cc(a){return this._ordinal.replace("%d",a)}function Dc(a){return a}function Ec(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function Fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function Gc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Hc(a,b,c){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return Gc(a,b,c,"month");var d,e=[];for(d=0;12>d;d++)e[d]=Gc(a,d,c,"month");return e}function Ic(a,b,c,d){"boolean"==typeof a?("number"==typeof b&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,"number"==typeof b&&(c=b,b=void 0),b=b||"");var e=H(),f=a?e._week.dow:0;if(null!=c)return Gc(b,(c+f)%7,d,"day");var g,h=[];for(g=0;7>g;g++)h[g]=Gc(b,(g+f)%7,d,"day");return h}function Jc(a,b){return Hc(a,b,"months")}function Kc(a,b){return Hc(a,b,"monthsShort")}function Lc(a,b,c){return Ic(a,b,c,"weekdays")}function Mc(a,b,c){return Ic(a,b,c,"weekdaysShort")}function Nc(a,b,c){return Ic(a,b,c,"weekdaysMin")}function Oc(){var a=this._data;return this._milliseconds=Jf(this._milliseconds),this._days=Jf(this._days),this._months=Jf(this._months),a.milliseconds=Jf(a.milliseconds),a.seconds=Jf(a.seconds),a.minutes=Jf(a.minutes),a.hours=Jf(a.hours),a.months=Jf(a.months),a.years=Jf(a.years),this}function Pc(a,b,c,d){var e=db(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Qc(a,b){return Pc(this,a,b,1)}function Rc(a,b){return Pc(this,a,b,-1)}function Sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Sc(Vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Uc(g)),h+=e,g-=Sc(Vc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Uc(a){return 4800*a/146097}function Vc(a){return 146097*a/4800}function Wc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Yc(a){return function(){return this.as(a)}}function Zc(a){ -return a=K(a),this[a+"s"]()}function $c(a){return function(){return this._data[a]}}function _c(){return q(this.days()/7)}function ad(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function bd(a,b,c){var d=db(a).abs(),e=Zf(d.as("s")),f=Zf(d.as("m")),g=Zf(d.as("h")),h=Zf(d.as("d")),i=Zf(d.as("M")),j=Zf(d.as("y")),k=e<$f.s&&["s",e]||1>=f&&["m"]||f<$f.m&&["mm",f]||1>=g&&["h"]||g<$f.h&&["hh",g]||1>=h&&["d"]||h<$f.d&&["dd",h]||1>=i&&["M"]||i<$f.M&&["MM",i]||1>=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,ad.apply(null,k)}function cd(a,b){return void 0===$f[a]?!1:void 0===b?$f[a]:($f[a]=b,!0)}function dd(a){var b=this.localeData(),c=bd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ed(){var a,b,c,d=_f(this._milliseconds)/1e3,e=_f(this._days),f=_f(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"} -//! moment.js locale configuration -//! locale : belarusian (be) -//! author : Dmitry Demidov : https://github.com/demidov91 -//! author: Praleska: http://praleska.pro/ -//! Author : Menelion Elensúle : https://github.com/Oire -function fd(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function gd(a,b,c){var d={mm:b?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:b?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"};return"m"===c?b?"хвіліна":"хвіліну":"h"===c?b?"гадзіна":"гадзіну":a+" "+fd(d[c],+a)} -//! moment.js locale configuration -//! locale : breton (br) -//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou -function hd(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+kd(d[c],a)}function id(a){switch(jd(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function jd(a){return a>9?jd(a%10):a}function kd(a,b){return 2===b?ld(a):a}function ld(a){var b={m:"v",b:"v",d:"z"};return void 0===b[a.charAt(0)]?a:b[a.charAt(0)]+a.substring(1)} -//! moment.js locale configuration -//! locale : bosnian (bs) -//! author : Nedim Cholich : https://github.com/frontyard -//! based on (hr) translation by Bojan Marković -function md(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function nd(a){return a>1&&5>a&&1!==~~(a/10)}function od(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekund":"pár sekundami";case"m":return b?"minuta":d?"minutu":"minutou";case"mm":return b||d?e+(nd(a)?"minuty":"minut"):e+"minutami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(nd(a)?"hodiny":"hodin"):e+"hodinami";break;case"d":return b||d?"den":"dnem";case"dd":return b||d?e+(nd(a)?"dny":"dní"):e+"dny";break;case"M":return b||d?"měsíc":"měsícem";case"MM":return b||d?e+(nd(a)?"měsíce":"měsíců"):e+"měsíci";break;case"y":return b||d?"rok":"rokem";case"yy":return b||d?e+(nd(a)?"roky":"let"):e+"lety"}} -//! moment.js locale configuration -//! locale : austrian german (de-at) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Martin Groller : https://github.com/MadMG -//! author : Mikolaj Dadela : https://github.com/mik01aj -function pd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]} -//! moment.js locale configuration -//! locale : german (de) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Mikolaj Dadela : https://github.com/mik01aj -function qd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]} -//! moment.js locale configuration -//! locale : estonian (et) -//! author : Henry Kehlmann : https://github.com/madhenry -//! improvements : Illimar Tambek : https://github.com/ragulka -function rd(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}function sd(a,b,c,d){var e="";switch(c){case"s":return d?"muutaman sekunnin":"muutama sekunti";case"m":return d?"minuutin":"minuutti";case"mm":e=d?"minuutin":"minuuttia";break;case"h":return d?"tunnin":"tunti";case"hh":e=d?"tunnin":"tuntia";break;case"d":return d?"päivän":"päivä";case"dd":e=d?"päivän":"päivää";break;case"M":return d?"kuukauden":"kuukausi";case"MM":e=d?"kuukauden":"kuukautta";break;case"y":return d?"vuoden":"vuosi";case"yy":e=d?"vuoden":"vuotta"}return e=td(a,d)+" "+e}function td(a,b){return 10>a?b?yg[a]:xg[a]:a} -//! moment.js locale configuration -//! locale : hrvatski (hr) -//! author : Bojan Marković : https://github.com/bmarkovic -function ud(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}function vd(a,b,c,d){var e=a;switch(c){case"s":return d||b?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" óra":" órája");case"hh":return e+(d||b?" óra":" órája");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hónap":" hónapja");case"MM":return e+(d||b?" hónap":" hónapja");case"y":return"egy"+(d||b?" év":" éve");case"yy":return e+(d||b?" év":" éve")}return""}function wd(a){return(a?"":"[múlt] ")+"["+Ig[this.day()]+"] LT[-kor]"} -//! moment.js locale configuration -//! locale : icelandic (is) -//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik -function xd(a){return a%100===11?!0:a%10===1?!1:!0}function yd(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return b?"mínúta":"mínútu";case"mm":return xd(a)?e+(b||d?"mínútur":"mínútum"):b?e+"mínúta":e+"mínútu";case"hh":return xd(a)?e+(b||d?"klukkustundir":"klukkustundum"):e+"klukkustund";case"d":return b?"dagur":d?"dag":"degi";case"dd":return xd(a)?b?e+"dagar":e+(d?"daga":"dögum"):b?e+"dagur":e+(d?"dag":"degi");case"M":return b?"mánuður":d?"mánuð":"mánuði";case"MM":return xd(a)?b?e+"mánuðir":e+(d?"mánuði":"mánuðum"):b?e+"mánuður":e+(d?"mánuð":"mánuði");case"y":return b||d?"ár":"ári";case"yy":return xd(a)?e+(b||d?"ár":"árum"):e+(b||d?"ár":"ári")}} -//! moment.js locale configuration -//! locale : Luxembourgish (lb) -//! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz -function zd(a,b,c,d){var e={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return b?e[c][0]:e[c][1]}function Ad(a){var b=a.substr(0,a.indexOf(" "));return Cd(b)?"a "+a:"an "+a}function Bd(a){var b=a.substr(0,a.indexOf(" "));return Cd(b)?"viru "+a:"virun "+a}function Cd(a){if(a=parseInt(a,10),isNaN(a))return!1;if(0>a)return!0;if(10>a)return a>=4&&7>=a?!0:!1;if(100>a){var b=a%10,c=a/10;return Cd(0===b?c:b)}if(1e4>a){for(;a>=10;)a/=10;return Cd(a)}return a/=1e3,Cd(a)}function Dd(a,b,c,d){return b?"kelios sekundės":d?"kelių sekundžių":"kelias sekundes"}function Ed(a,b,c,d){return b?Gd(c)[0]:d?Gd(c)[1]:Gd(c)[2]}function Fd(a){return a%10===0||a>10&&20>a}function Gd(a){return Lg[a].split("_")}function Hd(a,b,c,d){var e=a+" ";return 1===a?e+Ed(a,b,c[0],d):b?e+(Fd(a)?Gd(c)[1]:Gd(c)[0]):d?e+Gd(c)[1]:e+(Fd(a)?Gd(c)[1]:Gd(c)[2])}function Id(a,b,c){return c?b%10===1&&11!==b?a[2]:a[3]:b%10===1&&11!==b?a[0]:a[1]}function Jd(a,b,c){return a+" "+Id(Mg[c],a,b)}function Kd(a,b,c){return Id(Mg[c],a,b)}function Ld(a,b){return b?"dažas sekundes":"dažām sekundēm"}function Md(a,b,c,d){var e="";if(b)switch(c){case"s":e="काही सेकंद";break;case"m":e="एक मिनिट";break;case"mm":e="%d मिनिटे";break;case"h":e="एक तास";break;case"hh":e="%d तास";break;case"d":e="एक दिवस";break;case"dd":e="%d दिवस";break;case"M":e="एक महिना";break;case"MM":e="%d महिने";break;case"y":e="एक वर्ष";break;case"yy":e="%d वर्षे"}else switch(c){case"s":e="काही सेकंदां";break;case"m":e="एका मिनिटा";break;case"mm":e="%d मिनिटां";break;case"h":e="एका तासा";break;case"hh":e="%d तासां";break;case"d":e="एका दिवसा";break;case"dd":e="%d दिवसां";break;case"M":e="एका महिन्या";break;case"MM":e="%d महिन्यां";break;case"y":e="एका वर्षा";break;case"yy":e="%d वर्षां"}return e.replace(/%d/i,a)}function Nd(a){return 5>a%10&&a%10>1&&~~(a/10)%10!==1}function Od(a,b,c){var d=a+" ";switch(c){case"m":return b?"minuta":"minutę";case"mm":return d+(Nd(a)?"minuty":"minut");case"h":return b?"godzina":"godzinę";case"hh":return d+(Nd(a)?"godziny":"godzin");case"MM":return d+(Nd(a)?"miesiące":"miesięcy");case"yy":return d+(Nd(a)?"lata":"lat")}} -//! moment.js locale configuration -//! locale : romanian (ro) -//! author : Vlad Gurdiga : https://github.com/gurdiga -//! author : Valentin Agachi : https://github.com/avaly -function Pd(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]} -//! moment.js locale configuration -//! locale : russian (ru) -//! author : Viktorminator : https://github.com/Viktorminator -//! Author : Menelion Elensúle : https://github.com/Oire -//! author : Коренберг Марк : https://github.com/socketpair -function Qd(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Rd(a,b,c){var d={mm:b?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===c?b?"минута":"минуту":a+" "+Qd(d[c],+a)}function Sd(a){return a>1&&5>a}function Td(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"pár sekúnd":"pár sekundami";case"m":return b?"minúta":d?"minútu":"minútou";case"mm":return b||d?e+(Sd(a)?"minúty":"minút"):e+"minútami";break;case"h":return b?"hodina":d?"hodinu":"hodinou";case"hh":return b||d?e+(Sd(a)?"hodiny":"hodín"):e+"hodinami";break;case"d":return b||d?"deň":"dňom";case"dd":return b||d?e+(Sd(a)?"dni":"dní"):e+"dňami";break;case"M":return b||d?"mesiac":"mesiacom";case"MM":return b||d?e+(Sd(a)?"mesiace":"mesiacov"):e+"mesiacmi";break;case"y":return b||d?"rok":"rokom";case"yy":return b||d?e+(Sd(a)?"roky":"rokov"):e+"rokmi"}} -//! moment.js locale configuration -//! locale : slovenian (sl) -//! author : Robert Sedovšek : https://github.com/sedovsek -function Ud(a,b,c,d){var e=a+" ";switch(c){case"s":return b||d?"nekaj sekund":"nekaj sekundami";case"m":return b?"ena minuta":"eno minuto";case"mm":return e+=1===a?b?"minuta":"minuto":2===a?b||d?"minuti":"minutama":5>a?b||d?"minute":"minutami":b||d?"minut":"minutami";case"h":return b?"ena ura":"eno uro";case"hh":return e+=1===a?b?"ura":"uro":2===a?b||d?"uri":"urama":5>a?b||d?"ure":"urami":b||d?"ur":"urami";case"d":return b||d?"en dan":"enim dnem";case"dd":return e+=1===a?b||d?"dan":"dnem":2===a?b||d?"dni":"dnevoma":b||d?"dni":"dnevi";case"M":return b||d?"en mesec":"enim mesecem";case"MM":return e+=1===a?b||d?"mesec":"mesecem":2===a?b||d?"meseca":"mesecema":5>a?b||d?"mesece":"meseci":b||d?"mesecev":"meseci";case"y":return b||d?"eno leto":"enim letom";case"yy":return e+=1===a?b||d?"leto":"letom":2===a?b||d?"leti":"letoma":5>a?b||d?"leta":"leti":b||d?"let":"leti"}}function Vd(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"leS":-1!==a.indexOf("jar")?b.slice(0,-3)+"waQ":-1!==a.indexOf("DIS")?b.slice(0,-3)+"nem":b+" pIq"}function Wd(a){var b=a;return b=-1!==a.indexOf("jaj")?b.slice(0,-3)+"Hu’":-1!==a.indexOf("jar")?b.slice(0,-3)+"wen":-1!==a.indexOf("DIS")?b.slice(0,-3)+"ben":b+" ret"}function Xd(a,b,c,d){var e=Yd(a);switch(c){case"mm":return e+" tup";case"hh":return e+" rep";case"dd":return e+" jaj";case"MM":return e+" jar";case"yy":return e+" DIS"}}function Yd(a){var b=Math.floor(a%1e3/100),c=Math.floor(a%100/10),d=a%10,e="";return b>0&&(e+=fh[b]+"vatlh"),c>0&&(e+=(""!==e?" ":"")+fh[c]+"maH"),d>0&&(e+=(""!==e?" ":"")+fh[d]),""===e?"pagh":e}function Zd(a,b,c,d){var e={s:["viensas secunds","'iensas secunds"],m:["'n míut","'iens míut"],mm:[a+" míuts",""+a+" míuts"],h:["'n þora","'iensa þora"],hh:[a+" þoras",""+a+" þoras"],d:["'n ziua","'iensa ziua"],dd:[a+" ziuas",""+a+" ziuas"],M:["'n mes","'iens mes"],MM:[a+" mesen",""+a+" mesen"],y:["'n ar","'iens ar"],yy:[a+" ars",""+a+" ars"]};return d?e[c][0]:b?e[c][0]:e[c][1]} -//! moment.js locale configuration -//! locale : ukrainian (uk) -//! author : zemlanin : https://github.com/zemlanin -//! Author : Menelion Elensúle : https://github.com/Oire -function $d(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function _d(a,b,c){var d={mm:b?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:b?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===c?b?"хвилина":"хвилину":"h"===c?b?"година":"годину":a+" "+$d(d[c],+a)}function ae(a,b){var c={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},d=/(\[[ВвУу]\]) ?dddd/.test(b)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function be(a){return function(){return a+"о"+(11===this.hours()?"б":"")+"] LT"}}var ce,de;de=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var ee=a.momentProperties=[],fe=!1,ge={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var he;he=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c};var ie,je,ke={},le={},me=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ne=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,oe={},pe={},qe=/\d/,re=/\d\d/,se=/\d{3}/,te=/\d{4}/,ue=/[+-]?\d{6}/,ve=/\d\d?/,we=/\d\d\d\d?/,xe=/\d\d\d\d\d\d?/,ye=/\d{1,3}/,ze=/\d{1,4}/,Ae=/[+-]?\d{1,6}/,Be=/\d+/,Ce=/[+-]?\d+/,De=/Z|[+-]\d\d:?\d\d/gi,Ee=/Z|[+-]\d\d(?::?\d\d)?/gi,Fe=/[+-]?\d+(\.\d{1,3})?/,Ge=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,He={},Ie={},Je=0,Ke=1,Le=2,Me=3,Ne=4,Oe=5,Pe=6,Qe=7,Re=8;je=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",Ce),W("YY",ve,re),W("YYYY",ze,te),W("YYYYY",Ae,ue),W("YYYYYY",Ae,ue),$(["YYYYY","YYYYYY"],Je),$("YYYY",function(b,c){c[Je]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[Je]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Je]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var bf=M("FullYear",!0);a.ISO_8601=function(){};var cf=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),df=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),ef=function(){return Date.now?Date.now():+new Date};Qa("Z",":"),Qa("ZZ",""),W("Z",Ee),W("ZZ",Ee),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ra(Ee,a)});var ff=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var gf=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,hf=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;db.fn=Oa.prototype;var jf=ib(1,"add"),kf=ib(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var lf=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pb("gggg","weekYear"),Pb("ggggg","weekYear"),Pb("GGGG","isoWeekYear"),Pb("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",Ce),W("g",Ce),W("GG",ve,re),W("gg",ve,re),W("GGGG",ze,te),W("gggg",ze,te),W("GGGGG",Ae,ue),W("ggggg",Ae,ue),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",qe),$("Q",function(a,b){b[Ke]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",ve),W("ww",ve,re),W("W",ve),W("WW",ve,re),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var mf={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",ve),W("DD",ve,re),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Le),$("Do",function(a,b){b[Le]=r(a.match(ve)[0],10)});var nf=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",ve),W("e",ve),W("E",ve),W("dd",function(a,b){return b.weekdaysMinRegex(a)}),W("ddd",function(a,b){return b.weekdaysShortRegex(a)}),W("dddd",function(a,b){return b.weekdaysRegex(a)}),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var of="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),pf="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),qf="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),rf=Ge,sf=Ge,tf=Ge;R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",ye),W("DDDD",se),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,oc),R("k",["kk",2],0,pc),R("hmm",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),qc("a",!0),qc("A",!1),J("hour","h"),W("a",rc),W("A",rc),W("H",ve),W("h",ve),W("HH",ve,re),W("hh",ve,re),W("hmm",we),W("hmmss",xe),W("Hmm",we),W("Hmmss",xe),$(["H","HH"],Me),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Me]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d,2)),b[Oe]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Me]=r(a.substr(0,d)),b[Ne]=r(a.substr(d,2)),b[Oe]=r(a.substr(e))});var uf=/[ap]\.?m?\.?/i,vf=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",ve),W("mm",ve,re),$(["m","mm"],Ne);var wf=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",ve),W("ss",ve,re),$(["s","ss"],Oe);var xf=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",ye,qe),W("SS",ye,re),W("SSS",ye,se);var yf;for(yf="SSSS";yf.length<=9;yf+="S")W(yf,Be);for(yf="S";yf.length<=9;yf+="S")$(yf,uc);var zf=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var Af=o.prototype;Af.add=jf,Af.calendar=kb,Af.clone=lb,Af.diff=sb,Af.endOf=Eb,Af.format=wb,Af.from=xb,Af.fromNow=yb,Af.to=zb,Af.toNow=Ab,Af.get=P,Af.invalidAt=Nb,Af.isAfter=mb,Af.isBefore=nb,Af.isBetween=ob,Af.isSame=pb,Af.isSameOrAfter=qb,Af.isSameOrBefore=rb,Af.isValid=Lb,Af.lang=lf,Af.locale=Bb,Af.localeData=Cb,Af.max=df,Af.min=cf,Af.parsingFlags=Mb,Af.set=P,Af.startOf=Db,Af.subtract=kf,Af.toArray=Ib,Af.toObject=Jb,Af.toDate=Hb,Af.toISOString=vb,Af.toJSON=Kb,Af.toString=ub,Af.unix=Gb,Af.valueOf=Fb,Af.creationData=Ob,Af.year=bf,Af.isLeapYear=ta,Af.weekYear=Qb,Af.isoWeekYear=Rb,Af.quarter=Af.quarters=Wb,Af.month=ha,Af.daysInMonth=ia,Af.week=Af.weeks=$b,Af.isoWeek=Af.isoWeeks=_b,Af.weeksInYear=Tb,Af.isoWeeksInYear=Sb,Af.date=nf,Af.day=Af.days=gc,Af.weekday=hc,Af.isoWeekday=ic,Af.dayOfYear=nc,Af.hour=Af.hours=vf,Af.minute=Af.minutes=wf,Af.second=Af.seconds=xf,Af.millisecond=Af.milliseconds=zf,Af.utcOffset=Ua,Af.utc=Wa,Af.local=Xa,Af.parseZone=Ya,Af.hasAlignedHourOffset=Za,Af.isDST=$a,Af.isDSTShifted=_a,Af.isLocal=ab,Af.isUtcOffset=bb,Af.isUtc=cb,Af.isUTC=cb,Af.zoneAbbr=vc,Af.zoneName=wc,Af.dates=u("dates accessor is deprecated. Use date instead.",nf),Af.months=u("months accessor is deprecated. Use month instead",ha),Af.years=u("years accessor is deprecated. Use year instead",bf),Af.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Va);var Bf=Af,Cf={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Df={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ef="Invalid date",Ff="%d",Gf=/\d{1,2}/,Hf={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},If=A.prototype;If._calendar=Cf,If.calendar=zc,If._longDateFormat=Df,If.longDateFormat=Ac,If._invalidDate=Ef,If.invalidDate=Bc,If._ordinal=Ff,If.ordinal=Cc,If._ordinalParse=Gf,If.preparse=Dc,If.postformat=Dc,If._relativeTime=Hf,If.relativeTime=Ec,If.pastFuture=Fc,If.set=y,If.months=ca,If._months=Te,If.monthsShort=da,If._monthsShort=Ue,If.monthsParse=fa,If._monthsRegex=We,If.monthsRegex=ka,If._monthsShortRegex=Ve,If.monthsShortRegex=ja,If.week=Xb,If._week=mf,If.firstDayOfYear=Zb,If.firstDayOfWeek=Yb,If.weekdays=bc,If._weekdays=of,If.weekdaysMin=dc,If._weekdaysMin=qf,If.weekdaysShort=cc,If._weekdaysShort=pf,If.weekdaysParse=fc,If._weekdaysRegex=rf,If.weekdaysRegex=jc,If._weekdaysShortRegex=sf,If.weekdaysShortRegex=kc,If._weekdaysMinRegex=tf,If.weekdaysMinRegex=lc,If.isPM=sc,If._meridiemParse=uf,If.meridiem=tc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var Jf=Math.abs,Kf=Yc("ms"),Lf=Yc("s"),Mf=Yc("m"),Nf=Yc("h"),Of=Yc("d"),Pf=Yc("w"),Qf=Yc("M"),Rf=Yc("y"),Sf=$c("milliseconds"),Tf=$c("seconds"),Uf=$c("minutes"),Vf=$c("hours"),Wf=$c("days"),Xf=$c("months"),Yf=$c("years"),Zf=Math.round,$f={s:45,m:45,h:22,d:26,M:11},_f=Math.abs,ag=Oa.prototype;ag.abs=Oc,ag.add=Qc,ag.subtract=Rc,ag.as=Wc,ag.asMilliseconds=Kf,ag.asSeconds=Lf,ag.asMinutes=Mf,ag.asHours=Nf,ag.asDays=Of,ag.asWeeks=Pf,ag.asMonths=Qf,ag.asYears=Rf,ag.valueOf=Xc,ag._bubble=Tc,ag.get=Zc,ag.milliseconds=Sf,ag.seconds=Tf,ag.minutes=Uf,ag.hours=Vf,ag.days=Wf,ag.weeks=_c,ag.months=Xf,ag.years=Yf,ag.humanize=dd,ag.toISOString=ed,ag.toString=ed,ag.toJSON=ed,ag.locale=Bb,ag.localeData=Cb,ag.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ed),ag.lang=lf,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",Ce),W("X",Fe),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}), -//! moment.js -//! version : 2.13.0 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -a.version="2.13.0",b(Ka),a.fn=Bf,a.min=Ma,a.max=Na,a.now=ef,a.utc=h,a.unix=xc,a.months=Jc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=db,a.isMoment=p,a.weekdays=Lc,a.parseZone=yc,a.localeData=H,a.isDuration=Pa,a.monthsShort=Kc,a.weekdaysMin=Nc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Mc,a.normalizeUnits=K,a.relativeTimeThreshold=cd,a.prototype=Bf;var bg=a,cg=(bg.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(a){return/^nm$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"vm":"VM":c?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[Môre om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),bg.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),dg={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},eg=(bg.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(a){return a.replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return dg[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return cg[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),bg.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}}),{1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"}),fg={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},gg=function(a){return 0===a?0:1===a?1:2===a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5},hg={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},ig=function(a){return function(b,c,d,e){var f=gg(b),g=hg[a][gg(b)];return 2===f&&(g=g[c?0:1]),g.replace(/%d/i,b)}},jg=["كانون الثاني يناير","شباط فبراير","آذار مارس","نيسان أبريل","أيار مايو","حزيران يونيو","تموز يوليو","آب أغسطس","أيلول سبتمبر","تشرين الأول أكتوبر","تشرين الثاني نوفمبر","كانون الأول ديسمبر"],kg=(bg.defineLocale("ar",{months:jg,monthsShort:jg,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(a){return"م"===a},meridiem:function(a,b,c){return 12>a?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:ig("s"),m:ig("m"),mm:ig("m"),h:ig("h"),hh:ig("h"),d:ig("d"),dd:ig("d"),M:ig("M"),MM:ig("M"),y:ig("y"),yy:ig("y")},preparse:function(a){return a.replace(/\u200f/g,"").replace(/[١٢٣٤٥٦٧٨٩٠]/g,function(a){return fg[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return eg[a]}).replace(/,/g,"،")},week:{dow:6,doy:12}}),{1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"}),lg=(bg.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"birneçə saniyyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(a){return/^(gündüz|axşam)$/.test(a)},meridiem:function(a,b,c){return 4>a?"gecə":12>a?"səhər":17>a?"gündüz":"axşam"},ordinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(a){if(0===a)return a+"-ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(kg[b]||kg[c]||kg[d])},week:{dow:1,doy:7}}),bg.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:gd,mm:gd,h:gd,hh:gd,d:"дзень",dd:gd,M:"месяц",MM:gd,y:"год",yy:gd},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(a){return/^(дня|вечара)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночы":12>a?"раніцы":17>a?"дня":"вечара"},ordinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a%10!==2&&a%10!==3||a%100===12||a%100===13?a+"-ы":a+"-і";case"D":return a+"-га";default:return a}},week:{dow:1,doy:7}}),bg.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[В изминалата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[В изминалия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),{1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"}),mg={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"},ng=(bg.defineLocale("bn",{months:"জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি".split("_"),weekdaysMin:"রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(a){return a.replace(/[১২৩৪৫৬৭৮৯০]/g,function(a){return mg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return lg[a]})},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(a,b){return 12===a&&(a=0),"রাত"===b&&a>=4||"দুপুর"===b&&5>a||"বিকাল"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"রাত":10>a?"সকাল":17>a?"দুপুর":20>a?"বিকাল":"রাত"},week:{dow:0,doy:6}}),{1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"}),og={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"},pg=(bg.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(a){return a.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,function(a){return og[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return ng[a]})},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(a,b){return 12===a&&(a=0),"མཚན་མོ"===b&&a>=4||"ཉིན་གུང"===b&&5>a||"དགོང་དག"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"མཚན་མོ":10>a?"ཞོགས་ཀས":17>a?"ཉིན་གུང":20>a?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}}),bg.defineLocale("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h[e]mm A",LTS:"h[e]mm:ss A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY h[e]mm A",LLLL:"dddd, D [a viz] MMMM YYYY h[e]mm A"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondennoù",m:"ur vunutenn",mm:hd,h:"un eur",hh:"%d eur",d:"un devezh",dd:hd,M:"ur miz",MM:hd,y:"ur bloaz",yy:id},ordinalParse:/\d{1,2}(añ|vet)/,ordinal:function(a){var b=1===a?"añ":"vet";return a+b},week:{dow:1,doy:4}}),bg.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:md,mm:md,h:md,hh:md,d:"dan",dd:md,M:"mjesec",MM:md,y:"godinu",yy:md},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.defineLocale("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd D MMMM YYYY H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(a,b){var c=1===a?"r":2===a?"n":3===a?"r":4===a?"t":"è";return("w"===b||"W"===b)&&(c="a"),a+c},week:{dow:1,doy:4}}),"leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_")),qg="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),rg=(bg.defineLocale("cs",{months:pg,monthsShort:qg,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(pg,qg),shortMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(qg),longMonthsParse:function(a){var b,c=[];for(b=0;12>b;b++)c[b]=new RegExp("^"+a[b]+"$","i");return c}(pg),weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:od,m:od,mm:od,h:od,hh:od,d:od,dd:od,M:od,MM:od,y:od,yy:od},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(a){var b=/сехет$/i.exec(a)?"рен":/ҫул$/i.exec(a)?"тан":"ран";return a+b},past:"%s каялла",s:"пӗр-ик ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},ordinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}}),bg.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},ordinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(a){var b=a,c="",d=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return b>20?c=40===b||50===b||60===b||80===b||100===b?"fed":"ain":b>0&&(c=d[b]),a+c},week:{dow:1,doy:4}}),bg.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY HH:mm"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:pd,mm:"%d Minuten",h:pd,hh:"%d Stunden",d:pd,dd:pd,M:pd,MM:pd,y:pd,yy:pd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:qd,mm:"%d Minuten",h:qd,hh:"%d Stunden",d:qd,dd:qd,M:qd,MM:qd,y:qd,yy:qd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"]),sg=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"],tg=(bg.defineLocale("dv",{months:rg,monthsShort:rg,weekdays:sg,weekdaysShort:sg,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(a){return"މފ"===a},meridiem:function(a,b,c){return 12>a?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(a){return a.replace(/،/g,",")},postformat:function(a){return a.replace(/,/g,"،")},week:{dow:7,doy:12}}),bg.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(a,b,c){return a>11?c?"μμ":"ΜΜ":c?"πμ":"ΠΜ"},isPM:function(a){return"μ"===(a+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){switch(this.day()){case 6:return"[το προηγούμενο] dddd [{}] LT";default:return"[την προηγούμενη] dddd [{}] LT"}},sameElse:"L"},calendar:function(a,b){var c=this._calendarEl[a],d=b&&b.hours();return w(c)&&(c=c.apply(b)),c.replace("{}",d%12===1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}}),bg.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),bg.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months", -y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"),weekdays:"Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato".split("_"),weekdaysShort:"Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Ĵa_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd, [la] D[-an de] MMMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(a){return"p"===a.charAt(0).toLowerCase()},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd [je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasinta] dddd [je] LT",sameElse:"L"},relativeTime:{future:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}}),"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_")),ug="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),vg=(bg.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?ug[a.month()]:tg[a.month()]},monthsParseExact:!0,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),bg.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:rd,m:rd,mm:rd,h:rd,hh:rd,d:rd,dd:"%d päeva",M:rd,MM:rd,y:rd,yy:rd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"}),wg={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"},xg=(bg.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(a){return/بعد از ظهر/.test(a)},meridiem:function(a,b,c){return 12>a?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چندین ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(a){return a.replace(/[۰-۹]/g,function(a){return wg[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return vg[a]}).replace(/,/g,"،")},ordinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}}),"nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" ")),yg=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",xg[7],xg[8],xg[9]],zg=(bg.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:sd,m:sd,mm:sd,h:sd,hh:sd,d:sd,dd:sd,M:sd,MM:sd,y:sd,yy:sd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",m:"ein minutt",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaði",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")}}),bg.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|e)/,ordinal:function(a){return a+(1===a?"er":"e")},week:{dow:1,doy:4}}),bg.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|)/,ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}}),"jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_")),Ag="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),Bg=(bg.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?Ag[a.month()]:zg[a.month()]},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"]),Cg=["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],Dg=["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],Eg=["Did","Dil","Dim","Dic","Dia","Dih","Dis"],Fg=["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],Gg=(bg.defineLocale("gd",{months:Bg,monthsShort:Cg,monthsParseExact:!0,weekdays:Dg,weekdaysShort:Eg,weekdaysMin:Fg,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},ordinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(a){var b=1===a?"d":a%10===2?"na":"mh";return a+b},week:{dow:1,doy:4}}),bg.defineLocale("gl",{months:"Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"),monthsShort:"Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.".split("_"),monthsParseExact:!0,weekdays:"Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mér._Xov._Ven._Sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mé_Xo_Ve_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd D MMMM YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:7}}),bg.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(a){return 2===a?"שעתיים":a+" שעות"},d:"יום",dd:function(a){return 2===a?"יומיים":a+" ימים"},M:"חודש",MM:function(a){return 2===a?"חודשיים":a+" חודשים"},y:"שנה",yy:function(a){return 2===a?"שנתיים":a%10===0&&10!==a?a+" שנה":a+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(a){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(a)},meridiem:function(a,b,c){return 5>a?"לפנות בוקר":10>a?"בבוקר":12>a?c?'לפנה"צ':"לפני הצהריים":18>a?c?'אחה"צ':"אחרי הצהריים":"בערב"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Hg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Ig=(bg.defineLocale("hi",{months:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Hg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Gg[a]})},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात"===b?4>a?a:a+12:"सुबह"===b?a:"दोपहर"===b?a>=10?a:a+12:"शाम"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात":10>a?"सुबह":17>a?"दोपहर":20>a?"शाम":"रात"},week:{dow:0,doy:6}}),bg.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:ud,mm:ud,h:ud,hh:ud,d:"dan",dd:ud,M:"mjesec",MM:ud,y:"godinu",yy:ud},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),"vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ")),Jg=(bg.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(a){return"u"===a.charAt(1).toLowerCase()},meridiem:function(a,b,c){return 12>a?c===!0?"de":"DE":c===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return wd.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return wd.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:vd,m:vd,mm:vd,h:vd,hh:vd,d:vd,dd:vd,M:vd,MM:vd,y:vd,yy:vd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(a){return/^(ցերեկվա|երեկոյան)$/.test(a)},meridiem:function(a){return 4>a?"գիշերվա":12>a?"առավոտվա":17>a?"ցերեկվա":"երեկոյան"},ordinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(a,b){switch(b){case"DDD":case"w":case"W":case"DDDo":return 1===a?a+"-ին":a+"-րդ";default:return a}},week:{dow:1,doy:7}}),bg.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(a,b){return 12===a&&(a=0),"pagi"===b?a:"siang"===b?a>=11?a:a+12:"sore"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"siang":19>a?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}}),bg.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:yd,m:yd,mm:yd,h:"klukkustund",hh:yd,d:yd,dd:yd,M:yd,MM:yd,y:yd,yy:yd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"Do_Lu_Ma_Me_Gi_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){switch(this.day()){case 0:return"[la scorsa] dddd [alle] LT";default:return"[lo scorso] dddd [alle] LT"}},sameElse:"L"},relativeTime:{future:function(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"alcuni secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),bg.defineLocale("ja",{months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"Ah時m分",LTS:"Ah時m分s秒",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah時m分",LLLL:"YYYY年M月D日Ah時m分 dddd"},meridiemParse:/午前|午後/i,isPM:function(a){return"午後"===a},meridiem:function(a,b,c){return 12>a?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},ordinalParse:/\d{1,2}日/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";default:return a}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}}),bg.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(a,b){return 12===a&&(a=0),"enjing"===b?a:"siyang"===b?a>=11?a:a+12:"sonten"===b||"ndalu"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"enjing":15>a?"siyang":19>a?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}}),bg.defineLocale("ka",{months:{standalone:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),format:"იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს".split("_")},monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(a){return/(წამი|წუთი|საათი|წელი)/.test(a)?a.replace(/ი$/,"ში"):a+"ში"},past:function(a){return/(წამი|წუთი|საათი|დღე|თვე)/.test(a)?a.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(a)?a.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(a){return 0===a?a:1===a?a+"-ლი":20>a||100>=a&&a%20===0||a%100===0?"მე-"+a:a+"-ე"},week:{dow:1,doy:7}}),{0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"}),Kg=(bg.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(Jg[a]||Jg[b]||Jg[c])},week:{dow:1,doy:7}}),bg.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysMin:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}}),bg.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 m분",LTS:"A h시 m분 s초",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h시 m분",LLLL:"YYYY년 MMMM D일 dddd A h시 m분"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"일분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},ordinalParse:/\d{1,2}일/,ordinal:"%d일",meridiemParse:/오전|오후/,isPM:function(a){return"오후"===a},meridiem:function(a,b,c){return 12>a?"오전":"오후"}}),{0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"}),Lg=(bg.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кече саат] LT",lastWeek:"[Өткен аптанын] dddd [күнү] [саат] LT", -sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},ordinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(a){var b=a%10,c=a>=100?100:null;return a+(Kg[a]||Kg[b]||Kg[c])},week:{dow:1,doy:7}}),bg.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:Ad,past:Bd,s:"e puer Sekonnen",m:zd,mm:"%d Minutten",h:zd,hh:"%d Stonnen",d:zd,dd:"%d Deeg",M:zd,MM:"%d Méint",y:zd,yy:"%d Joer"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(a){return"ຕອນແລງ"===a},meridiem:function(a,b,c){return 12>a?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},ordinalParse:/(ທີ່)\d{1,2}/,ordinal:function(a){return"ທີ່"+a}}),{m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"}),Mg=(bg.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_")},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:Dd,m:Ed,mm:Hd,h:Ed,hh:Hd,d:Ed,dd:Hd,M:Ed,MM:Hd,y:Ed,yy:Hd},ordinalParse:/\d{1,2}-oji/,ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}}),{m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")}),Ng=(bg.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:Ld,m:Kd,mm:Jd,h:Kd,hh:Jd,d:Kd,dd:Jd,M:Kd,MM:Jd,y:Kd,yy:Jd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=Ng.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+Ng.correctGrammaticalCase(a,d)}}),Og=(bg.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var a=["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",m:Ng.translate,mm:Ng.translate,h:Ng.translate,hh:Ng.translate,d:"dan",dd:Ng.translate,M:"mjesec",MM:Ng.translate,y:"godinu",yy:Ng.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"после %s",past:"пред %s",s:"неколку секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеци",y:"година",yy:"%d години"},ordinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}}),bg.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(a,b){return 12===a&&(a=0),"രാത്രി"===b&&a>=4||"ഉച്ച കഴിഞ്ഞ്"===b||"വൈകുന്നേരം"===b?a+12:a},meridiem:function(a,b,c){return 4>a?"രാത്രി":12>a?"രാവിലെ":17>a?"ഉച്ച കഴിഞ്ഞ്":20>a?"വൈകുന്നേരം":"രാത്രി"}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Pg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Qg=(bg.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:Md,m:Md,mm:Md,h:Md,hh:Md,d:Md,dd:Md,M:Md,MM:Md,y:Md,yy:Md},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Pg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Og[a]})},meridiemParse:/रात्री|सकाळी|दुपारी|सायंकाळी/,meridiemHour:function(a,b){return 12===a&&(a=0),"रात्री"===b?4>a?a:a+12:"सकाळी"===b?a:"दुपारी"===b?a>=10?a:a+12:"सायंकाळी"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"रात्री":10>a?"सकाळी":17>a?"दुपारी":20>a?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}}),bg.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}}),bg.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(a,b){return 12===a&&(a=0),"pagi"===b?a:"tengahari"===b?a>=11?a:a+12:"petang"===b||"malam"===b?a+12:void 0},meridiem:function(a,b,c){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}}),{1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"}),Rg={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"},Sg=(bg.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(a){return a.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,function(a){return Rg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Qg[a]})},week:{dow:1,doy:4}}),bg.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"}),Tg={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},Ug=(bg.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return Tg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Sg[a]})},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(a,b){return 12===a&&(a=0),"राति"===b?4>a?a:a+12:"बिहान"===b?a:"दिउँसो"===b?a>=10?a:a+12:"साँझ"===b?a+12:void 0},meridiem:function(a,b,c){return 3>a?"राति":12>a?"बिहान":16>a?"दिउँसो":20>a?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}}),"jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_")),Vg="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),Wg=(bg.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,b){return/-MMM-/.test(b)?Vg[a.month()]:Ug[a.month()]},monthsParseExact:!0,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}}),bg.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"sun_mån_tys_ons_tor_fre_lau".split("_"),weekdaysMin:"su_må_ty_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"}),Xg={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"},Yg=(bg.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(a){return a.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,function(a){return Xg[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return Wg[a]})},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(a,b){return 12===a&&(a=0),"ਰਾਤ"===b?4>a?a:a+12:"ਸਵੇਰ"===b?a:"ਦੁਪਹਿਰ"===b?a>=10?a:a+12:"ਸ਼ਾਮ"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"ਰਾਤ":10>a?"ਸਵੇਰ":17>a?"ਦੁਪਹਿਰ":20>a?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}}),"styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_")),Zg="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),$g=(bg.defineLocale("pl",{months:function(a,b){return""===b?"("+Zg[a.month()]+"|"+Yg[a.month()]+")":/D MMMM/.test(b)?Zg[a.month()]:Yg[a.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"nie_pon_wt_śr_czw_pt_sb".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:Od,mm:Od,h:Od,hh:Od,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:Od,y:"rok",yy:Od},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("pt-br",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº"}),bg.defineLocale("pt",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),bg.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",m:"un minut",mm:Pd,h:"o oră",hh:Pd,d:"o zi",dd:Pd,M:"o lună",MM:Pd,y:"un an",yy:Pd},week:{dow:1,doy:7}}),[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i]),_g=(bg.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:$g,longMonthsParse:$g,shortMonthsParse:$g,monthsRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i,monthsShortRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i,monthsStrictRegex:/^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i,monthsShortStrictRegex:/^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";switch(this.day()){case 0:return"[В следующее] dddd [в] LT";case 1:case 2:case 4:return"[В следующий] dddd [в] LT";case 3:case 5:case 6:return"[В следующую] dddd [в] LT"}},lastWeek:function(a){if(a.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:Rd,mm:Rd,h:"час",hh:Rd,d:"день",dd:Rd,M:"месяц",MM:Rd,y:"год",yy:Rd},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(a){return/^(дня|вечера)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночи":12>a?"утра":17>a?"дня":"вечера"},ordinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-й";case"D":return a+"-го";case"w":case"W":return a+"-я";default:return a}},week:{dow:1,doy:7}}),bg.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},ordinalParse:/\d{1,2} වැනි/,ordinal:function(a){return a+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(a){return"ප.ව."===a||"පස් වරු"===a},meridiem:function(a,b,c){return a>11?c?"ප.ව.":"පස් වරු":c?"පෙ.ව.":"පෙර වරු"}}),"január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_")),ah="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_"),bh=(bg.defineLocale("sk",{months:_g,monthsShort:ah,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:Td,m:Td,mm:Td,h:Td,hh:Td,d:Td,dd:Td,M:Td,MM:Td,y:Td,yy:Td},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT"; -case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:Ud,m:Ud,mm:Ud,h:Ud,hh:Ud,d:Ud,dd:Ud,M:Ud,MM:Ud,y:Ud,yy:Ud},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(a){return"M"===a.charAt(0)},meridiem:function(a,b,c){return 12>a?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{words:{m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=bh.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+bh.correctGrammaticalCase(a,d)}}),ch=(bg.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){var a=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",m:bh.translate,mm:bh.translate,h:bh.translate,hh:bh.translate,d:"дан",dd:bh.translate,M:"месец",MM:bh.translate,y:"годину",yy:bh.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),{words:{m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,b,c){var d=ch.words[c];return 1===c.length?b?d[0]:d[1]:a+" "+ch.correctGrammaticalCase(a,d)}}),dh=(bg.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var a=["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:ch.translate,mm:ch.translate,h:ch.translate,hh:ch.translate,d:"dan",dd:ch.translate,M:"mesec",MM:ch.translate,y:"godinu",yy:ch.translate},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),bg.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(a,b,c){return 11>a?"ekuseni":15>a?"emini":19>a?"entsambama":"ebusuku"},meridiemHour:function(a,b){return 12===a&&(a=0),"ekuseni"===b?a:"emini"===b?a>=11?a:a+12:"entsambama"===b||"ebusuku"===b?0===a?0:a+12:void 0},ordinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}}),bg.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinalParse:/\d{1,2}(e|a)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":"e";return a+c},week:{dow:1,doy:4}}),bg.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"masiku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}}),{1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"}),eh={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"},fh=(bg.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},ordinalParse:/\d{1,2}வது/,ordinal:function(a){return a+"வது"},preparse:function(a){return a.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,function(a){return eh[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return dh[a]})},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(a,b,c){return 2>a?" யாமம்":6>a?" வைகறை":10>a?" காலை":14>a?" நண்பகல்":18>a?" எற்பாடு":22>a?" மாலை":" யாமம்"},meridiemHour:function(a,b){return 12===a&&(a=0),"யாமம்"===b?2>a?a:a+12:"வைகறை"===b||"காலை"===b?a:"நண்பகல்"===b&&a>=10?a:a+12},week:{dow:0,doy:6}}),bg.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},ordinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(a,b){return 12===a&&(a=0),"రాత్రి"===b?4>a?a:a+12:"ఉదయం"===b?a:"మధ్యాహ్నం"===b?a>=10?a:a+12:"సాయంత్రం"===b?a+12:void 0},meridiem:function(a,b,c){return 4>a?"రాత్రి":10>a?"ఉదయం":17>a?"మధ్యాహ్నం":20>a?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}}),bg.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H นาฬิกา m นาที",LTS:"H นาฬิกา m นาที s วินาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H นาฬิกา m นาที",LLLL:"วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(a){return"หลังเที่ยง"===a},meridiem:function(a,b,c){return 12>a?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}}),bg.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),"pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_")),gh=(bg.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:Vd,past:Wd,s:"puS lup",m:"wa’ tup",mm:Xd,h:"wa’ rep",hh:Xd,d:"wa’ jaj",dd:Xd,M:"wa’ jar",MM:Xd,y:"wa’ DIS",yy:Xd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),{1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"}),hh=(bg.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinalParse:/\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,ordinal:function(a){if(0===a)return a+"'ıncı";var b=a%10,c=a%100-b,d=a>=100?100:null;return a+(gh[b]||gh[c]||gh[d])},week:{dow:1,doy:7}}),bg.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(a){return"d'o"===a.toLowerCase()},meridiem:function(a,b,c){return a>11?c?"d'o":"D'O":c?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:Zd,m:Zd,mm:Zd,h:Zd,hh:Zd,d:Zd,dd:Zd,M:Zd,MM:Zd,y:Zd,yy:Zd},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),bg.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}}),bg.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}}),bg.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:ae,weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:be("[Сьогодні "),nextDay:be("[Завтра "),lastDay:be("[Вчора "),nextWeek:be("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return be("[Минулої] dddd [").call(this);case 1:case 2:case 4:return be("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:_d,mm:_d,h:"годину",hh:_d,d:"день",dd:_d,M:"місяць",MM:_d,y:"рік",yy:_d},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(a){return/^(дня|вечора)$/.test(a)},meridiem:function(a,b,c){return 4>a?"ночі":12>a?"ранку":17>a?"дня":"вечора"},ordinalParse:/\d{1,2}-(й|го)/,ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-й";case"D":return a+"-го";default:return a}},week:{dow:1,doy:7}}),bg.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}}),bg.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(a){return/^ch$/i.test(a)},meridiem:function(a,b,c){return 12>a?c?"sa":"SA":c?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần rồi lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},ordinalParse:/\d{1,2}/,ordinal:function(a){return a},week:{dow:1,doy:4}}),bg.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}}),bg.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah点mm分",LTS:"Ah点m分s秒",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah点mm分",LLLL:"YYYY年MMMD日ddddAh点mm分",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah点mm分",llll:"YYYY年MMMD日ddddAh点mm分"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(a,b){return 12===a&&(a=0),"凌晨"===b||"早上"===b||"上午"===b?a:"下午"===b||"晚上"===b?a+12:a>=11?a:a+12},meridiem:function(a,b,c){var d=100*a+b;return 600>d?"凌晨":900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var a,b;return a=bg().startOf("week"),b=this.diff(a,"days")>=7?"[下]":"[本]",0===this.minutes()?b+"dddAh点整":b+"dddAh点mm"},lastWeek:function(){var a,b;return a=bg().startOf("week"),b=this.unix()=11?a:a+12:"下午"===b||"晚上"===b?a+12:void 0},meridiem:function(a,b,c){var d=100*a+b;return 900>d?"早上":1130>d?"上午":1230>d?"中午":1800>d?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinalParse:/\d{1,2}(日|月|週)/,ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"週";default:return a}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"1分鐘",mm:"%d分鐘",h:"1小時",hh:"%d小時",d:"1天",dd:"%d天",M:"1個月",MM:"%d個月",y:"1年",yy:"%d年"}}),bg);return hh.locale("en"),hh}); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment.min.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment.min.js deleted file mode 100644 index d301ddbb..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/moment.min.js +++ /dev/null @@ -1,7 +0,0 @@ -//! moment.js -//! version : 2.13.0 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return fd.apply(null,arguments)}function b(a){fd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in hd)d=hd[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),id===!1&&(id=!0,a.updateOffset(this),id=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(b,c){var d=!0;return g(function(){return null!=a.deprecationHandler&&a.deprecationHandler(null,b),d&&(t(b+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),d=!1),c.apply(this,arguments)},c)}function v(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),jd[b]||(t(c),jd[b]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!nd[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=ld._abbr,require("./locale/"+a),E(b)}catch(c){}return nd[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(ld=c)),ld._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=nd[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(nd[a]._config,b)):null!=b.parentLocale&&(null!=nd[b.parentLocale]?b=z(nd[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),nd[a]=new A(b),E(a),nd[a]):(delete nd[a],null)}function G(a,b){if(null!=b){var c;null!=nd[a]&&(b=z(nd[a]._config,b)),c=new A(b),c.parentLocale=nd[a],nd[a]=c,E(a)}else null!=nd[a]&&(null!=nd[a].parentLocale?nd[a]=nd[a].parentLocale:null!=nd[a]&&delete nd[a]);return nd[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ld;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return kd(nd)}function J(a,b){var c=a.toLowerCase();od[c]=od[c+"s"]=od[b]=a}function K(a){return"string"==typeof a?od[a]||od[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(sd[a]=e),b&&(sd[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(sd[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(pd);for(b=0,c=d.length;c>b;b++)sd[d[b]]?d[b]=sd[d[b]]:d[b]=S(d[b]);return function(b){var e,f="";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),rd[b]=rd[b]||T(b),rd[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(qd.lastIndex=0;d>=0&&qd.test(a);)a=a.replace(qd,c),qd.lastIndex=0,d-=1;return a}function W(a,b,c){Kd[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(Kd,a)?Kd[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;cd;++d)f=h([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:null):(e=md.call(this._longMonthsParse,g),-1!==e?e:null):"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:(e=md.call(this._longMonthsParse,g),-1!==e?e:null)):(e=md.call(this._longMonthsParse,g),-1!==e?e:(e=md.call(this._shortMonthsParse,g),-1!==e?e:null))}function fa(a,b,c){var d,e,f;if(this._monthsParseExact)return ea.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ga(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ha(b){return null!=b?(ga(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ia(){return ba(this.year(),this.month())}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ka(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function la(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function ma(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Nd]<0||c[Nd]>11?Nd:c[Od]<1||c[Od]>ba(c[Md],c[Nd])?Od:c[Pd]<0||c[Pd]>24||24===c[Pd]&&(0!==c[Qd]||0!==c[Rd]||0!==c[Sd])?Pd:c[Qd]<0||c[Qd]>59?Qd:c[Rd]<0||c[Rd]>59?Rd:c[Sd]<0||c[Sd]>999?Sd:-1,j(a)._overflowDayOfYear&&(Md>b||b>Od)&&(b=Od),j(a)._overflowWeeks&&-1===b&&(b=Td),j(a)._overflowWeekday&&-1===b&&(b=Ud),j(a).overflow=b),a}function na(a){var b,c,d,e,f,g,h=a._i,i=$d.exec(h)||_d.exec(h);if(i){for(j(a).iso=!0,b=0,c=be.length;c>b;b++)if(be[b][1].exec(i[1])){e=be[b][0],d=be[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=ce.length;c>b;b++)if(ce[b][1].exec(i[3])){f=(i[2]||" ")+ce[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!ae.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ca(a)}else a._isValid=!1}function oa(b){var c=de.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(na(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function pa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function qa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ra(a){return sa(a)?366:365}function sa(a){return a%4===0&&a%100!==0||a%400===0}function ta(){return sa(this.year())}function ua(a,b,c){var d=7+b-c,e=(7+qa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=ra(f)+j):j>ra(a)?(f=a+1,g=j-ra(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(ra(a)-d+e)/7}function ya(a,b,c){return null!=a?a:null!=b?b:c}function za(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function Aa(a){var b,c,d,e,f=[];if(!a._d){for(d=za(a),a._w&&null==a._a[Od]&&null==a._a[Nd]&&Ba(a),a._dayOfYear&&(e=ya(a._a[Md],d[Md]),a._dayOfYear>ra(e)&&(j(a)._overflowDayOfYear=!0),c=qa(e,0,a._dayOfYear),a._a[Nd]=c.getUTCMonth(),a._a[Od]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Pd]&&0===a._a[Qd]&&0===a._a[Rd]&&0===a._a[Sd]&&(a._nextDay=!0,a._a[Pd]=0),a._d=(a._useUTC?qa:pa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Pd]=24)}}function Ba(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ya(b.GG,a._a[Md],wa(Ka(),1,4).year),d=ya(b.W,1),e=ya(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ya(b.gg,a._a[Md],wa(Ka(),f,g).year),d=ya(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>xa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[Md]=h.year,a._dayOfYear=h.dayOfYear)}function Ca(b){if(b._f===a.ISO_8601)return void na(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(pd)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),sd[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Pd]<=12&&b._a[Pd]>0&&(j(b).bigHour=void 0),j(b).parsedDateParts=b._a.slice(0),j(b).meridiem=b._meridiem,b._a[Pd]=Da(b._locale,b._a[Pd],b._meridiem),Aa(b),ma(b)}function Da(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Ea(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function Fa(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),Aa(a)}}function Ga(a){var b=new o(ma(Ha(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ha(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(ma(b)):(c(e)?Ea(a):e?Ca(a):d(b)?a._d=b:Ia(a),k(a)||(a._d=null),a))}function Ia(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(f.valueOf()):"string"==typeof f?oa(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),Aa(b)):"object"==typeof f?Fa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ja(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Ga(f)}function Ka(a,b,c,d){return Ja(a,b,c,d,!1)}function La(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ka();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Ra(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(ie)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Sa(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?b.valueOf():Ka(b).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+f),a.updateOffset(e,!1),e):Ka(b).local()}function Ta(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ua(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Ra(Hd,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ta(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?jb(this,db(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ta(this):null!=b?this:NaN}function Va(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Wa(a){return this.utcOffset(0,a)}function Xa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ta(this),"m")),this}function Ya(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ra(Gd,this._i)),this}function Za(a){return this.isValid()?(a=a?Ka(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function $a(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ha(a),a._a){var b=a._isUTC?h(a._a):Ka(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ab(){return this.isValid()?!this._isUTC:!1}function bb(){return this.isValid()?this._isUTC:!1}function cb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function db(a,b){var c,d,e,g=a,h=null;return Pa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=je.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Od])*c,h:r(h[Pd])*c,m:r(h[Qd])*c,s:r(h[Rd])*c,ms:r(h[Sd])*c}):(h=ke.exec(a))?(c="-"===h[1]?-1:1,g={y:eb(h[2],c),M:eb(h[3],c),w:eb(h[4],c),d:eb(h[5],c),h:eb(h[6],c),m:eb(h[7],c),s:eb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=gb(Ka(g.from),Ka(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Oa(g),Pa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function eb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function fb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function gb(a,b){var c;return a.isValid()&&b.isValid()?(b=Sa(b,a),a.isBefore(b)?c=fb(a,b):(c=fb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function hb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function ib(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=db(c,d),jb(this,e,a),this}}function jb(b,c,d,e){var f=c._milliseconds,g=hb(c._days),h=hb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&ga(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function kb(a,b){var c=a||Ka(),d=Sa(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ka(c)))}function lb(){return new o(this)}function mb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function ub(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function vb(){var a=this.clone().utc();return 0f&&(b=f),Vb.call(this,a,b,c,d,e))}function Vb(a,b,c,d,e){var f=va(a,b,c,d,e),g=qa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Wb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Xb(a){return wa(a,this._week.dow,this._week.doy).week}function Yb(){return this._week.dow}function Zb(){return this._week.doy}function $b(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function _b(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ac(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function bc(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function cc(a){return this._weekdaysShort[a.day()]}function dc(a){return this._weekdaysMin[a.day()]}function ec(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=h([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function fc(a,b,c){var d,e,f;if(this._weekdaysParseExact)return ec.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=h([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function gc(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ac(a,this.localeData()),this.add(a-b,"d")):b}function hc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function ic(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function jc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex}function kc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function lc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function mc(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],i=[],j=[],k=[];for(b=0;7>b;b++)c=h([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),i.push(e),j.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),i.sort(a),j.sort(a),k.sort(a),b=0;7>b;b++)i[b]=Z(i[b]),j[b]=Z(j[b]),k[b]=Z(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function nc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oc(){return this.hours()%12||12}function pc(){return this.hours()||24}function qc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function rc(a,b){return b._meridiemParse}function sc(a){return"p"===(a+"").toLowerCase().charAt(0)}function tc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function uc(a,b){b[Sd]=r(1e3*("0."+a))}function vc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}function xc(a){return Ka(1e3*a)}function yc(){return Ka.apply(null,arguments).parseZone()}function zc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function Ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function Bc(){return this._invalidDate}function Cc(a){return this._ordinal.replace("%d",a)}function Dc(a){return a}function Ec(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function Fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function Gc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Hc(a,b,c){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return Gc(a,b,c,"month");var d,e=[];for(d=0;12>d;d++)e[d]=Gc(a,d,c,"month");return e}function Ic(a,b,c,d){"boolean"==typeof a?("number"==typeof b&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,"number"==typeof b&&(c=b,b=void 0),b=b||"");var e=H(),f=a?e._week.dow:0;if(null!=c)return Gc(b,(c+f)%7,d,"day");var g,h=[];for(g=0;7>g;g++)h[g]=Gc(b,(g+f)%7,d,"day");return h}function Jc(a,b){return Hc(a,b,"months")}function Kc(a,b){return Hc(a,b,"monthsShort")}function Lc(a,b,c){return Ic(a,b,c,"weekdays")}function Mc(a,b,c){return Ic(a,b,c,"weekdaysShort")}function Nc(a,b,c){return Ic(a,b,c,"weekdaysMin")}function Oc(){var a=this._data;return this._milliseconds=Le(this._milliseconds),this._days=Le(this._days),this._months=Le(this._months),a.milliseconds=Le(a.milliseconds),a.seconds=Le(a.seconds),a.minutes=Le(a.minutes),a.hours=Le(a.hours),a.months=Le(a.months),a.years=Le(a.years),this}function Pc(a,b,c,d){var e=db(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Qc(a,b){return Pc(this,a,b,1)}function Rc(a,b){return Pc(this,a,b,-1)}function Sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Sc(Vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Uc(g)),h+=e,g-=Sc(Vc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Uc(a){return 4800*a/146097}function Vc(a){return 146097*a/4800}function Wc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Yc(a){return function(){return this.as(a)}}function Zc(a){ -return a=K(a),this[a+"s"]()}function $c(a){return function(){return this._data[a]}}function _c(){return q(this.days()/7)}function ad(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function bd(a,b,c){var d=db(a).abs(),e=_e(d.as("s")),f=_e(d.as("m")),g=_e(d.as("h")),h=_e(d.as("d")),i=_e(d.as("M")),j=_e(d.as("y")),k=e=f&&["m"]||f=g&&["h"]||g=h&&["d"]||h=i&&["M"]||i=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,ad.apply(null,k)}function cd(a,b){return void 0===af[a]?!1:void 0===b?af[a]:(af[a]=b,!0)}function dd(a){var b=this.localeData(),c=bd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ed(){var a,b,c,d=bf(this._milliseconds)/1e3,e=bf(this._days),f=bf(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var fd,gd;gd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var hd=a.momentProperties=[],id=!1,jd={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var kd;kd=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c};var ld,md,nd={},od={},pd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,qd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,rd={},sd={},td=/\d/,ud=/\d\d/,vd=/\d{3}/,wd=/\d{4}/,xd=/[+-]?\d{6}/,yd=/\d\d?/,zd=/\d\d\d\d?/,Ad=/\d\d\d\d\d\d?/,Bd=/\d{1,3}/,Cd=/\d{1,4}/,Dd=/[+-]?\d{1,6}/,Ed=/\d+/,Fd=/[+-]?\d+/,Gd=/Z|[+-]\d\d:?\d\d/gi,Hd=/Z|[+-]\d\d(?::?\d\d)?/gi,Id=/[+-]?\d+(\.\d{1,3})?/,Jd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Kd={},Ld={},Md=0,Nd=1,Od=2,Pd=3,Qd=4,Rd=5,Sd=6,Td=7,Ud=8;md=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",Fd),W("YY",yd,ud),W("YYYY",Cd,wd),W("YYYYY",Dd,xd),W("YYYYYY",Dd,xd),$(["YYYYY","YYYYYY"],Md),$("YYYY",function(b,c){c[Md]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[Md]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Md]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var ee=M("FullYear",!0);a.ISO_8601=function(){};var fe=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),ge=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),he=function(){return Date.now?Date.now():+new Date};Qa("Z",":"),Qa("ZZ",""),W("Z",Hd),W("ZZ",Hd),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ra(Hd,a)});var ie=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var je=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ke=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;db.fn=Oa.prototype;var le=ib(1,"add"),me=ib(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ne=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pb("gggg","weekYear"),Pb("ggggg","weekYear"),Pb("GGGG","isoWeekYear"),Pb("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",Fd),W("g",Fd),W("GG",yd,ud),W("gg",yd,ud),W("GGGG",Cd,wd),W("gggg",Cd,wd),W("GGGGG",Dd,xd),W("ggggg",Dd,xd),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",td),$("Q",function(a,b){b[Nd]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",yd),W("ww",yd,ud),W("W",yd),W("WW",yd,ud),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var oe={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",yd),W("DD",yd,ud),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Od),$("Do",function(a,b){b[Od]=r(a.match(yd)[0],10)});var pe=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",yd),W("e",yd),W("E",yd),W("dd",function(a,b){return b.weekdaysMinRegex(a)}),W("ddd",function(a,b){return b.weekdaysShortRegex(a)}),W("dddd",function(a,b){return b.weekdaysRegex(a)}),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),re="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),se="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),te=Jd,ue=Jd,ve=Jd;R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",Bd),W("DDDD",vd),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,oc),R("k",["kk",2],0,pc),R("hmm",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),qc("a",!0),qc("A",!1),J("hour","h"),W("a",rc),W("A",rc),W("H",yd),W("h",yd),W("HH",yd,ud),W("hh",yd,ud),W("hmm",zd),W("hmmss",Ad),W("Hmm",zd),W("Hmmss",Ad),$(["H","HH"],Pd),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Pd]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e))});var we=/[ap]\.?m?\.?/i,xe=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",yd),W("mm",yd,ud),$(["m","mm"],Qd);var ye=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",yd),W("ss",yd,ud),$(["s","ss"],Rd);var ze=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",Bd,td),W("SS",Bd,ud),W("SSS",Bd,vd);var Ae;for(Ae="SSSS";Ae.length<=9;Ae+="S")W(Ae,Ed);for(Ae="S";Ae.length<=9;Ae+="S")$(Ae,uc);var Be=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var Ce=o.prototype;Ce.add=le,Ce.calendar=kb,Ce.clone=lb,Ce.diff=sb,Ce.endOf=Eb,Ce.format=wb,Ce.from=xb,Ce.fromNow=yb,Ce.to=zb,Ce.toNow=Ab,Ce.get=P,Ce.invalidAt=Nb,Ce.isAfter=mb,Ce.isBefore=nb,Ce.isBetween=ob,Ce.isSame=pb,Ce.isSameOrAfter=qb,Ce.isSameOrBefore=rb,Ce.isValid=Lb,Ce.lang=ne,Ce.locale=Bb,Ce.localeData=Cb,Ce.max=ge,Ce.min=fe,Ce.parsingFlags=Mb,Ce.set=P,Ce.startOf=Db,Ce.subtract=me,Ce.toArray=Ib,Ce.toObject=Jb,Ce.toDate=Hb,Ce.toISOString=vb,Ce.toJSON=Kb,Ce.toString=ub,Ce.unix=Gb,Ce.valueOf=Fb,Ce.creationData=Ob,Ce.year=ee,Ce.isLeapYear=ta,Ce.weekYear=Qb,Ce.isoWeekYear=Rb,Ce.quarter=Ce.quarters=Wb,Ce.month=ha,Ce.daysInMonth=ia,Ce.week=Ce.weeks=$b,Ce.isoWeek=Ce.isoWeeks=_b,Ce.weeksInYear=Tb,Ce.isoWeeksInYear=Sb,Ce.date=pe,Ce.day=Ce.days=gc,Ce.weekday=hc,Ce.isoWeekday=ic,Ce.dayOfYear=nc,Ce.hour=Ce.hours=xe,Ce.minute=Ce.minutes=ye,Ce.second=Ce.seconds=ze,Ce.millisecond=Ce.milliseconds=Be,Ce.utcOffset=Ua,Ce.utc=Wa,Ce.local=Xa,Ce.parseZone=Ya,Ce.hasAlignedHourOffset=Za,Ce.isDST=$a,Ce.isDSTShifted=_a,Ce.isLocal=ab,Ce.isUtcOffset=bb,Ce.isUtc=cb,Ce.isUTC=cb,Ce.zoneAbbr=vc,Ce.zoneName=wc,Ce.dates=u("dates accessor is deprecated. Use date instead.",pe),Ce.months=u("months accessor is deprecated. Use month instead",ha),Ce.years=u("years accessor is deprecated. Use year instead",ee),Ce.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Va);var De=Ce,Ee={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Fe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ge="Invalid date",He="%d",Ie=/\d{1,2}/,Je={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Ke=A.prototype;Ke._calendar=Ee,Ke.calendar=zc,Ke._longDateFormat=Fe,Ke.longDateFormat=Ac,Ke._invalidDate=Ge,Ke.invalidDate=Bc,Ke._ordinal=He,Ke.ordinal=Cc,Ke._ordinalParse=Ie,Ke.preparse=Dc,Ke.postformat=Dc,Ke._relativeTime=Je,Ke.relativeTime=Ec,Ke.pastFuture=Fc,Ke.set=y,Ke.months=ca,Ke._months=Wd,Ke.monthsShort=da,Ke._monthsShort=Xd,Ke.monthsParse=fa,Ke._monthsRegex=Zd,Ke.monthsRegex=ka,Ke._monthsShortRegex=Yd,Ke.monthsShortRegex=ja,Ke.week=Xb,Ke._week=oe,Ke.firstDayOfYear=Zb,Ke.firstDayOfWeek=Yb,Ke.weekdays=bc,Ke._weekdays=qe,Ke.weekdaysMin=dc,Ke._weekdaysMin=se,Ke.weekdaysShort=cc,Ke._weekdaysShort=re,Ke.weekdaysParse=fc,Ke._weekdaysRegex=te,Ke.weekdaysRegex=jc,Ke._weekdaysShortRegex=ue,Ke.weekdaysShortRegex=kc,Ke._weekdaysMinRegex=ve,Ke.weekdaysMinRegex=lc,Ke.isPM=sc,Ke._meridiemParse=we,Ke.meridiem=tc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var Le=Math.abs,Me=Yc("ms"),Ne=Yc("s"),Oe=Yc("m"),Pe=Yc("h"),Qe=Yc("d"),Re=Yc("w"),Se=Yc("M"),Te=Yc("y"),Ue=$c("milliseconds"),Ve=$c("seconds"),We=$c("minutes"),Xe=$c("hours"),Ye=$c("days"),Ze=$c("months"),$e=$c("years"),_e=Math.round,af={s:45,m:45,h:22,d:26,M:11},bf=Math.abs,cf=Oa.prototype;cf.abs=Oc,cf.add=Qc,cf.subtract=Rc,cf.as=Wc,cf.asMilliseconds=Me,cf.asSeconds=Ne,cf.asMinutes=Oe,cf.asHours=Pe,cf.asDays=Qe,cf.asWeeks=Re,cf.asMonths=Se,cf.asYears=Te,cf.valueOf=Xc,cf._bubble=Tc,cf.get=Zc,cf.milliseconds=Ue,cf.seconds=Ve,cf.minutes=We,cf.hours=Xe,cf.days=Ye,cf.weeks=_c,cf.months=Ze,cf.years=$e,cf.humanize=dd,cf.toISOString=ed,cf.toString=ed,cf.toJSON=ed,cf.locale=Bb,cf.localeData=Cb,cf.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ed),cf.lang=ne,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",Fd),W("X",Id),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),a.version="2.13.0",b(Ka),a.fn=De,a.min=Ma,a.max=Na,a.now=he,a.utc=h,a.unix=xc,a.months=Jc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=db,a.isMoment=p,a.weekdays=Lc,a.parseZone=yc,a.localeData=H,a.isDuration=Pa,a.monthsShort=Kc,a.weekdaysMin=Nc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Mc,a.normalizeUnits=K,a.relativeTimeThreshold=cd,a.prototype=De;var df=a;return df}); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/tests.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/tests.js deleted file mode 100644 index baa29e5d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/min/tests.js +++ /dev/null @@ -1,72632 +0,0 @@ - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('af'); - - test('parse', function (assert) { - var tests = 'Januarie Jan_Februarie Feb_Maart Mar_April Apr_Mei Mei_Junie Jun_Julie Jul_Augustus Aug_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sondag, Februarie 14de 2010, 3:25:50 nm'], - ['ddd, hA', 'Son, 3NM'], - ['M Mo MM MMMM MMM', '2 2de 02 Februarie Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de Sondag Son So'], - ['DDD DDDo DDDD', '45 45ste 045'], - ['w wo ww', '6 6de 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'nm NM'], - ['[the] DDDo [day of the year]', 'the 45ste day of the year'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Februarie 2010'], - ['LLL', '14 Februarie 2010 15:25'], - ['LLLL', 'Sondag, 14 Februarie 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Son, 14 Feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14de', '14de'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ste', '24ste'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste'); - }); - - test('format month', function (assert) { - var expected = 'Januarie Jan_Februarie Feb_Maart Mar_April Apr_Mei Mei_Junie Jun_Julie Jul_Augustus Aug_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sondag Son So_Maandag Maa Ma_Dinsdag Din Di_Woensdag Woe Wo_Donderdag Don Do_Vrydag Vry Vr_Saterdag Sat Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '\'n paar sekondes', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '\'n minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '\'n minuut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minute', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '\'n uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '\'n uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ure', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ure', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ure', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '\'n dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '\'n dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dae', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '\'n dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dae', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dae', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '\'n maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '\'n maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '\'n maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maande', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maande', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maande', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '\'n maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maande', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '\'n jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '\'n jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'oor \'n paar sekondes', 'prefix'); - assert.equal(moment(0).from(30000), '\'n paar sekondes gelede', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), '\'n paar sekondes gelede', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'oor \'n paar sekondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'oor 5 dae', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Vandag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Vandag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Vandag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Môre om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Vandag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Gister om 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Laas] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Laas] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Laas] dddd [om] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ste', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1ste', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1ste', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2de', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ar-ma'); - - test('parse', function (assert) { - var tests = 'يناير:يناير_فبراير:فبراير_مارس:مارس_أبريل:أبريل_ماي:ماي_يونيو:يونيو_يوليوز:يوليوز_غشت:غشت_شتنبر:شتنبر_أكتوبر:أكتوبر_نونبر:نونبر_دجنبر:دجنبر'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(':'); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد, فبراير 14 2010, 3:25:50 pm'], - ['ddd, hA', 'احد, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 فبراير فبراير'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 الأحد احد ح'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 فبراير 2010'], - ['LLL', '14 فبراير 2010 15:25'], - ['LLLL', 'الأحد 14 فبراير 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 فبراير 2010'], - ['lll', '14 فبراير 2010 15:25'], - ['llll', 'احد 14 فبراير 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_ماي ماي_يونيو يونيو_يوليوز يوليوز_غشت غشت_شتنبر شتنبر_أكتوبر أكتوبر_نونبر نونبر_دجنبر دجنبر'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'الأحد احد ح_الإتنين اتنين ن_الثلاثاء ثلاثاء ث_الأربعاء اربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ثوان', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'دقيقة', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'دقيقة', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 دقائق', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 دقائق', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ساعة', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ساعة', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ساعات', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ساعات', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ساعات', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'يوم', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'يوم', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 أيام', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'يوم', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 أيام', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 أيام', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'شهر', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'شهر', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'شهر', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 أشهر', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 أشهر', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 أشهر', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'شهر', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 أشهر', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'سنة', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 سنوات', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'سنة', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 سنوات', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'في ثوان', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ ثوان', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'منذ ثوان', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'في ثوان', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'في 5 أيام', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'اليوم على الساعة 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم على الساعة 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم على الساعة 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'غدا على الساعة 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم على الساعة 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس على الساعة 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ar-sa'); - - test('parse', function (assert) { - var tests = 'يناير:يناير_فبراير:فبراير_مارس:مارس_أبريل:أبريل_مايو:مايو_يونيو:يونيو_يوليو:يوليو_أغسطس:أغسطس_سبتمبر:سبتمبر_أكتوبر:أكتوبر_نوفمبر:نوفمبر_ديسمبر:ديسمبر'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month()); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(':'); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، فبراير ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'], - ['ddd, hA', 'أحد، ٣م'], - ['M Mo MM MMMM MMM', '٢ ٢ ٠٢ فبراير فبراير'], - ['YYYY YY', '٢٠١٠ ١٠'], - ['D Do DD', '١٤ ١٤ ١٤'], - ['d do dddd ddd dd', '٠ ٠ الأحد أحد ح'], - ['DDD DDDo DDDD', '٤٥ ٤٥ ٠٤٥'], - ['w wo ww', '٨ ٨ ٠٨'], - ['h hh', '٣ ٠٣'], - ['H HH', '١٥ ١٥'], - ['m mm', '٢٥ ٢٥'], - ['s ss', '٥٠ ٥٠'], - ['a A', 'م م'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['LT', '١٥:٢٥'], - ['LTS', '١٥:٢٥:٥٠'], - ['L', '١٤/٠٢/٢٠١٠'], - ['LL', '١٤ فبراير ٢٠١٠'], - ['LLL', '١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['LLLL', 'الأحد ١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['l', '١٤/٢/٢٠١٠'], - ['ll', '١٤ فبراير ٢٠١٠'], - ['lll', '١٤ فبراير ٢٠١٠ ١٥:٢٥'], - ['llll', 'أحد ١٤ فبراير ٢٠١٠ ١٥:٢٥'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '١', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '٢', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '٣', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '٤', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '٥', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '٦', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '٧', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '٨', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '٩', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '١٠', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '١١', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '١٢', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '١٣', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '١٤', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '١٥', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '١٦', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '١٧', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '١٨', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '١٩', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '٢٠', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '٢١', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '٢٢', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '٢٣', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '٢٤', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '٢٥', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '٢٦', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '٢٧', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '٢٨', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '٢٩', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '٣٠', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '٣١', '31'); - }); - - test('format month', function (assert) { - var expected = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_مايو مايو_يونيو يونيو_يوليو يوليو_أغسطس أغسطس_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'الأحد أحد ح_الإثنين إثنين ن_الثلاثاء ثلاثاء ث_الأربعاء أربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ثوان', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'دقيقة', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'دقيقة', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '٢ دقائق', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '٤٤ دقائق', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ساعة', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ساعة', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '٢ ساعات', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '٥ ساعات', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '٢١ ساعات', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'يوم', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'يوم', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '٢ أيام', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'يوم', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '٥ أيام', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '٢٥ أيام', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'شهر', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'شهر', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'شهر', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '٢ أشهر', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '٢ أشهر', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '٣ أشهر', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'شهر', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '٥ أشهر', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'سنة', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '٢ سنوات', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'سنة', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '٥ سنوات', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'في ثوان', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ ثوان', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'منذ ثوان', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'في ثوان', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'في ٥ أيام', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'اليوم على الساعة ١٢:٠٠', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم على الساعة ١٢:٢٥', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم على الساعة ١٣:٠٠', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'غدا على الساعة ١٢:٠٠', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم على الساعة ١١:٠٠', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس على الساعة ١٢:٠٠', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '٢٠٠٣ ١ ٦', 'Saturday of week 1 of 2003 parsed should be formatted as 2003 1 6'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '٢٠٠٣ ١ ٠', '1st day of week 1 of 2003 parsed should be formatted as 2003 1 0'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '١ ٠١ ١', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '١ ٠١ ١', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '٢ ٠٢ ٢', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '٢ ٠٢ ٢', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '٣ ٠٣ ٣', 'Jan 14 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ar-tn'); - - test('parse', function (assert) { - var tests = 'جانفي:جانفي_فيفري:فيفري_مارس:مارس_أفريل:أفريل_ماي:ماي_جوان:جوان_جويلية:جويلية_أوت:أوت_سبتمبر:سبتمبر_أكتوبر:أكتوبر_نوفمبر:نوفمبر_ديسمبر:ديسمبر'.split('_'), - i; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(':'); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد, فيفري 14 2010, 3:25:50 pm'], - ['ddd, hA', 'أحد, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 فيفري فيفري'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 الأحد أحد ح'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 فيفري 2010'], - ['LLL', '14 فيفري 2010 15:25'], - ['LLLL', 'الأحد 14 فيفري 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 فيفري 2010'], - ['lll', '14 فيفري 2010 15:25'], - ['llll', 'أحد 14 فيفري 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'جانفي جانفي_فيفري فيفري_مارس مارس_أفريل أفريل_ماي ماي_جوان جوان_جويلية جويلية_أوت أوت_سبتمبر سبتمبر_أكتوبر أكتوبر_نوفمبر نوفمبر_ديسمبر ديسمبر'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'الأحد أحد ح_الإثنين إثنين ن_الثلاثاء ثلاثاء ث_الأربعاء أربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 44 - }), true), 'ثوان', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 45 - }), true), 'دقيقة', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 89 - }), true), 'دقيقة', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 90 - }), true), '2 دقائق', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 44 - }), true), '44 دقائق', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 45 - }), true), 'ساعة', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 89 - }), true), 'ساعة', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 90 - }), true), '2 ساعات', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 5 - }), true), '5 ساعات', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 21 - }), true), '21 ساعات', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 22 - }), true), 'يوم', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 35 - }), true), 'يوم', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 36 - }), true), '2 أيام', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 1 - }), true), 'يوم', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 5 - }), true), '5 أيام', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 25 - }), true), '25 أيام', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 26 - }), true), 'شهر', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 30 - }), true), 'شهر', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 43 - }), true), 'شهر', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 46 - }), true), '2 أشهر', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 74 - }), true), '2 أشهر', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 76 - }), true), '3 أشهر', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 1 - }), true), 'شهر', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 5 - }), true), '5 أشهر', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 345 - }), true), 'سنة', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 548 - }), true), '2 سنوات', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 1 - }), true), 'سنة', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 5 - }), true), '5 سنوات', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'في ثوان', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ ثوان', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'منذ ثوان', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({ - s: 30 - }).fromNow(), 'في ثوان', 'in a few seconds'); - assert.equal(moment().add({ - d: 5 - }).fromNow(), 'في 5 أيام', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'اليوم على الساعة 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم على الساعة 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم على الساعة 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'غدا على الساعة 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم على الساعة 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس على الساعة 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({ - d: i - }); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({ - d: i - }); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [على الساعة] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({ - w: 1 - }), - weeksFromNow = moment().add({ - w: 1 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({ - w: 2 - }); - weeksFromNow = moment().add({ - w: 2 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ar'); - - var months = [ - 'كانون الثاني يناير', - 'شباط فبراير', - 'آذار مارس', - 'نيسان أبريل', - 'أيار مايو', - 'حزيران يونيو', - 'تموز يوليو', - 'آب أغسطس', - 'أيلول سبتمبر', - 'تشرين الأول أكتوبر', - 'تشرين الثاني نوفمبر', - 'كانون الأول ديسمبر' - ]; - - test('parse', function (assert) { - var tests = months, i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، شباط فبراير ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'], - ['ddd, hA', 'أحد، ٣م'], - ['M Mo MM MMMM MMM', '٢ ٢ ٠٢ شباط فبراير شباط فبراير'], - ['YYYY YY', '٢٠١٠ ١٠'], - ['D Do DD', '١٤ ١٤ ١٤'], - ['d do dddd ddd dd', '٠ ٠ الأحد أحد ح'], - ['DDD DDDo DDDD', '٤٥ ٤٥ ٠٤٥'], - ['w wo ww', '٨ ٨ ٠٨'], - ['h hh', '٣ ٠٣'], - ['H HH', '١٥ ١٥'], - ['m mm', '٢٥ ٢٥'], - ['s ss', '٥٠ ٥٠'], - ['a A', 'م م'], - ['[the] DDDo [day of the year]', 'the ٤٥ day of the year'], - ['LT', '١٥:٢٥'], - ['LTS', '١٥:٢٥:٥٠'], - ['L', '١٤/\u200f٢/\u200f٢٠١٠'], - ['LL', '١٤ شباط فبراير ٢٠١٠'], - ['LLL', '١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'], - ['LLLL', 'الأحد ١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'], - ['l', '١٤/\u200f٢/\u200f٢٠١٠'], - ['ll', '١٤ شباط فبراير ٢٠١٠'], - ['lll', '١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'], - ['llll', 'أحد ١٤ شباط فبراير ٢٠١٠ ١٥:٢٥'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '١', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '٢', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '٣', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '٤', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '٥', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '٦', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '٧', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '٨', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '٩', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '١٠', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '١١', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '١٢', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '١٣', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '١٤', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '١٥', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '١٦', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '١٧', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '١٨', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '١٩', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '٢٠', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '٢١', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '٢٢', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '٢٣', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '٢٤', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '٢٥', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '٢٦', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '٢٧', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '٢٨', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '٢٩', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '٣٠', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '٣١', '31'); - }); - - test('format month', function (assert) { - var expected = months, i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i], expected[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'الأحد أحد ح_الإثنين إثنين ن_الثلاثاء ثلاثاء ث_الأربعاء أربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '٤٤ ثانية', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'دقيقة واحدة', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'دقيقة واحدة', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'دقيقتان', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '٤٤ دقيقة', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ساعة واحدة', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ساعة واحدة', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'ساعتان', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '٥ ساعات', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '٢١ ساعة', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'يوم واحد', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'يوم واحد', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'يومان', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'يوم واحد', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '٥ أيام', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '٢٥ يومًا', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'شهر واحد', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'شهر واحد', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'شهر واحد', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'شهران', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'شهران', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '٣ أشهر', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'شهر واحد', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '٥ أشهر', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'عام واحد', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'عامان', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'عام واحد', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '٥ أعوام', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'بعد ٣٠ ثانية', 'prefix'); - assert.equal(moment(0).from(30000), 'منذ ٣٠ ثانية', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'منذ ثانية واحدة', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'بعد ٣٠ ثانية', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'بعد ٥ أيام', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'اليوم عند الساعة ١٢:٠٠', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'اليوم عند الساعة ١٢:٢٥', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'اليوم عند الساعة ١٣:٠٠', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'غدًا عند الساعة ١٢:٠٠', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'اليوم عند الساعة ١١:٠٠', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'أمس عند الساعة ١٢:٠٠', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [عند الساعة] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [عند الساعة] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [عند الساعة] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [عند الساعة] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [عند الساعة] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [عند الساعة] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting wednesday custom', function (assert) { - assert.equal(moment('2003 1 6', 'gggg w d').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 0', 'gggg w e').format('YYYY-MM-DD'), '٢٠٠٢-١٢-٢٨', 'Week 1 of 2003 should be Dec 28 2002'); - assert.equal(moment('2003 1 6', 'gggg w d').format('gggg w d'), '٢٠٠٣ ١ ٦', 'Saturday of week 1 of 2003 parsed should be formatted as 2003 1 6'); - assert.equal(moment('2003 1 0', 'gggg w e').format('gggg w e'), '٢٠٠٣ ١ ٠', '1st day of week 1 of 2003 parsed should be formatted as 2003 1 0'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '١ ٠١ ١', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '١ ٠١ ١', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '٢ ٠٢ ٢', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '٢ ٠٢ ٢', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '٣ ٠٣ ٣', 'Jan 14 2012 should be week 3'); - }); - - test('no leading zeros in long date formats', function (assert) { - var i, j, longDateStr, shortDateStr; - for (i = 1; i <= 9; ++i) { - for (j = 1; j <= 9; ++j) { - longDateStr = moment([2014, i, j]).format('L'); - shortDateStr = moment([2014, i, j]).format('l'); - assert.equal(longDateStr, shortDateStr, 'should not have leading zeros in month or day'); - } - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('az'); - - test('parse', function (assert) { - var tests = 'yanvar yan_fevral fev_mart mar_Aprel apr_may may_iyun iyn_iyul iyl_Avqust avq_sentyabr sen_oktyabr okt_noyabr noy_dekabr dek'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, D MMMM YYYY, HH:mm:ss', 'Bazar, 14 fevral 2010, 15:25:50'], - ['ddd, A h', 'Baz, gündüz 3'], - ['M Mo MM MMMM MMM', '2 2-nci 02 fevral fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-üncü 14'], - ['d do dddd ddd dd', '0 0-ıncı Bazar Baz Bz'], - ['DDD DDDo DDDD', '45 45-inci 045'], - ['w wo ww', '7 7-nci 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'gündüz gündüz'], - ['[ilin] DDDo [günü]', 'ilin 45-inci günü'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 fevral 2010'], - ['LLL', '14 fevral 2010 15:25'], - ['LLLL', 'Bazar, 14 fevral 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 fev 2010'], - ['lll', '14 fev 2010 15:25'], - ['llll', 'Baz, 14 fev 2010 15:25'] - ], - DDDo = [ - [359, '360-ıncı'], - [199, '200-üncü'], - [149, '150-nci'] - ], - dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - DDDoDt, - i; - - for (i = 0; i < a.length; i++) { - assert.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - for (i = 0; i < DDDo.length; i++) { - DDDoDt = moment([2010]); - assert.equal(DDDoDt.add(DDDo[i][0], 'days').format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-inci', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-nci', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-üncü', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-üncü', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-inci', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-ncı', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-nci', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-inci', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-uncu', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-uncu', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-inci', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-nci', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-üncü', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-üncü', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-inci', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-ncı', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-nci', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-inci', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-uncu', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-nci', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-inci', '21th'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-nci', '22th'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-üncü', '23th'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-üncü', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-inci', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ncı', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-nci', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-inci', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-uncu', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-uncu', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-inci', '31st'); - }); - - test('format month', function (assert) { - var expected = 'yanvar yan_fevral fev_mart mar_aprel apr_may may_iyun iyn_iyul iyl_avqust avq_sentyabr sen_oktyabr okt_noyabr noy_dekabr dek'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Bazar Baz Bz_Bazar ertəsi BzE BE_Çərşənbə axşamı ÇAx ÇA_Çərşənbə Çər Çə_Cümə axşamı CAx CA_Cümə Cüm Cü_Şənbə Şən Şə'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'birneçə saniyyə', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'bir dəqiqə', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'bir dəqiqə', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 dəqiqə', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 dəqiqə', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'bir saat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'bir saat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 saat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 saat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 saat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'bir gün', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'bir gün', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 gün', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'bir gün', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 gün', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 gün', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'bir ay', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'bir ay', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ay', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ay', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ay', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'bir ay', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ay', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bir il', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 il', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bir il', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 il', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'birneçə saniyyə sonra', 'prefix'); - assert.equal(moment(0).from(30000), 'birneçə saniyyə əvvəl', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'birneçə saniyyə əvvəl', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'birneçə saniyyə sonra', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 gün sonra', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'bugün saat 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sabah saat 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'dünən 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[gələn həftə] dddd [saat] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[keçən həftə] dddd [saat] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-inci', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-inci', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-nci', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-nci', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-üncü', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('be'); - - test('parse', function (assert) { - var tests = 'студзень студ_люты лют_сакавік сак_красавік крас_травень трав_чэрвень чэрв_ліпень ліп_жнівень жнів_верасень вер_кастрычнік каст_лістапад ліст_снежань снеж'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'нядзеля, 14-га лютага 2010, 15:25:50'], - ['ddd, h A', 'нд, 3 дня'], - ['M Mo MM MMMM MMM', '2 2-і 02 люты лют'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-га 14'], - ['d do dddd ddd dd', '0 0-ы нядзеля нд нд'], - ['DDD DDDo DDDD', '45 45-ы 045'], - ['w wo ww', '7 7-ы 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'дня дня'], - ['DDDo [дзень года]', '45-ы дзень года'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 лютага 2010 г.'], - ['LLL', '14 лютага 2010 г., 15:25'], - ['LLLL', 'нядзеля, 14 лютага 2010 г., 15:25'], - ['l', '14.2.2010'], - ['ll', '14 лют 2010 г.'], - ['lll', '14 лют 2010 г., 15:25'], - ['llll', 'нд, 14 лют 2010 г., 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'ночы', 'night'); - assert.equal(moment([2012, 11, 28, 3, 59]).format('A'), 'ночы', 'night'); - assert.equal(moment([2012, 11, 28, 4, 0]).format('A'), 'раніцы', 'morning'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'раніцы', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'дня', 'afternoon'); - assert.equal(moment([2012, 11, 28, 16, 59]).format('A'), 'дня', 'afternoon'); - assert.equal(moment([2012, 11, 28, 17, 0]).format('A'), 'вечара', 'evening'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'вечара', 'evening'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ы', '1-ы'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-і', '2-і'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-і', '3-і'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-ы', '4-ы'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-ы', '5-ы'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-ы', '6-ы'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-ы', '7-ы'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-ы', '8-ы'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-ы', '9-ы'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-ы', '10-ы'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-ы', '11-ы'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-ы', '12-ы'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-ы', '13-ы'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-ы', '14-ы'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-ы', '15-ы'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-ы', '16-ы'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-ы', '17-ы'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-ы', '18-ы'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-ы', '19-ы'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-ы', '20-ы'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-ы', '21-ы'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-і', '22-і'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-і', '23-і'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-ы', '24-ы'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-ы', '25-ы'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ы', '26-ы'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-ы', '27-ы'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-ы', '28-ы'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-ы', '29-ы'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-ы', '30-ы'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-ы', '31-ы'); - }); - - test('format month', function (assert) { - var expected = 'студзень студ_люты лют_сакавік сак_красавік крас_травень трав_чэрвень чэрв_ліпень ліп_жнівень жнів_верасень вер_кастрычнік каст_лістапад ліст_снежань снеж'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format month case', function (assert) { - var months = { - 'nominative': 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_'), - 'accusative': 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]); - } - }); - - test('format month case with escaped symbols', function (assert) { - var months = { - 'nominative': 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_'), - 'accusative': 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMMM[]'), '1 ' + months.accusative[i] + '', '1 ' + months.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-ы дзень] MMMM'), '1-ы дзень ' + months.accusative[i], '1-ы дзень ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMMM'), '1, ' + months.nominative[i], '1, ' + months.nominative[i]); - } - }); - - test('format week', function (assert) { - var expected = 'нядзеля нд нд_панядзелак пн пн_аўторак ат ат_серада ср ср_чацвер чц чц_пятніца пт пт_субота сб сб'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'некалькі секунд', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'хвіліна', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'хвіліна', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 хвіліны', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 31}), true), '31 хвіліна', '31 minutes = 31 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 хвіліны', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'гадзіна', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'гадзіна', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 гадзіны', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 гадзін', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 гадзіна', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'дзень', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'дзень', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 дні', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'дзень', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 дзён', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 дзён', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 дзень', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 дзён', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'месяц', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'месяц', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'месяц', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 месяцы', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 месяцы', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 месяцы', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'месяц', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 месяцаў', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'год', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 гады', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'год', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 гадоў', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'праз некалькі секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'некалькі секунд таму', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'праз некалькі секунд', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'праз 5 дзён', 'in 5 days'); - assert.equal(moment().add({m: 31}).fromNow(), 'праз 31 хвіліну', 'in 31 minutes = in 31 minutes'); - assert.equal(moment().subtract({m: 31}).fromNow(), '31 хвіліну таму', '31 minutes ago = 31 minutes ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Сёння ў 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Сёння ў 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Сёння ў 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Заўтра ў 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сёння ў 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Учора ў 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - function makeFormat(d) { - return '[У] dddd [ў] LT'; - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ы', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ы', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-і', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-і', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-і', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('bg'); - - test('parse', function (assert) { - var tests = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, H:mm:ss', 'неделя, февруари 14-ти 2010, 15:25:50'], - ['ddd, hA', 'нед, 3PM'], - ['M Mo MM MMMM MMM', '2 2-ри 02 февруари фев'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-ти 14'], - ['d do dddd ddd dd', '0 0-ев неделя нед нд'], - ['DDD DDDo DDDD', '45 45-ти 045'], - ['w wo ww', '7 7-ми 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45-ти day of the year'], - ['LT', '15:25'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 февруари 2010'], - ['LLL', '14 февруари 2010 15:25'], - ['LLLL', 'неделя, 14 февруари 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 фев 2010'], - ['lll', '14 фев 2010 15:25'], - ['llll', 'нед, 14 фев 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ви', '1-ви'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-ри', '2-ри'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-ти', '3-ти'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-ти', '4-ти'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-ти', '5-ти'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-ти', '6-ти'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-ми', '7-ми'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-ми', '8-ми'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-ти', '9-ти'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-ти', '10-ти'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-ти', '11-ти'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-ти', '12-ти'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-ти', '13-ти'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-ти', '14-ти'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-ти', '15-ти'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-ти', '16-ти'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-ти', '17-ти'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-ти', '18-ти'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-ти', '19-ти'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-ти', '20-ти'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-ви', '21-ви'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-ри', '22-ри'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-ти', '23-ти'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-ти', '24-ти'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-ти', '25-ти'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ти', '26-ти'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-ми', '27-ми'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-ми', '28-ми'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-ти', '29-ти'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-ти', '30-ти'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-ви', '31-ви'); - }); - - test('format month', function (assert) { - var expected = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'неделя нед нд_понеделник пон пн_вторник вто вт_сряда сря ср_четвъртък чет чт_петък пет пт_събота съб сб'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'няколко секунди', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'минута', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'минута', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 минути', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 минути', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'час', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'час', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 часа', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 часа', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 часа', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ден', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ден', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 дни', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ден', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 дни', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 дни', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'месец', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'месец', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'месец', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 месеца', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 месеца', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 месеца', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'месец', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 месеца', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'година', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 години', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'година', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 години', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'след няколко секунди', 'prefix'); - assert.equal(moment(0).from(30000), 'преди няколко секунди', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'преди няколко секунди', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'след няколко секунди', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'след 5 дни', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Днес в 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Днес в 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Днес в 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Утре в 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Днес в 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера в 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [в] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [в] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [в] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ви', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ви', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-ри', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-ри', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-ти', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('bn'); - - test('parse', function (assert) { - var tests = 'জানুয়ারী জানু_ফেবুয়ারী ফেব_মার্চ মার্চ_এপ্রিল এপর_মে মে_জুন জুন_জুলাই জুল_অগাস্ট অগ_সেপ্টেম্বর সেপ্ট_অক্টোবর অক্টো_নভেম্বর নভ_ডিসেম্বর ডিসেম্'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss সময়', 'রবিবার, ১৪ ফেবুয়ারী ২০১০, দুপুর ৩:২৫:৫০ সময়'], - ['ddd, a h সময়', 'রবি, দুপুর ৩ সময়'], - ['M Mo MM MMMM MMM', '২ ২ ০২ ফেবুয়ারী ফেব'], - ['YYYY YY', '২০১০ ১০'], - ['D Do DD', '১৪ ১৪ ১৪'], - ['d do dddd ddd dd', '০ ০ রবিবার রবি রব'], - ['DDD DDDo DDDD', '৪৫ ৪৫ ০৪৫'], - ['w wo ww', '৮ ৮ ০৮'], - ['h hh', '৩ ০৩'], - ['H HH', '১৫ ১৫'], - ['m mm', '২৫ ২৫'], - ['s ss', '৫০ ৫০'], - ['a A', 'দুপুর দুপুর'], - ['LT', 'দুপুর ৩:২৫ সময়'], - ['LTS', 'দুপুর ৩:২৫:৫০ সময়'], - ['L', '১৪/০২/২০১০'], - ['LL', '১৪ ফেবুয়ারী ২০১০'], - ['LLL', '১৪ ফেবুয়ারী ২০১০, দুপুর ৩:২৫ সময়'], - ['LLLL', 'রবিবার, ১৪ ফেবুয়ারী ২০১০, দুপুর ৩:২৫ সময়'], - ['l', '১৪/২/২০১০'], - ['ll', '১৪ ফেব ২০১০'], - ['lll', '১৪ ফেব ২০১০, দুপুর ৩:২৫ সময়'], - ['llll', 'রবি, ১৪ ফেব ২০১০, দুপুর ৩:২৫ সময়'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '১', '১'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '২', '২'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '৩', '৩'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '৪', '৪'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '৫', '৫'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '৬', '৬'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '৭', '৭'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '৮', '৮'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '৯', '৯'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '১০', '১০'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '১১', '১১'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '১২', '১২'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '১৩', '১৩'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '১৪', '১৪'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '১৫', '১৫'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '১৬', '১৬'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '১৭', '১৭'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '১৮', '১৮'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '১৯', '১৯'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '২০', '২০'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '২১', '২১'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '২২', '২২'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '২৩', '২৩'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '২৪', '২৪'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '২৫', '২৫'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '২৬', '২৬'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '২৭', '২৭'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '২৮', '२৮'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '২৯', '২৯'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '৩০', '৩০'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '৩১', '৩১'); - }); - - test('format month', function (assert) { - var expected = 'জানুয়ারী জানু_ফেবুয়ারী ফেব_মার্চ মার্চ_এপ্রিল এপর_মে মে_জুন জুন_জুলাই জুল_অগাস্ট অগ_সেপ্টেম্বর সেপ্ট_অক্টোবর অক্টো_নভেম্বর নভ_ডিসেম্বর ডিসেম্'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'রবিবার রবি রব_সোমবার সোম সম_মঙ্গলবার মঙ্গল মঙ্গ_বুধবার বুধ বু_বৃহস্পত্তিবার বৃহস্পত্তি ব্রিহ_শুক্রবার শুক্র শু_শনিবার শনি শনি'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'কয়েক সেকেন্ড', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'এক মিনিট', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'এক মিনিট', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '২ মিনিট', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '৪৪ মিনিট', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'এক ঘন্টা', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'এক ঘন্টা', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '২ ঘন্টা', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '৫ ঘন্টা', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '২১ ঘন্টা', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'এক দিন', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'এক দিন', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '২ দিন', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'এক দিন', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '৫ দিন', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '২৫ দিন', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'এক মাস', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'এক মাস', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '২ মাস', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '২ মাস', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '৩ মাস', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'এক মাস', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '৫ মাস', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'এক বছর', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '২ বছর', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'এক বছর', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '৫ বছর', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'কয়েক সেকেন্ড পরে', 'prefix'); - assert.equal(moment(0).from(30000), 'কয়েক সেকেন্ড আগে', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'কয়েক সেকেন্ড আগে', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'কয়েক সেকেন্ড পরে', 'কয়েক সেকেন্ড পরে'); - assert.equal(moment().add({d: 5}).fromNow(), '৫ দিন পরে', '৫ দিন পরে'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'আজ দুপুর ১২:০০ সময়', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'আজ দুপুর ১২:২৫ সময়', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'আজ দুপুর ৩:০০ সময়', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'আগামীকাল দুপুর ১২:০০ সময়', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'আজ দুপুর ১১:০০ সময়', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'গতকাল দুপুর ১২:০০ সময়', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[গত] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[গত] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[গত] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'রাত', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'সকাল', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'দুপুর', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'বিকাল', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'বিকাল', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'রাত', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'রাত', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'সকাল', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'দুপুর', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'বিকাল', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'বিকাল', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'রাত', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '১ ০১ ১', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '১ ০১ ১', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '২ ০২ ২', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '২ ০২ ২', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '৩ ০৩ ৩', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('bo'); - - test('parse', function (assert) { - var tests = 'ཟླ་བ་དང་པོ ཟླ་བ་དང་པོ._ཟླ་བ་གཉིས་པ ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss ལ་', 'གཟའ་ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥:༥༠ ལ་'], - ['ddd, a h ལ་', 'ཉི་མ་, ཉིན་གུང ༣ ལ་'], - ['M Mo MM MMMM MMM', '༢ ༢ ༠༢ ཟླ་བ་གཉིས་པ ཟླ་བ་གཉིས་པ'], - ['YYYY YY', '༢༠༡༠ ༡༠'], - ['D Do DD', '༡༤ ༡༤ ༡༤'], - ['d do dddd ddd dd', '༠ ༠ གཟའ་ཉི་མ་ ཉི་མ་ ཉི་མ་'], - ['DDD DDDo DDDD', '༤༥ ༤༥ ༠༤༥'], - ['w wo ww', '༨ ༨ ༠༨'], - ['h hh', '༣ ༠༣'], - ['H HH', '༡༥ ༡༥'], - ['m mm', '༢༥ ༢༥'], - ['s ss', '༥༠ ༥༠'], - ['a A', 'ཉིན་གུང ཉིན་གུང'], - ['LT', 'ཉིན་གུང ༣:༢༥'], - ['LTS', 'ཉིན་གུང ༣:༢༥:༥༠'], - ['L', '༡༤/༠༢/༢༠༡༠'], - ['LL', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠'], - ['LLL', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'], - ['LLLL', 'གཟའ་ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'], - ['l', '༡༤/༢/༢༠༡༠'], - ['ll', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠'], - ['lll', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'], - ['llll', 'ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '༡', '༡'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '༢', '༢'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '༣', '༣'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '༤', '༤'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '༥', '༥'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '༦', '༦'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '༧', '༧'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '༨', '༨'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '༩', '༩'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '༡༠', '༡༠'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '༡༡', '༡༡'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '༡༢', '༡༢'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '༡༣', '༡༣'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '༡༤', '༡༤'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '༡༥', '༡༥'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '༡༦', '༡༦'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '༡༧', '༡༧'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '༡༨', '༡༨'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '༡༩', '༡༩'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '༢༠', '༢༠'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '༢༡', '༢༡'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '༢༢', '༢༢'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '༢༣', '༢༣'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '༢༤', '༢༤'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '༢༥', '༢༥'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '༢༦', '༢༦'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '༢༧', '༢༧'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '༢༨', '༢༨'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '༢༩', '༢༩'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '༣༠', '༣༠'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '༣༡', '༣༡'); - }); - - test('format month', function (assert) { - var expected = 'ཟླ་བ་དང་པོ ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'གཟའ་ཉི་མ་ ཉི་མ་ ཉི་མ་_གཟའ་ཟླ་བ་ ཟླ་བ་ ཟླ་བ་_གཟའ་མིག་དམར་ མིག་དམར་ མིག་དམར་_གཟའ་ལྷག་པ་ ལྷག་པ་ ལྷག་པ་_གཟའ་ཕུར་བུ ཕུར་བུ ཕུར་བུ_གཟའ་པ་སངས་ པ་སངས་ པ་སངས་_གཟའ་སྤེན་པ་ སྤེན་པ་ སྤེན་པ་'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ལམ་སང', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'སྐར་མ་གཅིག', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'སྐར་མ་གཅིག', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '༢ སྐར་མ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '༤༤ སྐར་མ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ཆུ་ཚོད་གཅིག', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ཆུ་ཚོད་གཅིག', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '༢ ཆུ་ཚོད', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '༥ ཆུ་ཚོད', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '༢༡ ཆུ་ཚོད', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ཉིན་གཅིག', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ཉིན་གཅིག', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '༢ ཉིན་', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ཉིན་གཅིག', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '༥ ཉིན་', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '༢༥ ཉིན་', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ཟླ་བ་གཅིག', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ཟླ་བ་གཅིག', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ཟླ་བ་གཅིག', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '༢ ཟླ་བ', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '༢ ཟླ་བ', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '༣ ཟླ་བ', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ཟླ་བ་གཅིག', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '༥ ཟླ་བ', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ལོ་གཅིག', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '༢ ལོ', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ལོ་གཅིག', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '༥ ལོ', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ལམ་སང ལ་', 'prefix'); - assert.equal(moment(0).from(30000), 'ལམ་སང སྔན་ལ', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ལམ་སང སྔན་ལ', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ལམ་སང ལ་', 'ལམ་སང ལ་'); - assert.equal(moment().add({d: 5}).fromNow(), '༥ ཉིན་ ལ་', '༥ ཉིན་ ལ་'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'དི་རིང ཉིན་གུང ༡༢:༠༠', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'དི་རིང ཉིན་གུང ༡༢:༢༥', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'དི་རིང ཉིན་གུང ༣:༠༠', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'སང་ཉིན ཉིན་གུང ༡༢:༠༠', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'དི་རིང ཉིན་གུང ༡༡:༠༠', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ཁ་སང ཉིན་གུང ༡༢:༠༠', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ][,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་མཐའ་མ] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་མཐའ་མ] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[བདུན་ཕྲག་མཐའ་མ] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'མཚན་མོ', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'ཞོགས་ཀས', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'ཉིན་གུང', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'དགོང་དག', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'དགོང་དག', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'མཚན་མོ', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'མཚན་མོ', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'ཞོགས་ཀས', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'ཉིན་གུང', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'དགོང་དག', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'དགོང་དག', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'མཚན་མོ', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '༡ ༠༡ ༡', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '༡ ༠༡ ༡', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '༢ ༠༢ ༢', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '༢ ༠༢ ༢', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '༣ ༠༣ ༣', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('br'); - - test('parse', function (assert) { - var tests = 'Genver Gen_C\'hwevrer C\'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - moment.locale('br'); - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sul, C\'hwevrer 14vet 2010, 3:25:50 pm'], - ['ddd, h A', 'Sul, 3 PM'], - ['M Mo MM MMMM MMM', '2 2vet 02 C\'hwevrer C\'hwe'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14vet 14'], - ['d do dddd ddd dd', '0 0vet Sul Sul Su'], - ['DDD DDDo DDDD', '45 45vet 045'], - ['w wo ww', '6 6vet 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['DDDo [devezh] [ar] [vloaz]', '45vet devezh ar vloaz'], - ['L', '14/02/2010'], - ['LL', '14 a viz C\'hwevrer 2010'], - ['LLL', '14 a viz C\'hwevrer 2010 3e25 PM'], - ['LLLL', 'Sul, 14 a viz C\'hwevrer 2010 3e25 PM'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - moment.locale('br'); - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1añ', '1añ'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2vet', '2vet'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3vet', '3vet'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4vet', '4vet'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5vet', '5vet'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6vet', '6vet'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7vet', '7vet'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8vet', '8vet'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9vet', '9vet'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10vet', '10vet'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11vet', '11vet'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12vet', '12vet'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13vet', '13vet'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14vet', '14vet'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15vet', '15vet'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16vet', '16vet'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17vet', '17vet'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18vet', '18vet'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19vet', '19vet'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20vet', '20vet'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21vet', '21vet'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22vet', '22vet'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23vet', '23vet'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24vet', '24vet'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25vet', '25vet'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26vet', '26vet'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27vet', '27vet'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28vet', '28vet'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29vet', '29vet'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30vet', '30vet'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31vet', '31vet'); - }); - - test('format month', function (assert) { - moment.locale('br'); - var expected = 'Genver Gen_C\'hwevrer C\'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - moment.locale('br'); - var expected = 'Sul Sul Su_Lun Lun Lu_Meurzh Meu Me_Merc\'her Mer Mer_Yaou Yao Ya_Gwener Gwe Gw_Sadorn Sad Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - moment.locale('br'); - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'un nebeud segondennoù', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ur vunutenn', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ur vunutenn', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 vunutenn', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 munutenn', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'un eur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'un eur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 eur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 eur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 eur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un devezh', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un devezh', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zevezh', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un devezh', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 devezh', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 devezh', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ur miz', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ur miz', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ur miz', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 viz', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 viz', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 miz', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ur miz', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 miz', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ur bloaz', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vloaz', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ur bloaz', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bloaz', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - moment.locale('br'); - assert.equal(moment(30000).from(0), 'a-benn un nebeud segondennoù', 'prefix'); - assert.equal(moment(0).from(30000), 'un nebeud segondennoù \'zo', 'suffix'); - }); - - test('now from now', function (assert) { - moment.locale('br'); - assert.equal(moment().fromNow(), 'un nebeud segondennoù \'zo', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - moment.locale('br'); - assert.equal(moment().add({s: 30}).fromNow(), 'a-benn un nebeud segondennoù', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'a-benn 5 devezh', 'in 5 days'); - }); - - test('calendar day', function (assert) { - moment.locale('br'); - - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hiziv da 12e00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hiziv da 12e25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hiziv da 1e00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Warc\'hoazh da 12e00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hiziv da 11e00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dec\'h da 12e00 PM', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - moment.locale('br'); - - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [da] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - moment.locale('br'); - - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [paset da] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - moment.locale('br'); - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('special mutations for years', function (assert) { - moment.locale('br'); - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ur bloaz', 'mutation 1 year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 2}), true), '2 vloaz', 'mutation 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 3}), true), '3 bloaz', 'mutation 3 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 4}), true), '4 bloaz', 'mutation 4 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bloaz', 'mutation 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 9}), true), '9 bloaz', 'mutation 9 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 10}), true), '10 vloaz', 'mutation 10 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 bloaz', 'mutation 21 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 22}), true), '22 vloaz', 'mutation 22 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 133}), true), '133 bloaz', 'mutation 133 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 148}), true), '148 vloaz', 'mutation 148 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 261}), true), '261 bloaz', 'mutation 261 years'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('bs'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._august aug._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' inp ' + mmm); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. nedjelja ned. ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14. 02. 2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedjelja, 14. februar 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 14. feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._august aug._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'par sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedna minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedna minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mjesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mjesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mjesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mjeseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mjeseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mjeseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mjesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mjeseci', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za par sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije par sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prije par sekundi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za par sekundi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ca'); - - test('parse', function (assert) { - var tests = 'gener gen._febrer febr._març mar._abril abr._maig mai._juny jun._juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre des.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'diumenge, 14è febrer 2010, 3:25:50 pm'], - ['ddd, hA', 'dg., 3PM'], - ['M Mo MM MMMM MMM', '2 2n 02 febrer febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14è 14'], - ['d do dddd ddd dd', '0 0è diumenge dg. Dg'], - ['DDD DDDo DDDD', '45 45è 045'], - ['w wo ww', '6 6a 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45è day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 febrer 2010'], - ['LLL', '14 febrer 2010 15:25'], - ['LLLL', 'diumenge 14 febrer 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 febr. 2010'], - ['lll', '14 febr. 2010 15:25'], - ['llll', 'dg. 14 febr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1r', '1r'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2n', '2n'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3r', '3r'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4t', '4t'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5è', '5è'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6è', '6è'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7è', '7è'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8è', '8è'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9è', '9è'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10è', '10è'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11è', '11è'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12è', '12è'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13è', '13è'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14è', '14è'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15è', '15è'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16è', '16è'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17è', '17è'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18è', '18è'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19è', '19è'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20è', '20è'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21è', '21è'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22è', '22è'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23è', '23è'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24è', '24è'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25è', '25è'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26è', '26è'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27è', '27è'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28è', '28è'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29è', '29è'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30è', '30è'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31è', '31è'); - }); - - test('format month', function (assert) { - var expected = 'gener gen._febrer febr._març mar._abril abr._maig mai._juny jun._juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre des.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'diumenge dg. Dg_dilluns dl. Dl_dimarts dt. Dt_dimecres dc. Dc_dijous dj. Dj_divendres dv. Dv_dissabte ds. Ds'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'uns segons', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuts', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuts', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'una hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'una hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hores', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hores', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hores', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dies', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dies', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dies', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesos', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesos', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesos', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesos', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un any', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anys', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un any', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anys', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'en uns segons', 'prefix'); - assert.equal(moment(0).from(30000), 'fa uns segons', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fa uns segons', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'en uns segons', 'en uns segons'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 dies', 'en 5 dies'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'avui a les 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'avui a les 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'avui a les 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'demà a les 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'demà a les 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'avui a les 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ahir a les 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52a', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1a', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2a', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('cs'); - - test('parse', function (assert) { - var tests = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec pro'.split('_'), i; - function equalTest(input, mmm, monthIndex) { - assert.equal(moment(input, mmm).month(), monthIndex, input + ' ' + mmm + ' should be month ' + (monthIndex + 1)); - } - function equalTestStrict(input, mmm, monthIndex) { - assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - - equalTestStrict(tests[i][1], 'MMM', i); - equalTestStrict(tests[i][0], 'MMMM', i); - equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); - equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); - equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss', 'neděle, únor 14. 2010, 3:25:50'], - ['ddd, h', 'ne, 3'], - ['M Mo MM MMMM MMM', '2 2. 02 únor úno'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. neděle ne ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['DDDo [den v roce]', '45. den v roce'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. únor 2010'], - ['LLL', '14. únor 2010 15:25'], - ['LLLL', 'neděle 14. únor 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. úno 2010'], - ['lll', '14. úno 2010 15:25'], - ['llll', 'ne 14. úno 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec pro'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'neděle ne ne_pondělí po po_úterý út út_středa st st_čtvrtek čt čt_pátek pá pá_sobota so so'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'pár sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minut', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'hodina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'hodina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hodiny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hodin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hodin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'den', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'den', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dny', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'den', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dní', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dní', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'měsíc', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'měsíc', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'měsíc', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 měsíce', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 měsíce', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 měsíce', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'měsíc', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 měsíců', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 roky', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za pár sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'před pár sekundami', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'před pár sekundami', 'now from now should display as in the past'); - }); - - test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekund', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'za minutu', 'in a minute'); - assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minuty', 'in 3 minutes'); - assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minut', 'in 10 minutes'); - assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); - assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); - assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodin', 'in 10 hours'); - assert.equal(moment().add({d: 1}).fromNow(), 'za den', 'in a day'); - assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dny', 'in 3 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); - assert.equal(moment().add({M: 1}).fromNow(), 'za měsíc', 'in a month'); - assert.equal(moment().add({M: 3}).fromNow(), 'za 3 měsíce', 'in 3 months'); - assert.equal(moment().add({M: 10}).fromNow(), 'za 10 měsíců', 'in 10 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); - assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); - assert.equal(moment().add({y: 10}).fromNow(), 'za 10 let', 'in 10 years'); - }); - - test('fromNow (past)', function (assert) { - assert.equal(moment().subtract({s: 30}).fromNow(), 'před pár sekundami', 'a few seconds ago'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'před minutou', 'a minute ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'před 3 minutami', '3 minutes ago'); - assert.equal(moment().subtract({m: 10}).fromNow(), 'před 10 minutami', '10 minutes ago'); - assert.equal(moment().subtract({h: 1}).fromNow(), 'před hodinou', 'an hour ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'před 3 hodinami', '3 hours ago'); - assert.equal(moment().subtract({h: 10}).fromNow(), 'před 10 hodinami', '10 hours ago'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'před dnem', 'a day ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'před 3 dny', '3 days ago'); - assert.equal(moment().subtract({d: 10}).fromNow(), 'před 10 dny', '10 days ago'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'před měsícem', 'a month ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'před 3 měsíci', '3 months ago'); - assert.equal(moment().subtract({M: 10}).fromNow(), 'před 10 měsíci', '10 months ago'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'před rokem', 'a year ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'před 3 lety', '3 years ago'); - assert.equal(moment().subtract({y: 10}).fromNow(), 'před 10 lety', '10 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'dnes v 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'dnes v 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'dnes v 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'zítra v 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes v 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera v 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, nextDay; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - nextDay = ''; - switch (m.day()) { - case 0: - nextDay = 'v neděli'; - break; - case 1: - nextDay = 'v pondělí'; - break; - case 2: - nextDay = 'v úterý'; - break; - case 3: - nextDay = 've středu'; - break; - case 4: - nextDay = 've čtvrtek'; - break; - case 5: - nextDay = 'v pátek'; - break; - case 6: - nextDay = 'v sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [v] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, lastDay; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - lastDay = ''; - switch (m.day()) { - case 0: - lastDay = 'minulou neděli'; - break; - case 1: - lastDay = 'minulé pondělí'; - break; - case 2: - lastDay = 'minulé úterý'; - break; - case 3: - lastDay = 'minulou středu'; - break; - case 4: - lastDay = 'minulý čtvrtek'; - break; - case 5: - lastDay = 'minulý pátek'; - break; - case 6: - lastDay = 'minulou sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [v] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('humanize duration', function (assert) { - assert.equal(moment.duration(1, 'minutes').humanize(), 'minuta', 'a minute (future)'); - assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minutu', 'in a minute'); - assert.equal(moment.duration(-1, 'minutes').humanize(), 'minuta', 'a minute (past)'); - assert.equal(moment.duration(-1, 'minutes').humanize(true), 'před minutou', 'a minute ago'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('cv'); - - test('parse', function (assert) { - var tests = 'кӑрлач кӑр_нарӑс нар_пуш пуш_ака ака_май май_ҫӗртме ҫӗр_утӑ утӑ_ҫурла ҫур_авӑн авн_юпа юпа_чӳк чӳк_раштав раш'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'вырсарникун, нарӑс 14-мӗш 2010, 3:25:50 pm'], - ['ddd, hA', 'выр, 3PM'], - ['M Mo MM MMMM MMM', '2 2-мӗш 02 нарӑс нар'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-мӗш 14'], - ['d do dddd ddd dd', '0 0-мӗш вырсарникун выр вр'], - ['DDD DDDo DDDD', '45 45-мӗш 045'], - ['w wo ww', '7 7-мӗш 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['Ҫулӑн DDDo кунӗ', 'Ҫулӑн 45-мӗш кунӗ'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ'], - ['LLL', '2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ, 15:25'], - ['LLLL', 'вырсарникун, 2010 ҫулхи нарӑс уйӑхӗн 14-мӗшӗ, 15:25'], - ['l', '14-2-2010'], - ['ll', '2010 ҫулхи нар уйӑхӗн 14-мӗшӗ'], - ['lll', '2010 ҫулхи нар уйӑхӗн 14-мӗшӗ, 15:25'], - ['llll', 'выр, 2010 ҫулхи нар уйӑхӗн 14-мӗшӗ, 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-мӗш', '1-мӗш'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-мӗш', '2-мӗш'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-мӗш', '3-мӗш'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-мӗш', '4-мӗш'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-мӗш', '5-мӗш'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-мӗш', '6-мӗш'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-мӗш', '7-мӗш'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-мӗш', '8-мӗш'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-мӗш', '9-мӗш'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-мӗш', '10-мӗш'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-мӗш', '11-мӗш'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-мӗш', '12-мӗш'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-мӗш', '13-мӗш'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-мӗш', '14-мӗш'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-мӗш', '15-мӗш'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-мӗш', '16-мӗш'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-мӗш', '17-мӗш'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-мӗш', '18-мӗш'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-мӗш', '19-мӗш'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-мӗш', '20-мӗш'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-мӗш', '21-мӗш'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-мӗш', '22-мӗш'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-мӗш', '23-мӗш'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-мӗш', '24-мӗш'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-мӗш', '25-мӗш'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-мӗш', '26-мӗш'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-мӗш', '27-мӗш'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-мӗш', '28-мӗш'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-мӗш', '29-мӗш'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-мӗш', '30-мӗш'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-мӗш', '31-мӗш'); - }); - - test('format month', function (assert) { - var expected = 'кӑрлач кӑр_нарӑс нар_пуш пуш_ака ака_май май_ҫӗртме ҫӗр_утӑ утӑ_ҫурла ҫур_авӑн авн_юпа юпа_чӳк чӳк_раштав раш'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'вырсарникун выр вр_тунтикун тун тн_ытларикун ытл ыт_юнкун юн юн_кӗҫнерникун кӗҫ кҫ_эрнекун эрн эр_шӑматкун шӑм шм'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'пӗр-ик ҫеккунт', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'пӗр минут', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'пӗр минут', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 минут', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 минут', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'пӗр сехет', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'пӗр сехет', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 сехет', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 сехет', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 сехет', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'пӗр кун', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'пӗр кун', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 кун', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'пӗр кун', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 кун', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 кун', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'пӗр уйӑх', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'пӗр уйӑх', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'пӗр уйӑх', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 уйӑх', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 уйӑх', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 уйӑх', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'пӗр уйӑх', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 уйӑх', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'пӗр ҫул', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ҫул', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'пӗр ҫул', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ҫул', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'пӗр-ик ҫеккунтран', 'prefix'); - assert.equal(moment(0).from(30000), 'пӗр-ик ҫеккунт каялла', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'пӗр-ик ҫеккунт каялла', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'пӗр-ик ҫеккунтран', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 кунран', 'in 5 days'); - assert.equal(moment().add({h: 2}).fromNow(), '2 сехетрен', 'in 2 hours, the right suffix!'); - assert.equal(moment().add({y: 3}).fromNow(), '3 ҫултан', 'in 3 years, the right suffix!'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Паян 12:00 сехетре', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Паян 12:25 сехетре', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Паян 13:00 сехетре', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ыран 12:00 сехетре', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Паян 11:00 сехетре', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ӗнер 12:00 сехетре', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[Ҫитес] dddd LT [сехетре]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Ҫитес] dddd LT [сехетре]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Ҫитес] dddd LT [сехетре]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Иртнӗ] dddd LT [сехетре]'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Иртнӗ] dddd LT [сехетре]'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Иртнӗ] dddd LT [сехетре]'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 1st is the first week of the year. - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-мӗш', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-мӗш', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-мӗш', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-мӗш', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-мӗш', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('cy'); - - test('parse', function (assert) { - var tests = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Dydd Sul, Chwefror 14eg 2010, 3:25:50 pm'], - ['ddd, hA', 'Sul, 3PM'], - ['M Mo MM MMMM MMM', '2 2il 02 Chwefror Chwe'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14eg 14'], - ['d do dddd ddd dd', '0 0 Dydd Sul Sul Su'], - ['DDD DDDo DDDD', '45 45ain 045'], - ['w wo ww', '6 6ed 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45ain day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Chwefror 2010'], - ['LLL', '14 Chwefror 2010 15:25'], - ['LLLL', 'Dydd Sul, 14 Chwefror 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Chwe 2010'], - ['lll', '14 Chwe 2010 15:25'], - ['llll', 'Sul, 14 Chwe 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1af', '1af'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2il', '2il'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3ydd', '3ydd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4ydd', '4ydd'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5ed', '5ed'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6ed', '6ed'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7ed', '7ed'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8fed', '8fed'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9fed', '9fed'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10fed', '10fed'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11eg', '11eg'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12fed', '12fed'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13eg', '13eg'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14eg', '14eg'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15fed', '15fed'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16eg', '16eg'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17eg', '17eg'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18fed', '18fed'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19eg', '19eg'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20fed', '20fed'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ain', '21ain'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ain', '22ain'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ain', '23ain'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ain', '24ain'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ain', '25ain'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ain', '26ain'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ain', '27ain'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ain', '28ain'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ain', '29ain'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ain', '30ain'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ain', '31ain'); - }); - - test('format month', function (assert) { - var expected = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Dydd Sul Sul Su_Dydd Llun Llun Ll_Dydd Mawrth Maw Ma_Dydd Mercher Mer Me_Dydd Iau Iau Ia_Dydd Gwener Gwe Gw_Dydd Sadwrn Sad Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ychydig eiliadau', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'munud', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'munud', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 munud', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 munud', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'awr', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'awr', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 awr', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 awr', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 awr', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diwrnod', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diwrnod', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 diwrnod', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diwrnod', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 diwrnod', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 diwrnod', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mis', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mis', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mis', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mis', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mis', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mis', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mis', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mis', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'blwyddyn', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 flynedd', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'blwyddyn', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 flynedd', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'mewn ychydig eiliadau', 'prefix'); - assert.equal(moment(0).from(30000), 'ychydig eiliadau yn ôl', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'mewn ychydig eiliadau', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'mewn 5 diwrnod', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Heddiw am 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Heddiw am 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Heddiw am 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Yfory am 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Heddiw am 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ddoe am 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [am] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [am] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [am] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [diwethaf am] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ain', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1af', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1af', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2il', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2il', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('da'); - - test('parse', function (assert) { - var tests = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober okt_november nov_december dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd [den] Do MMMM YYYY, h:mm:ss a', 'søndag den 14. februar 2010, 3:25:50 pm'], - ['ddd hA', 'søn 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. søndag søn sø'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[den] DDDo [dag på året]', 'den 45. dag på året'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'søndag d. 14. februar 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 15:25'], - ['llll', 'søn d. 14. feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober okt_november nov_december dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'søndag søn sø_mandag man ma_tirsdag tir ti_onsdag ons on_torsdag tor to_fredag fre fr_lørdag lør lø'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'få sekunder', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'et minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'et minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timer', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timer', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timer', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en måned', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en måned', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en måned', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 måneder', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 måneder', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 måneder', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en måned', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 måneder', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'et år', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 år', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'et år', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 år', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'om få sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'få sekunder siden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'få sekunder siden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om få sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dage', 'in 5 days'); - }); - - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'I dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'I dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'I dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'I morgen kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'I dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'I går kl. 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[sidste] dddd [kl] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[sidste] dddd [kl] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[sidste] dddd [kl] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('de-at'); - - test('parse', function (assert) { - var tests = 'Jänner Jän._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split('_'), i; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Sonntag So. So'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Febr. 2010'], - ['lll', '14. Febr. 2010 15:25'], - ['llll', 'So., 14. Febr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'Jänner Jän._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 Minuten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 Minuten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('de'); - - test('parse', function (assert) { - var tests = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'], - ['ddd, hA', 'So., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Sonntag So. So'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25'], - ['LLLL', 'Sonntag, 14. Februar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. Febr. 2010'], - ['lll', '14. Febr. 2010 15:25'], - ['llll', 'So., 14. Febr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ein paar Sekunden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eine Minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eine Minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 Minuten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 Minuten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eine Stunde', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eine Stunde', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stunden', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stunden', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stunden', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein Tag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein Tag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Tage', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein Tag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Tage', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Tage', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein Monat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein Monat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein Monat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Monate', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Monate', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Monate', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein Monat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Monate', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ein Jahr', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Jahre', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ein Jahr', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Jahre', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in ein paar Sekunden', 'prefix'); - assert.equal(moment(0).from(30000), 'vor ein paar Sekunden', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in ein paar Sekunden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 Tagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'heute um 12:00 Uhr', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'heute um 12:25 Uhr', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'heute um 13:00 Uhr', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen um 12:00 Uhr', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'heute um 11:00 Uhr', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gestern um 12:00 Uhr', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT [Uhr]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[letzten] dddd [um] LT [Uhr]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('dv'); - - test('parse', function (assert) { - var i, - tests = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ]; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - equalTest(tests[i].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'އާދިއްތަ، ފެބްރުއަރީ 14 2010، 3:25:50 މފ'], - ['ddd, hA', 'އާދިއްތަ، 3މފ'], - ['M Mo MM MMMM MMM', '2 2 02 ފެބްރުއަރީ ފެބްރުއަރީ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 އާދިއްތަ އާދިއްތަ އާދި'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'މފ މފ'], - ['LTS', '15:25:50'], - ['L', '14/2/2010'], - ['LL', '14 ފެބްރުއަރީ 2010'], - ['LLL', '14 ފެބްރުއަރީ 2010 15:25'], - ['LLLL', 'އާދިއްތަ 14 ފެބްރުއަރީ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 ފެބްރުއަރީ 2010'], - ['lll', '14 ފެބްރުއަރީ 2010 15:25'], - ['llll', 'އާދިއްތަ 14 ފެބްރުއަރީ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var i, - expected = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' - ]; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM'), expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' - ]; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd'), expected[i]); - } - }); - - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ސިކުންތުކޮޅެއް', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'މިނިޓެއް', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'މިނިޓެއް', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'މިނިޓު 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'މިނިޓު 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ގަޑިއިރެއް', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ގަޑިއިރެއް', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'ގަޑިއިރު 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'ގަޑިއިރު 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'ގަޑިއިރު 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ދުވަހެއް', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ދުވަހެއް', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'ދުވަސް 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ދުވަހެއް', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'ދުވަސް 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'ދުވަސް 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'މަހެއް', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'މަހެއް', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'މަހެއް', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'މަސް 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'މަސް 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'މަސް 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'މަހެއް', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'މަސް 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'އަހަރެއް', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'އަހަރު 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'އަހަރެއް', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'އަހަރު 5', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ތެރޭގައި ސިކުންތުކޮޅެއް', 'prefix'); - assert.equal(moment(0).from(30000), 'ކުރިން ސިކުންތުކޮޅެއް', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ތެރޭގައި ސިކުންތުކޮޅެއް', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ތެރޭގައި ދުވަސް 5', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'މިއަދު 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'މިއަދު 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'މިއަދު 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'މާދަމާ 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'މިއަދު 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'އިއްޔެ 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ފާއިތުވި] dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ފާއިތުވި] dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ފާއިތުވި] dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('el'); - - test('parse', function (assert) { - var i, - tests = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse meridiem', function (assert) { - var i, - b = moment(), - meridiemTests = [ - // h a patterns, expected hours, isValid - ['10 πμ', 10, true], - ['10 μμ', 22, true], - ['10 π.μ.', 10, true], - ['10 μ.μ.', 22, true], - ['10 π', 10, true], - ['10 μ', 22, true], - ['10 ΠΜ', 10, true], - ['10 ΜΜ', 22, true], - ['10 Π.Μ.', 10, true], - ['10 Μ.Μ.', 22, true], - ['10 Π', 10, true], - ['10 Μ', 22, true], - ['10 am', 10, false], - ['10 pm', 10, false] - ], - parsed; - - // test that a formatted moment including meridiem string can be parsed back to the same moment - assert.ok(b.isSame(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true), 'seconds'), b.format('h:mm:ss a') + ' should be equal to ' + moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true).format('h:mm:ss a')); - - // test that a formatted moment having a meridiem string can be parsed with strict flag - assert.ok(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'el', true).isValid(), b.format('h:mm:ss a') + ' should be parsed as valid'); - - for (i = 0; i < meridiemTests.length; i++) { - parsed = moment(meridiemTests[i][0], 'h a', 'el', true); - assert.equal(parsed.isValid(), meridiemTests[i][2], 'validity for ' + meridiemTests[i][0]); - if (parsed.isValid()) { - assert.equal(parsed.hours(), meridiemTests[i][1], 'hours for ' + meridiemTests[i][0]); - } - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Κυριακή, Φεβρουάριος 14η 2010, 3:25:50 μμ'], - ['dddd, D MMMM YYYY, h:mm:ss a', 'Κυριακή, 14 Φεβρουαρίου 2010, 3:25:50 μμ'], - ['ddd, hA', 'Κυρ, 3ΜΜ'], - ['dddd, MMMM YYYY', 'Κυριακή, Φεβρουάριος 2010'], - ['M Mo MM MMMM MMM', '2 2η 02 Φεβρουάριος Φεβ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14η 14'], - ['d do dddd ddd dd', '0 0η Κυριακή Κυρ Κυ'], - ['DDD DDDo DDDD', '45 45η 045'], - ['w wo ww', '6 6η 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'μμ ΜΜ'], - ['[the] DDDo [day of the year]', 'the 45η day of the year'], - ['LTS', '3:25:50 ΜΜ'], - ['L', '14/02/2010'], - ['LL', '14 Φεβρουαρίου 2010'], - ['LLL', '14 Φεβρουαρίου 2010 3:25 ΜΜ'], - ['LLLL', 'Κυριακή, 14 Φεβρουαρίου 2010 3:25 ΜΜ'], - ['l', '14/2/2010'], - ['ll', '14 Φεβ 2010'], - ['lll', '14 Φεβ 2010 3:25 ΜΜ'], - ['llll', 'Κυρ, 14 Φεβ 2010 3:25 ΜΜ'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1η', '1η'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2η', '2η'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3η', '3η'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4η', '4η'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5η', '5η'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6η', '6η'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7η', '7η'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8η', '8η'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9η', '9η'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10η', '10η'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11η', '11η'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12η', '12η'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13η', '13η'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14η', '14η'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15η', '15η'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16η', '16η'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17η', '17η'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18η', '18η'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19η', '19η'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20η', '20η'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21η', '21η'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22η', '22η'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23η', '23η'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24η', '24η'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25η', '25η'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26η', '26η'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27η', '27η'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28η', '28η'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29η', '29η'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30η', '30η'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31η', '31η'); - }); - - test('format month', function (assert) { - var i, - expected = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'Κυριακή Κυρ Κυ_Δευτέρα Δευ Δε_Τρίτη Τρι Τρ_Τετάρτη Τετ Τε_Πέμπτη Πεμ Πε_Παρασκευή Παρ Πα_Σάββατο Σαβ Σα'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'λίγα δευτερόλεπτα', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ένα λεπτό', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ένα λεπτό', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 λεπτά', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 λεπτά', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'μία ώρα', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'μία ώρα', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ώρες', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ώρες', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ώρες', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'μία μέρα', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'μία μέρα', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 μέρες', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'μία μέρα', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 μέρες', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 μέρες', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ένας μήνας', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ένας μήνας', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ένας μήνας', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 μήνες', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 μήνες', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 μήνες', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ένας μήνας', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 μήνες', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ένας χρόνος', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 χρόνια', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ένας χρόνος', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 χρόνια', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'σε λίγα δευτερόλεπτα', 'prefix'); - assert.equal(moment(0).from(30000), 'λίγα δευτερόλεπτα πριν', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'λίγα δευτερόλεπτα πριν', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'σε λίγα δευτερόλεπτα', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'σε 5 μέρες', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Σήμερα στις 12:00 ΜΜ', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Σήμερα στις 12:25 ΜΜ', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Σήμερα στη 1:00 ΜΜ', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Αύριο στις 12:00 ΜΜ', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Σήμερα στις 11:00 ΠΜ', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Χθες στις 12:00 ΜΜ', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [' + (m.hours() % 12 === 1 ? 'στη' : 'στις') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [στις] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [στις] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, dayString; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - dayString = m.day() === 6 ? '[το προηγούμενο Σάββατο]' : '[την προηγούμενη] dddd'; - assert.equal(m.calendar(), m.format(dayString + ' [' + (m.hours() % 12 === 1 ? 'στη' : 'στις') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(1).minutes(30).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(dayString + ' [στη] LT'), 'Today - ' + i + ' days one o clock'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(dayString + ' [στις] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(dayString + ' [στις] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52η', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1η', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1η', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2η', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2η', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('en-au'); - - test('parse', function (assert) { - var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 February 2010'], - ['LLL', '14 February 2010 3:25 PM'], - ['LLLL', 'Sunday, 14 February 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 3:25 PM'], - ['llll', 'Sun, 14 Feb 2010 3:25 PM'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); - assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('en-ca'); - - test('parse', function (assert) { - var i, - tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '8 8th 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['L', '2010-02-14'], - ['LTS', '3:25:50 PM'], - ['LL', 'February 14, 2010'], - ['LLL', 'February 14, 2010 3:25 PM'], - ['LLLL', 'Sunday, February 14, 2010 3:25 PM'], - ['l', '2010-2-14'], - ['ll', 'Feb 14, 2010'], - ['lll', 'Feb 14, 2010 3:25 PM'], - ['llll', 'Sun, Feb 14, 2010 3:25 PM'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var i, - expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); - assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('en-gb'); - - test('parse', function (assert) { - var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 February 2010'], - ['LLL', '14 February 2010 15:25'], - ['LLLL', 'Sunday, 14 February 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Sun, 14 Feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); - assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('en-ie'); - - test('parse', function (assert) { - var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '14 February 2010'], - ['LLL', '14 February 2010 15:25'], - ['LLLL', 'Sunday 14 February 2010 15:25'], - ['l', '14-2-2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Sun 14 Feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); - assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('en-nz'); - - test('parse', function (assert) { - var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 February 2010'], - ['LLL', '14 February 2010 3:25 PM'], - ['LLLL', 'Sunday, 14 February 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 3:25 PM'], - ['llll', 'Sun, 14 Feb 2010 3:25 PM'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); - assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('en'); - - test('parse', function (assert) { - var i, - tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'Sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 February Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th Sunday Sun Su'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '8 8th 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LTS', '3:25:50 PM'], - ['L', '02/14/2010'], - ['LL', 'February 14, 2010'], - ['LLL', 'February 14, 2010 3:25 PM'], - ['LLLL', 'Sunday, February 14, 2010 3:25 PM'], - ['l', '2/14/2010'], - ['ll', 'Feb 14, 2010'], - ['lll', 'Feb 14, 2010 3:25 PM'], - ['llll', 'Sun, Feb 14, 2010 3:25 PM'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var i, - expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'a month', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 months', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 months', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 months', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 years', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 years', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in a few seconds', 'prefix'); - assert.equal(moment(0).from(30000), 'a few seconds ago', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'a few seconds ago', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in a few seconds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'in 5 days', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at 12:00 PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at 12:25 PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at 1:00 PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at 12:00 PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at 11:00 AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at 12:00 PM', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [at] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Last] dddd [at] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', 'Jan 15 2012 should be week 3'); - }); - - test('weekdays strict parsing', function (assert) { - var m = moment('2015-01-01T12', moment.ISO_8601, true), - enLocale = moment.localeData('en'); - - for (var i = 0; i < 7; ++i) { - assert.equal(moment(enLocale.weekdays(m.day(i), ''), 'dddd', true).isValid(), true, 'parse weekday ' + i); - assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'ddd', true).isValid(), true, 'parse short weekday ' + i); - assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'dd', true).isValid(), true, 'parse min weekday ' + i); - - // negative tests - assert.equal(moment(enLocale.weekdaysMin(m.day(i), ''), 'ddd', true).isValid(), false, 'parse short weekday ' + i); - assert.equal(moment(enLocale.weekdaysShort(m.day(i), ''), 'dd', true).isValid(), false, 'parse min weekday ' + i); - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('eo'); - - test('parse', function (assert) { - var tests = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Dimanĉo, februaro 14a 2010, 3:25:50 p.t.m.'], - ['ddd, hA', 'Dim, 3P.T.M.'], - ['M Mo MM MMMM MMM', '2 2a 02 februaro feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14a 14'], - ['d do dddd ddd dd', '0 0a Dimanĉo Dim Di'], - ['DDD DDDo DDDD', '45 45a 045'], - ['w wo ww', '7 7a 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'p.t.m. P.T.M.'], - ['[la] DDDo [tago] [de] [la] [jaro]', 'la 45a tago de la jaro'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14-an de februaro, 2010'], - ['LLL', '14-an de februaro, 2010 15:25'], - ['LLLL', 'Dimanĉo, la 14-an de februaro, 2010 15:25'], - ['l', '2010-2-14'], - ['ll', '14-an de feb, 2010'], - ['lll', '14-an de feb, 2010 15:25'], - ['llll', 'Dim, la 14-an de feb, 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3a', '3a'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4a', '4a'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5a', '5a'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6a', '6a'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7a', '7a'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8a', '8a'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9a', '9a'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10a', '10a'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11a', '11a'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12a', '12a'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13a', '13a'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14a', '14a'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15a', '15a'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16a', '16a'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17a', '17a'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18a', '18a'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19a', '19a'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20a', '20a'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23a', '23a'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24a', '24a'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25a', '25a'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26a', '26a'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27a', '27a'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28a', '28a'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29a', '29a'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30a', '30a'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a'); - }); - - test('format month', function (assert) { - var expected = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Dimanĉo Dim Di_Lundo Lun Lu_Mardo Mard Ma_Merkredo Merk Me_Ĵaŭdo Ĵaŭ Ĵa_Vendredo Ven Ve_Sabato Sab Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'sekundoj', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutoj', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutoj', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'horo', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'horo', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horoj', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horoj', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horoj', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'tago', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'tago', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 tagoj', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'tago', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 tagoj', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 tagoj', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'monato', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'monato', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'monato', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 monatoj', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 monatoj', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 monatoj', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'monato', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 monatoj', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'jaro', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaroj', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'jaro', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaroj', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'je sekundoj', 'je prefix'); - assert.equal(moment(0).from(30000), 'antaŭ sekundoj', 'antaŭ prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'antaŭ sekundoj', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'je sekundoj', 'je sekundoj'); - assert.equal(moment().add({d: 5}).fromNow(), 'je 5 tagoj', 'je 5 tagoj'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hodiaŭ je 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hodiaŭ je 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hodiaŭ je 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Morgaŭ je 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hodiaŭ je 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hieraŭ je 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [je] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1a', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1a', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2a', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2a', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3a', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('es'); - - test('parse', function (assert) { - var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, febrero 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'dom., 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 febrero feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º domingo dom. do'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '6 6º 06'], - ['YYYY-MMM-DD', '2010-feb-14'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 de febrero de 2010'], - ['LLL', '14 de febrero de 2010 15:25'], - ['LLLL', 'domingo, 14 de febrero de 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 de feb. de 2010'], - ['lll', '14 de feb. de 2010 15:25'], - ['llll', 'dom., 14 de feb. de 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); - }); - - test('format month', function (assert) { - var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'domingo dom. do_lunes lun. lu_martes mar. ma_miércoles mié. mi_jueves jue. ju_viernes vie. vi_sábado sáb. sá'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'unos segundos', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'una hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'una hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un día', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un día', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 días', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un día', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 días', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 días', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un año', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 años', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un año', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 años', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'en unos segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'hace unos segundos', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'hace unos segundos', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'en unos segundos', 'en unos segundos'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 días', 'en 5 días'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'hoy a las 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hoy a las 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hoy a las 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mañana a las 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañana a las 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoy a las 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ayer a las 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('et'); - - test('parse', function (assert) { - var tests = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' peaks olema kuu ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, H:mm:ss', 'pühapäev, 14. veebruar 2010, 15:25:50'], - ['ddd, h', 'P, 3'], - ['M Mo MM MMMM MMM', '2 2. 02 veebruar veebr'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. pühapäev P P'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[aasta] DDDo [päev]', 'aasta 45. päev'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. veebruar 2010'], - ['LLL', '14. veebruar 2010 15:25'], - ['LLLL', 'pühapäev, 14. veebruar 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. veebr 2010'], - ['lll', '14. veebr 2010 15:25'], - ['llll', 'P, 14. veebr 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'pühapäev P P_esmaspäev E E_teisipäev T T_kolmapäev K K_neljapäev N N_reede R R_laupäev L L'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'paar sekundit', '44 seconds = paar sekundit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'üks minut', '45 seconds = üks minut'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'üks minut', '89 seconds = üks minut'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutit', '90 seconds = 2 minutit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutit', '44 minutes = 44 minutit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'üks tund', '45 minutes = tund aega'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'üks tund', '89 minutes = üks tund'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tundi', '90 minutes = 2 tundi'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tundi', '5 hours = 5 tundi'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tundi', '21 hours = 21 tundi'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'üks päev', '22 hours = üks päev'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'üks päev', '35 hours = üks päev'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 päeva', '36 hours = 2 päeva'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'üks päev', '1 day = üks päev'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 päeva', '5 days = 5 päeva'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 päeva', '25 days = 25 päeva'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'üks kuu', '26 days = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'üks kuu', '30 days = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'üks kuu', '43 days = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 kuud', '46 days = 2 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 kuud', '75 days = 2 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 kuud', '76 days = 3 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'üks kuu', '1 month = üks kuu'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 kuud', '5 months = 5 kuud'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'üks aasta', '345 days = üks aasta'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 aastat', '548 days = 2 aastat'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'üks aasta', '1 year = üks aasta'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 aastat', '5 years = 5 aastat'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'mõne sekundi pärast', 'prefix'); - assert.equal(moment(0).from(30000), 'mõni sekund tagasi', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'mõni sekund tagasi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'mõne sekundi pärast', 'in a few seconds'); - assert.equal(moment().subtract({s: 30}).fromNow(), 'mõni sekund tagasi', 'a few seconds ago'); - - assert.equal(moment().add({m: 1}).fromNow(), 'ühe minuti pärast', 'in a minute'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'üks minut tagasi', 'a minute ago'); - - assert.equal(moment().add({m: 5}).fromNow(), '5 minuti pärast', 'in 5 minutes'); - assert.equal(moment().subtract({m: 5}).fromNow(), '5 minutit tagasi', '5 minutes ago'); - - assert.equal(moment().add({d: 1}).fromNow(), 'ühe päeva pärast', 'in one day'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'üks päev tagasi', 'one day ago'); - - assert.equal(moment().add({d: 5}).fromNow(), '5 päeva pärast', 'in 5 days'); - assert.equal(moment().subtract({d: 5}).fromNow(), '5 päeva tagasi', '5 days ago'); - - assert.equal(moment().add({M: 1}).fromNow(), 'kuu aja pärast', 'in a month'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'kuu aega tagasi', 'a month ago'); - - assert.equal(moment().add({M: 5}).fromNow(), '5 kuu pärast', 'in 5 months'); - assert.equal(moment().subtract({M: 5}).fromNow(), '5 kuud tagasi', '5 months ago'); - - assert.equal(moment().add({y: 1}).fromNow(), 'ühe aasta pärast', 'in a year'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'aasta tagasi', 'a year ago'); - - assert.equal(moment().add({y: 5}).fromNow(), '5 aasta pärast', 'in 5 years'); - assert.equal(moment().subtract({y: 5}).fromNow(), '5 aastat tagasi', '5 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Täna, 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Täna, 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Täna, 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Homme, 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Täna, 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Eile, 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Järgmine] dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Eelmine] dddd LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 nädal tagasi'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '1 nädala pärast'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 nädalat tagasi'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 nädala pärast'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('eu'); - - test('parse', function (assert) { - var tests = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'igandea, otsaila 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'ig., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 otsaila ots.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. igandea ig. ig'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '2010ko otsailaren 14a'], - ['LLL', '2010ko otsailaren 14a 15:25'], - ['LLLL', 'igandea, 2010ko otsailaren 14a 15:25'], - ['l', '2010-2-14'], - ['ll', '2010ko ots. 14a'], - ['lll', '2010ko ots. 14a 15:25'], - ['llll', 'ig., 2010ko ots. 14a 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'igandea ig. ig_astelehena al. al_asteartea ar. ar_asteazkena az. az_osteguna og. og_ostirala ol. ol_larunbata lr. lr'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'segundo batzuk', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutu bat', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutu bat', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutu', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutu', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ordu bat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ordu bat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ordu', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ordu', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ordu', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'egun bat', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'egun bat', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 egun', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'egun bat', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 egun', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 egun', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'hilabete bat', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'hilabete bat', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'hilabete bat', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 hilabete', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 hilabete', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 hilabete', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'hilabete bat', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 hilabete', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'urte bat', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 urte', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'urte bat', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 urte', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'segundo batzuk barru', 'prefix'); - assert.equal(moment(0).from(30000), 'duela segundo batzuk', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'duela segundo batzuk', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'segundo batzuk barru', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 egun barru', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'gaur 12:00etan', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'gaur 12:25etan', 'now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'gaur 13:00etan', 'now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'bihar 12:00etan', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'gaur 11:00etan', 'now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'atzo 12:00etan', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT[etan]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fa'); - - test('parse', function (assert) { - var tests = 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month()); - } - for (i = 0; i < 12; i++) { - equalTest(tests[i], 'MMM', i); - equalTest(tests[i], 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'یک\u200cشنبه، فوریه ۱۴م ۲۰۱۰، ۳:۲۵:۵۰ بعد از ظهر'], - ['ddd, hA', 'یک\u200cشنبه، ۳بعد از ظهر'], - ['M Mo MM MMMM MMM', '۲ ۲م ۰۲ فوریه فوریه'], - ['YYYY YY', '۲۰۱۰ ۱۰'], - ['D Do DD', '۱۴ ۱۴م ۱۴'], - ['d do dddd ddd dd', '۰ ۰م یک\u200cشنبه یک\u200cشنبه ی'], - ['DDD DDDo DDDD', '۴۵ ۴۵م ۰۴۵'], - ['w wo ww', '۸ ۸م ۰۸'], - ['h hh', '۳ ۰۳'], - ['H HH', '۱۵ ۱۵'], - ['m mm', '۲۵ ۲۵'], - ['s ss', '۵۰ ۵۰'], - ['a A', 'بعد از ظهر بعد از ظهر'], - ['DDDo [روز سال]', '۴۵م روز سال'], - ['LTS', '۱۵:۲۵:۵۰'], - ['L', '۱۴/۰۲/۲۰۱۰'], - ['LL', '۱۴ فوریه ۲۰۱۰'], - ['LLL', '۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], - ['LLLL', 'یک\u200cشنبه، ۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], - ['l', '۱۴/۲/۲۰۱۰'], - ['ll', '۱۴ فوریه ۲۰۱۰'], - ['lll', '۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'], - ['llll', 'یک\u200cشنبه، ۱۴ فوریه ۲۰۱۰ ۱۵:۲۵'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '۱م', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '۲م', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '۳م', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '۴م', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '۵م', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '۶م', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '۷م', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '۸م', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '۹م', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '۱۰م', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '۱۱م', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '۱۲م', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '۱۳م', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '۱۴م', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '۱۵م', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '۱۶م', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '۱۷م', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '۱۸م', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '۱۹م', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '۲۰م', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '۲۱م', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '۲۲م', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '۲۳م', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '۲۴م', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '۲۵م', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '۲۶م', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '۲۷م', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '۲۸م', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '۲۹م', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '۳۰م', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '۳۱م', '31'); - }); - - test('format month', function (assert) { - var expected = 'ژانویه ژانویه_فوریه فوریه_مارس مارس_آوریل آوریل_مه مه_ژوئن ژوئن_ژوئیه ژوئیه_اوت اوت_سپتامبر سپتامبر_اکتبر اکتبر_نوامبر نوامبر_دسامبر دسامبر'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'یک\u200cشنبه یک\u200cشنبه ی_دوشنبه دوشنبه د_سه\u200cشنبه سه\u200cشنبه س_چهارشنبه چهارشنبه چ_پنج\u200cشنبه پنج\u200cشنبه پ_جمعه جمعه ج_شنبه شنبه ش'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چندین ثانیه', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'یک دقیقه', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'یک دقیقه', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '۲ دقیقه', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '۴۴ دقیقه', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'یک ساعت', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'یک ساعت', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '۲ ساعت', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '۵ ساعت', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '۲۱ ساعت', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'یک روز', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'یک روز', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '۲ روز', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'یک روز', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '۵ روز', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '۲۵ روز', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'یک ماه', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'یک ماه', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'یک ماه', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '۲ ماه', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '۲ ماه', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '۳ ماه', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'یک ماه', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '۵ ماه', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'یک سال', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '۲ سال', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'یک سال', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '۵ سال', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'در چندین ثانیه', 'prefix'); - assert.equal(moment(0).from(30000), 'چندین ثانیه پیش', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'چندین ثانیه پیش', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'در چندین ثانیه', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'در ۵ روز', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'امروز ساعت ۱۲:۰۰', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'امروز ساعت ۱۲:۲۵', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'امروز ساعت ۱۳:۰۰', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'فردا ساعت ۱۲:۰۰', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'امروز ساعت ۱۱:۰۰', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'دیروز ساعت ۱۲:۰۰', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ساعت] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [پیش ساعت] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '۱ ۰۱ ۱م', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '۱ ۰۱ ۱م', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '۲ ۰۲ ۲م', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '۲ ۰۲ ۲م', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '۳ ۰۳ ۳م', 'Jan 14 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fi'); - - test('parse', function (assert) { - var tests = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'sunnuntai, helmikuu 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'su, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 helmikuu helmi'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sunnuntai su su'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[vuoden] DDDo [päivä]', 'vuoden 45. päivä'], - ['LTS', '15.25.50'], - ['L', '14.02.2010'], - ['LL', '14. helmikuuta 2010'], - ['LLL', '14. helmikuuta 2010, klo 15.25'], - ['LLLL', 'sunnuntai, 14. helmikuuta 2010, klo 15.25'], - ['l', '14.2.2010'], - ['ll', '14. helmi 2010'], - ['lll', '14. helmi 2010, klo 15.25'], - ['llll', 'su, 14. helmi 2010, klo 15.25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31st'); - }); - - test('format month', function (assert) { - var expected = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'sunnuntai su su_maanantai ma ma_tiistai ti ti_keskiviikko ke ke_torstai to to_perjantai pe pe_lauantai la la'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'muutama sekunti', '44 seconds = few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuutti', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuutti', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'kaksi minuuttia', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuuttia', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'tunti', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'tunti', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'kaksi tuntia', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'viisi tuntia', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tuntia', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'päivä', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'päivä', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'kaksi päivää', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'päivä', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'viisi päivää', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 päivää', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'kuukausi', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'kuukausi', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'kuukausi', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'kaksi kuukautta', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'kaksi kuukautta', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'kolme kuukautta', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'kuukausi', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'viisi kuukautta', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'vuosi', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'kaksi vuotta', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'vuosi', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'viisi vuotta', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'muutaman sekunnin päästä', 'prefix'); - assert.equal(moment(0).from(30000), 'muutama sekunti sitten', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'muutama sekunti sitten', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'muutaman sekunnin päästä', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'viiden päivän päästä', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'tänään klo 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'tänään klo 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'tänään klo 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'huomenna klo 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'tänään klo 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'eilen klo 12.00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [klo] LT'), 'today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), 'today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'yksi viikko sitten'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'yhden viikon päästä'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'kaksi viikkoa sitten'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'kaden viikon päästä'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fo'); - - test('parse', function (assert) { - var tests = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd [tann] Do MMMM YYYY, h:mm:ss a', 'sunnudagur tann 14. februar 2010, 3:25:50 pm'], - ['ddd hA', 'sun 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sunnudagur sun su'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[tann] DDDo [dagin á árinum]', 'tann 45. dagin á árinum'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 februar 2010'], - ['LLL', '14 februar 2010 15:25'], - ['LLLL', 'sunnudagur 14. februar, 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 feb 2010'], - ['lll', '14 feb 2010 15:25'], - ['llll', 'sun 14. feb, 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'sunnudagur sun su_mánadagur mán má_týsdagur týs tý_mikudagur mik mi_hósdagur hós hó_fríggjadagur frí fr_leygardagur ley le'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'fá sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ein minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ein minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuttir', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuttir', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ein tími', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ein tími', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tímar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tímar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tímar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein dagur', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein dagur', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein dagur', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein mánaði', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein mánaði', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein mánaði', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánaðir', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánaðir', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánaðir', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein mánaði', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánaðir', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eitt ár', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ár', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eitt ár', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ár', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'um fá sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'fá sekund síðani', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fá sekund síðani', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'um fá sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'um 5 dagar', 'in 5 days'); - }); - - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Í dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Í dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Í dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Í morgin kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Í dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Í gjár kl. 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[síðstu] dddd [kl] LT'), 'today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'yksi viikko sitten'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'yhden viikon päästä'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'kaksi viikkoa sitten'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'kaden viikon päästä'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fr-ca'); - - test('parse', function (assert) { - var i, - tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14e 2010, 3:25:50 pm'], - ['ddd, hA', 'dim., 3PM'], - ['M Mo MM MMMM MMM', '2 2e 02 février févr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14e 14'], - ['d do dddd ddd dd', '0 0e dimanche dim. Di'], - ['DDD DDDo DDDD', '45 45e 045'], - ['w wo ww', '8 8e 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45e day of the year'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14 février 2010'], - ['LLL', '14 février 2010 15:25'], - ['LLLL', 'dimanche 14 février 2010 15:25'], - ['l', '2010-2-14'], - ['ll', '14 févr. 2010'], - ['lll', '14 févr. 2010 15:25'], - ['llll', 'dim. 14 févr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2e', '2e'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4e', '4e'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5e', '5e'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6e', '6e'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7e', '7e'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8e', '8e'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9e', '9e'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10e', '10e'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11e', '11e'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12e', '12e'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13e', '13e'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14e', '14e'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15e', '15e'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16e', '16e'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17e', '17e'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18e', '18e'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19e', '19e'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20e', '20e'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21e', '21e'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22e', '22e'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23e', '23e'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24e', '24e'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25e', '25e'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26e', '26e'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27e', '27e'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28e', '28e'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29e', '29e'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30e', '30e'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31e', '31e'); - }); - - test('format month', function (assert) { - var i, - expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'quelques secondes', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'une minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'une minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'une heure', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'une heure', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 heures', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 heures', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 heures', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un jour', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un jour', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 jours', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un jour', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 jours', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 jours', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mois', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mois', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mois', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mois', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mois', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mois', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mois', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mois', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ans', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ans', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dans quelques secondes', 'prefix'); - assert.equal(moment(0).from(30000), 'il y a quelques secondes', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); - }); - - test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Aujourd\'hui à 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'yesterday at the same time'); - }); - - test('same next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('same last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('same all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1er', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1er', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2e', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2e', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3e', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fr-ch'); - - test('parse', function (assert) { - var i, - tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14e 2010, 3:25:50 pm'], - ['ddd, hA', 'dim., 3PM'], - ['M Mo MM MMMM MMM', '2 2e 02 février févr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14e 14'], - ['d do dddd ddd dd', '0 0e dimanche dim. Di'], - ['DDD DDDo DDDD', '45 45e 045'], - ['w wo ww', '6 6e 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45e day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 février 2010'], - ['LLL', '14 février 2010 15:25'], - ['LLLL', 'dimanche 14 février 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 févr. 2010'], - ['lll', '14 févr. 2010 15:25'], - ['llll', 'dim. 14 févr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2e', '2e'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4e', '4e'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5e', '5e'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6e', '6e'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7e', '7e'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8e', '8e'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9e', '9e'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10e', '10e'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11e', '11e'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12e', '12e'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13e', '13e'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14e', '14e'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15e', '15e'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16e', '16e'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17e', '17e'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18e', '18e'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19e', '19e'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20e', '20e'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21e', '21e'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22e', '22e'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23e', '23e'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24e', '24e'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25e', '25e'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26e', '26e'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27e', '27e'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28e', '28e'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29e', '29e'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30e', '30e'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31e', '31e'); - }); - - test('format month', function (assert) { - var i, - expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'quelques secondes', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'une minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'une minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'une heure', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'une heure', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 heures', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 heures', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 heures', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un jour', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un jour', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 jours', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un jour', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 jours', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 jours', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mois', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mois', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mois', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mois', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mois', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mois', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mois', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mois', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ans', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ans', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dans quelques secondes', 'prefix'); - assert.equal(moment(0).from(30000), 'il y a quelques secondes', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); - }); - - test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Aujourd\'hui à 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'yesterday at the same time'); - }); - - test('same next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('same last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('same all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52e', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1er', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1er', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2e', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2e', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fr'); - - test('parse', function (assert) { - var tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14 2010, 3:25:50 pm'], - ['ddd, hA', 'dim., 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 février févr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 dimanche dim. Di'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 février 2010'], - ['LLL', '14 février 2010 15:25'], - ['LLLL', 'dimanche 14 février 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 févr. 2010'], - ['lll', '14 févr. 2010 15:25'], - ['llll', 'dim. 14 févr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'quelques secondes', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'une minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'une minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'une heure', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'une heure', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 heures', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 heures', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 heures', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un jour', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un jour', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 jours', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un jour', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 jours', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 jours', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mois', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mois', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mois', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mois', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mois', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mois', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mois', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mois', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ans', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ans', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dans quelques secondes', 'prefix'); - assert.equal(moment(0).from(30000), 'il y a quelques secondes', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dans quelques secondes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dans 5 jours', 'in 5 days'); - }); - - test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Aujourd\'hui à 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Aujourd\'hui à 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Aujourd\'hui à 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Demain à 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Aujourd\'hui à 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hier à 12:00', 'yesterday at the same time'); - }); - - test('same next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('same last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [dernier à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('same all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1er', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1er', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('fy'); - - test('parse', function (assert) { - var tests = 'jannewaris jan._febrewaris feb._maart mrt._april apr._maaie mai._juny jun._july jul._augustus aug._septimber sep._oktober okt._novimber nov._desimber des.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, HH:mm:ss', 'snein, febrewaris 14de 2010, 15:25:50'], - ['ddd, HH', 'si., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 febrewaris feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de snein si. Si'], - ['DDD DDDo DDDD', '45 45ste 045'], - ['w wo ww', '6 6de 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45ste day of the year'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '14 febrewaris 2010'], - ['LLL', '14 febrewaris 2010 15:25'], - ['LLLL', 'snein 14 febrewaris 2010 15:25'], - ['l', '14-2-2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'si. 14 feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14de', '14de'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ste', '24ste'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste'); - }); - - test('format month', function (assert) { - var expected = 'jannewaris jan._febrewaris feb._maart mrt._april apr._maaie mai_juny jun._july jul._augustus aug._septimber sep._oktober okt._novimber nov._desimber des.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'snein si. Si_moandei mo. Mo_tiisdei ti. Ti_woansdei wo. Wo_tongersdei to. To_freed fr. Fr_sneon so. So'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'in pear sekonden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ien minút', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ien minút', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ien oere', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ien oere', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 oeren', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 oeren', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 oeren', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ien dei', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ien dei', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagen', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ien dei', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagen', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagen', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ien moanne', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ien moanne', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ien moanne', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 moannen', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 moannen', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 moannen', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ien moanne', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 moannen', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ien jier', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jierren', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ien jier', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jierren', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'oer in pear sekonden', 'prefix'); - assert.equal(moment(0).from(30000), 'in pear sekonden lyn', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'in pear sekonden lyn', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'oer in pear sekonden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'oer 5 dagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'hjoed om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hjoed om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hjoed om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'moarn om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hjoed om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'juster om 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ôfrûne] dddd [om] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('month abbreviation', function (assert) { - assert.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot'); - assert.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ste', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1ste', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1ste', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2de', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('gd'); - - var months = [ - 'Am Faoilleach,Faoi', - 'An Gearran,Gear', - 'Am Màrt,Màrt', - 'An Giblean,Gibl', - 'An Cèitean,Cèit', - 'An t-Ògmhios,Ògmh', - 'An t-Iuchar,Iuch', - 'An Lùnastal,Lùn', - 'An t-Sultain,Sult', - 'An Dàmhair,Dàmh', - 'An t-Samhain,Samh', - 'An Dùbhlachd,Dùbh' - ]; - - test('parse', function (assert) { - function equalTest(monthName, monthFormat, monthNum) { - assert.equal(moment(monthName, monthFormat).month(), monthNum, monthName + ' should be month ' + (monthNum + 1)); - } - - for (var i = 0; i < 12; i++) { - var testMonth = months[i].split(','); - equalTest(testMonth[0], 'MMM', i); - equalTest(testMonth[1], 'MMM', i); - equalTest(testMonth[0], 'MMMM', i); - equalTest(testMonth[1], 'MMMM', i); - equalTest(testMonth[0].toLocaleLowerCase(), 'MMMM', i); - equalTest(testMonth[1].toLocaleLowerCase(), 'MMMM', i); - equalTest(testMonth[0].toLocaleUpperCase(), 'MMMM', i); - equalTest(testMonth[1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Didòmhnaich, An Gearran 14mh 2010, 3:25:50 pm'], - ['ddd, hA', 'Did, 3PM'], - ['M Mo MM MMMM MMM', '2 2na 02 An Gearran Gear'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14mh 14'], - ['d do dddd ddd dd', '0 0mh Didòmhnaich Did Dò'], - ['DDD DDDo DDDD', '45 45mh 045'], - ['w wo ww', '6 6mh 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[an] DDDo [latha den bhliadhna]', 'an 45mh latha den bhliadhna'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 An Gearran 2010'], - ['LLL', '14 An Gearran 2010 15:25'], - ['LLLL', 'Didòmhnaich, 14 An Gearran 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Gear 2010'], - ['lll', '14 Gear 2010 15:25'], - ['llll', 'Did, 14 Gear 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1d', '1d'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2na', '2na'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3mh', '3mh'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4mh', '4mh'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5mh', '5mh'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6mh', '6mh'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7mh', '7mh'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8mh', '8mh'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9mh', '9mh'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10mh', '10mh'); - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11mh', '11mh'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12na', '12na'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13mh', '13mh'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14mh', '14mh'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15mh', '15mh'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16mh', '16mh'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17mh', '17mh'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18mh', '18mh'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19mh', '19mh'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20mh', '20mh'); - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21mh', '21mh'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22na', '22na'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23mh', '23mh'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24mh', '24mh'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25mh', '25mh'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26mh', '26mh'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27mh', '27mh'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28mh', '28mh'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29mh', '29mh'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30mh', '30mh'); - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31mh', '31mh'); - }); - - test('format month', function (assert) { - var expected = months; - for (var i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM,MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = ['Didòmhnaich Did Dò', 'Diluain Dil Lu', 'Dimàirt Dim Mà', 'Diciadain Dic Ci', 'Diardaoin Dia Ar', 'Dihaoine Dih Ha', 'Disathairne Dis Sa']; - for (var i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'beagan diogan', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'mionaid', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'mionaid', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mionaidean', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mionaidean', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'uair', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uair', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uairean', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uairean', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uairean', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'latha', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'latha', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 latha', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'latha', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 latha', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 latha', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mìos', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mìos', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mìos', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mìosan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mìosan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mìosan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mìos', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mìosan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bliadhna', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 bliadhna', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bliadhna', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 bliadhna', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ann an beagan diogan', 'prefix'); - assert.equal(moment(0).from(30000), 'bho chionn beagan diogan', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'bho chionn beagan diogan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ann an beagan diogan', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ann an 5 latha', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'An-diugh aig 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'An-diugh aig 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'An-diugh aig 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'A-màireach aig 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'An-diugh aig 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'An-dè aig 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [aig] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [aig] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [aig] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [seo chaidh] [aig] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52na', 'Faoi 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1d', 'Faoi 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1d', 'Faoi 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2na', 'Faoi 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2na', 'Faoi 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('gl'); - - test('parse', function (assert) { - var tests = 'Xaneiro Xan._Febreiro Feb._Marzo Mar._Abril Abr._Maio Mai._Xuño Xuñ._Xullo Xul._Agosto Ago._Setembro Set._Outubro Out._Novembro Nov._Decembro Dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Febreiro 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom., 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Febreiro Feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º Domingo Dom. Do'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '7 7º 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Febreiro 2010'], - ['LLL', '14 Febreiro 2010 15:25'], - ['LLLL', 'Domingo 14 Febreiro 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Feb. 2010'], - ['lll', '14 Feb. 2010 15:25'], - ['llll', 'Dom. 14 Feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); - }); - - test('format month', function (assert) { - var expected = 'Xaneiro Xan._Febreiro Feb._Marzo Mar._Abril Abr._Maio Mai._Xuño Xuñ._Xullo Xul._Agosto Ago._Setembro Set._Outubro Out._Novembro Nov._Decembro Dec.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Domingo Dom. Do_Luns Lun. Lu_Martes Mar. Ma_Mércores Mér. Mé_Xoves Xov. Xo_Venres Ven. Ve_Sábado Sáb. Sá'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'uns segundos', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'unha hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'unha hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un día', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un día', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 días', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un día', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 días', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 días', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un ano', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anos', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un ano', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anos', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'nuns segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'hai uns segundos', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'hai uns segundos', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'nuns segundos', 'en unos segundos'); - assert.equal(moment().add({d: 5}).fromNow(), 'en 5 días', 'en 5 días'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'hoxe ás 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'hoxe ás 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'hoxe ás 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mañá ás 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).add({d: 1, h : -1}).calendar(), 'mañá ás 11:00', 'tomorrow minus 1 hour'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'hoxe ás 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'onte á 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('regression tests', function (assert) { - var lastWeek = moment().subtract({d: 4}).hours(1); - assert.equal(lastWeek.calendar(), lastWeek.format('[o] dddd [pasado a] LT'), '1 o\'clock bug'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1º', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1º', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2º', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2º', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3º', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('he'); - - test('parse', function (assert) { - var tests = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ראשון, פברואר 14 2010, 3:25:50 אחה"צ'], - ['ddd, h A', 'א׳, 3 אחרי הצהריים'], - ['M Mo MM MMMM MMM', '2 2 02 פברואר פבר׳'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 ראשון א׳ א'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'אחה"צ אחרי הצהריים'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 בפברואר 2010'], - ['LLL', '14 בפברואר 2010 15:25'], - ['LLLL', 'ראשון, 14 בפברואר 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 פבר׳ 2010'], - ['lll', '14 פבר׳ 2010 15:25'], - ['llll', 'א׳, 14 פבר׳ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ראשון א׳ א|שני ב׳ ב|שלישי ג׳ ג|רביעי ד׳ ד|חמישי ה׳ ה|שישי ו׳ ו|שבת ש׳ ש'.split('|'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'מספר שניות', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'דקה', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'דקה', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 דקות', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 דקות', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'שעה', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'שעה', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'שעתיים', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 שעות', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 שעות', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'יום', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'יום', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'יומיים', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'יום', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ימים', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ימים', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'חודש', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'חודש', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'חודש', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'חודשיים', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'חודשיים', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 חודשים', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'חודש', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 חודשים', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'שנה', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'שנתיים', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 3699}), true), '10 שנים', '345 days = 10 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 7340}), true), '20 שנה', '548 days = 20 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'שנה', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 שנים', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'בעוד מספר שניות', 'prefix'); - assert.equal(moment(0).from(30000), 'לפני מספר שניות', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'לפני מספר שניות', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'בעוד מספר שניות', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'בעוד 5 ימים', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'היום ב־12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'היום ב־12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'היום ב־13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'מחר ב־12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'היום ב־11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'אתמול ב־12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [בשעה] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ביום] dddd [האחרון בשעה] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('hi'); - - test('parse', function (assert) { - var tests = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss बजे', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५:५० बजे'], - ['ddd, a h बजे', 'रवि, दोपहर ३ बजे'], - ['M Mo MM MMMM MMM', '२ २ ०२ फ़रवरी फ़र.'], - ['YYYY YY', '२०१० १०'], - ['D Do DD', '१४ १४ १४'], - ['d do dddd ddd dd', '० ० रविवार रवि र'], - ['DDD DDDo DDDD', '४५ ४५ ०४५'], - ['w wo ww', '८ ८ ०८'], - ['h hh', '३ ०३'], - ['H HH', '१५ १५'], - ['m mm', '२५ २५'], - ['s ss', '५० ५०'], - ['a A', 'दोपहर दोपहर'], - ['LTS', 'दोपहर ३:२५:५० बजे'], - ['L', '१४/०२/२०१०'], - ['LL', '१४ फ़रवरी २०१०'], - ['LLL', '१४ फ़रवरी २०१०, दोपहर ३:२५ बजे'], - ['LLLL', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५ बजे'], - ['l', '१४/२/२०१०'], - ['ll', '१४ फ़र. २०१०'], - ['lll', '१४ फ़र. २०१०, दोपहर ३:२५ बजे'], - ['llll', 'रवि, १४ फ़र. २०१०, दोपहर ३:२५ बजे'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '३', '३'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '४', '४'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '५', '५'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '६', '६'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '७', '७'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '८', '८'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '९', '९'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '१०', '१०'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '११', '११'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '१२', '१२'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '१३', '१३'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '१४', '१४'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '१५', '१५'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '१६', '१६'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '१७', '१७'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '१८', '१८'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '१९', '१९'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '२०', '२०'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '२१', '२१'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '२२', '२२'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '२३', '२३'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '२४', '२४'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '२५', '२५'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '२६', '२६'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '२७', '२७'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '२८', '२८'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '२९', '२९'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '३०', '३०'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '३१', '३१'); - }); - - test('format month', function (assert) { - var expected = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'रविवार रवि र_सोमवार सोम सो_मंगलवार मंगल मं_बुधवार बुध बु_गुरूवार गुरू गु_शुक्रवार शुक्र शु_शनिवार शनि श'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'कुछ ही क्षण', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'एक मिनट', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'एक मिनट', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '२ मिनट', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '४४ मिनट', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'एक घंटा', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'एक घंटा', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '२ घंटे', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '५ घंटे', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '२१ घंटे', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'एक दिन', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'एक दिन', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '२ दिन', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'एक दिन', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '५ दिन', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '२५ दिन', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'एक महीने', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'एक महीने', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'एक महीने', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '२ महीने', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '२ महीने', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '३ महीने', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'एक महीने', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '५ महीने', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'एक वर्ष', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '२ वर्ष', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'एक वर्ष', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '५ वर्ष', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'कुछ ही क्षण में', 'prefix'); - assert.equal(moment(0).from(30000), 'कुछ ही क्षण पहले', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'कुछ ही क्षण पहले', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'कुछ ही क्षण में', 'कुछ ही क्षण में'); - assert.equal(moment().add({d: 5}).fromNow(), '५ दिन में', '५ दिन में'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'आज दोपहर १२:०० बजे', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'आज दोपहर १२:२५ बजे', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'आज दोपहर ३:०० बजे', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'कल दोपहर १२:०० बजे', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'आज दोपहर ११:०० बजे', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'कल दोपहर १२:०० बजे', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[पिछले] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'रात', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'सुबह', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'दोपहर', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'शाम', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'शाम', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'रात', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'रात', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'सुबह', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'दोपहर', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'शाम', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'शाम', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'रात', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '१ ०१ १', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '२ ०२ २', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '२ ०२ २', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '३ ०३ ३', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('hr'); - - test('parse', function (assert) { - var tests = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. veljače 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 veljača velj.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. nedjelja ned. ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14. 02. 2010'], - ['LL', '14. veljača 2010'], - ['LLL', '14. veljača 2010 15:25'], - ['LLLL', 'nedjelja, 14. veljača 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. velj. 2010'], - ['lll', '14. velj. 2010 15:25'], - ['llll', 'ned., 14. velj. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'siječanj sij._veljača velj._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'par sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedna minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedna minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mjesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mjesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mjesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mjeseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mjeseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mjeseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mjesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mjeseci', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za par sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije par sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prije par sekundi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za par sekundi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'jučer u 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('hu'); - - test('parse', function (assert) { - var tests = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, HH:mm:ss', 'vasárnap, február 14. 2010, 15:25:50'], - ['ddd, HH', 'vas, 15'], - ['M Mo MM MMMM MMM', '2 2. 02 február feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. vasárnap vas v'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['[az év] DDDo [napja]', 'az év 45. napja'], - ['LTS', '15:25:50'], - ['L', '2010.02.14.'], - ['LL', '2010. február 14.'], - ['LLL', '2010. február 14. 15:25'], - ['LLLL', '2010. február 14., vasárnap 15:25'], - ['l', '2010.2.14.'], - ['ll', '2010. feb 14.'], - ['lll', '2010. feb 14. 15:25'], - ['llll', '2010. feb 14., vas 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), 'de', 'am'); - assert.equal(moment([2011, 2, 23, 11, 59]).format('a'), 'de', 'am'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), 'du', 'pm'); - assert.equal(moment([2011, 2, 23, 23, 59]).format('a'), 'du', 'pm'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'DE', 'AM'); - assert.equal(moment([2011, 2, 23, 11, 59]).format('A'), 'DE', 'AM'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'DU', 'PM'); - assert.equal(moment([2011, 2, 23, 23, 59]).format('A'), 'DU', 'PM'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'vasárnap vas_hétfő hét_kedd kedd_szerda sze_csütörtök csüt_péntek pén_szombat szo'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'néhány másodperc', '44 másodperc = néhány másodperc'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'egy perc', '45 másodperc = egy perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'egy perc', '89 másodperc = egy perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 perc', '90 másodperc = 2 perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 perc', '44 perc = 44 perc'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'egy óra', '45 perc = egy óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'egy óra', '89 perc = egy óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 óra', '90 perc = 2 óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 óra', '5 óra = 5 óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 óra', '21 óra = 21 óra'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'egy nap', '22 óra = egy nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'egy nap', '35 óra = egy nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 nap', '36 óra = 2 nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'egy nap', '1 nap = egy nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 nap', '5 nap = 5 nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 nap', '25 nap = 25 nap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'egy hónap', '26 nap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'egy hónap', '30 nap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'egy hónap', '45 nap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 hónap', '46 nap = 2 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 hónap', '75 nap = 2 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 hónap', '76 nap = 3 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'egy hónap', '1 hónap = egy hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 hónap', '5 hónap = 5 hónap'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'egy év', '345 nap = egy év'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 év', '548 nap = 2 év'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'egy év', '1 év = egy év'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 év', '5 év = 5 év'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'néhány másodperc múlva', 'prefix'); - assert.equal(moment(0).from(30000), 'néhány másodperce', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'néhány másodperce', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'néhány másodperc múlva', 'néhány másodperc múlva'); - assert.equal(moment().add({d: 5}).fromNow(), '5 nap múlva', '5 nap múlva'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ma 12:00-kor', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ma 12:25-kor', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ma 13:00-kor', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'holnap 12:00-kor', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ma 11:00-kor', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'tegnap 12:00-kor', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_'); - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + days[m.day()] + '] LT[-kor]'), 'today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_'); - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[múlt ' + days[m.day()] + '] LT[-kor]'), 'today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'egy héte'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'egy hét múlva'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 hete'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 hét múlva'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('hy-am'); - - test('parse', function (assert) { - var tests = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse exceptional case', function (assert) { - assert.equal(moment('11 մայիսի 1989', ['DD MMMM YYYY']).format('DD-MM-YYYY'), '11-05-1989'); - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'կիրակի, 14 փետրվարի 2010, 15:25:50'], - ['ddd, h A', 'կրկ, 3 ցերեկվա'], - ['M Mo MM MMMM MMM', '2 2 02 փետրվար փտր'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 կիրակի կրկ կրկ'], - ['DDD DDDo DDDD', '45 45-րդ 045'], - ['w wo ww', '7 7-րդ 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ցերեկվա ցերեկվա'], - ['[տարվա] DDDo [օրը]', 'տարվա 45-րդ օրը'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 փետրվարի 2010 թ.'], - ['LLL', '14 փետրվարի 2010 թ., 15:25'], - ['LLLL', 'կիրակի, 14 փետրվարի 2010 թ., 15:25'], - ['l', '14.2.2010'], - ['ll', '14 փտր 2010 թ.'], - ['lll', '14 փտր 2010 թ., 15:25'], - ['llll', 'կրկ, 14 փտր 2010 թ., 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'գիշերվա', 'night'); - assert.equal(moment([2012, 11, 28, 3, 59]).format('A'), 'գիշերվա', 'night'); - assert.equal(moment([2012, 11, 28, 4, 0]).format('A'), 'առավոտվա', 'morning'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'առավոտվա', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'ցերեկվա', 'afternoon'); - assert.equal(moment([2012, 11, 28, 16, 59]).format('A'), 'ցերեկվա', 'afternoon'); - assert.equal(moment([2012, 11, 28, 17, 0]).format('A'), 'երեկոյան', 'evening'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'երեկոյան', 'evening'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ին', '1-ին'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-րդ', '2-րդ'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-րդ', '3-րդ'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-րդ', '4-րդ'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-րդ', '5-րդ'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-րդ', '6-րդ'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-րդ', '7-րդ'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-րդ', '8-րդ'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-րդ', '9-րդ'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-րդ', '10-րդ'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-րդ', '11-րդ'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-րդ', '12-րդ'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-րդ', '13-րդ'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-րդ', '14-րդ'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-րդ', '15-րդ'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-րդ', '16-րդ'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-րդ', '17-րդ'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-րդ', '18-րդ'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-րդ', '19-րդ'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-րդ', '20-րդ'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-րդ', '21-րդ'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-րդ', '22-րդ'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-րդ', '23-րդ'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-րդ', '24-րդ'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-րդ', '25-րդ'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-րդ', '26-րդ'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-րդ', '27-րդ'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-րդ', '28-րդ'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-րդ', '29-րդ'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-րդ', '30-րդ'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-րդ', '31-րդ'); - }); - - test('format month', function (assert) { - var expected = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format month case', function (assert) { - var months = { - 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'), - 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]); - } - }); - - test('format month short case', function (assert) { - var monthsShort = { - 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - 'accusative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), monthsShort.nominative[i], '1 ' + monthsShort.nominative[i]); - } - }); - - test('format month case with escaped symbols', function (assert) { - var months = { - 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'), - 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMMM[]'), '1 ' + months.accusative[i] + '', '1 ' + months.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-ին օրը] MMMM'), '1-ին օրը ' + months.accusative[i], '1-ին օրը ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMMM'), '1, ' + months.nominative[i], '1, ' + months.nominative[i]); - } - }); - - test('format month short case with escaped symbols', function (assert) { - var monthsShort = { - 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - 'accusative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMM[]'), '1 ' + monthsShort.accusative[i] + '', '1 ' + monthsShort.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-ին օրը] MMM'), '1-ին օրը ' + monthsShort.accusative[i], '1-ին օրը ' + monthsShort.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMM'), '1, ' + monthsShort.nominative[i], '1, ' + monthsShort.nominative[i]); - } - }); - - test('format week', function (assert) { - var expected = 'կիրակի կրկ կրկ_երկուշաբթի երկ երկ_երեքշաբթի երք երք_չորեքշաբթի չրք չրք_հինգշաբթի հնգ հնգ_ուրբաթ ուրբ ուրբ_շաբաթ շբթ շբթ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'մի քանի վայրկյան', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'րոպե', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'րոպե', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 րոպե', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 րոպե', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ժամ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ժամ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ժամ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ժամ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ժամ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'օր', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'օր', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 օր', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'օր', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 օր', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 օր', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 օր', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 օր', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ամիս', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ամիս', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ամիս', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ամիս', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ամիս', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ամիս', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ամիս', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ամիս', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'տարի', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 տարի', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'տարի', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 տարի', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'մի քանի վայրկյան հետո', 'prefix'); - assert.equal(moment(0).from(30000), 'մի քանի վայրկյան առաջ', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'մի քանի վայրկյան հետո', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 օր հետո', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'այսօր 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'այսօր 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'այսօր 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'վաղը 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'այսօր 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'երեկ 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - function makeFormat(d) { - return 'dddd [օրը ժամը] LT'; - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - return '[անցած] dddd [օրը ժամը] LT'; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ին', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ին', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-րդ', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-րդ', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-րդ', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('id'); - - test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Minggu, Februari 14 2010, 3:25:50 sore'], - ['ddd, hA', 'Min, 3sore'], - ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Minggu Min Mg'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'sore sore'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Minggu, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Min, 14 Feb 2010 pukul 15.25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_November Nov_Desember Des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Minggu Min Mg_Senin Sen Sn_Selasa Sel Sl_Rabu Rab Rb_Kamis Kam Km_Jumat Jum Jm_Sabtu Sab Sb'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'beberapa detik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'semenit', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'semenit', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 menit', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 menit', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa detik', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa detik yang lalu', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa detik yang lalu', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa detik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Besok pukul 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kemarin pukul 12.00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('is'); - - test('parse', function (assert) { - var tests = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'sunnudagur, 14. febrúar 2010, 3:25:50 pm'], - ['ddd, hA', 'sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 febrúar feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sunnudagur sun Su'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. febrúar 2010'], - ['LLL', '14. febrúar 2010 kl. 15:25'], - ['LLLL', 'sunnudagur, 14. febrúar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 kl. 15:25'], - ['llll', 'sun, 14. feb 2010 kl. 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'sunnudagur sun Su_mánudagur mán Má_þriðjudagur þri Þr_miðvikudagur mið Mi_fimmtudagur fim Fi_föstudagur fös Fö_laugardagur lau La'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nokkrar sekúndur', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'mínúta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'mínúta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 mínútur', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 mínútur', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 21}), true), '21 mínúta', '21 minutes = 21 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'klukkustund', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'klukkustund', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 klukkustundir', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 klukkustundir', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 klukkustund', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dagur', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dagur', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dagur', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 dagar', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 dagur', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mánuður', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mánuður', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mánuður', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánuðir', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánuðir', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánuðir', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mánuður', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánuðir', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ár', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ár', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ár', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ár', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 21}), true), '21 ár', '21 years = 21 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'eftir nokkrar sekúndur', 'prefix'); - assert.equal(moment(0).from(30000), 'fyrir nokkrum sekúndum síðan', 'suffix'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'fyrir mínútu síðan', 'a minute ago'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'fyrir nokkrum sekúndum síðan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'eftir nokkrar sekúndur', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'eftir mínútu', 'in a minute'); - assert.equal(moment().add({d: 5}).fromNow(), 'eftir 5 daga', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'í dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'í dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'í dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'á morgun kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'í dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'í gær kl. 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('it'); - - test('parse', function (assert) { - var tests = 'gennaio gen_febbraio feb_marzo mar_aprile apr_maggio mag_giugno giu_luglio lug_agosto ago_settembre set_ottobre ott_novembre nov_dicembre dic'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domenica, febbraio 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 febbraio feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd dd', '0 0º Domenica Dom Do'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '6 6º 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 febbraio 2010'], - ['LLL', '14 febbraio 2010 15:25'], - ['LLLL', 'Domenica, 14 febbraio 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 feb 2010'], - ['lll', '14 feb 2010 15:25'], - ['llll', 'Dom, 14 feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); - }); - - test('format month', function (assert) { - var expected = 'gennaio gen_febbraio feb_marzo mar_aprile apr_maggio mag_giugno giu_luglio lug_agosto ago_settembre set_ottobre ott_novembre nov_dicembre dic'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Domenica Dom Do_Lunedì Lun Lu_Martedì Mar Ma_Mercoledì Mer Me_Giovedì Gio Gi_Venerdì Ven Ve_Sabato Sab Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'alcuni secondi', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuti', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuti', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'un\'ora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'un\'ora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ore', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ore', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ore', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'un giorno', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'un giorno', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 giorni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'un giorno', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 giorni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 giorni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'un mese', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'un mese', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'un mese', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesi', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesi', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesi', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'un mese', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesi', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un anno', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anni', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un anno', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anni', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'in alcuni secondi', 'prefix'); - assert.equal(moment(0).from(30000), 'alcuni secondi fa', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'in alcuni secondi', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'tra 5 giorni', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Oggi alle 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Oggi alle 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Oggi alle 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Domani alle 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Oggi alle 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ieri alle 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [alle] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [alle] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [alle] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - // Different date string - weekday = parseInt(m.format('d'), 10); - datestring = (weekday === 0) ? '[la scorsa] dddd [alle] LT' : '[lo scorso] dddd [alle] LT'; - assert.equal(m.calendar(), m.format(datestring), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(datestring), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ja'); - - test('parse', function (assert) { - var tests = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, a h:mm:ss', '日曜日, 2月 14日 2010, 午後 3:25:50'], - ['ddd, Ah', '日, 午後3'], - ['M Mo MM MMMM MMM', '2 2 02 2月 2月'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14日 14'], - ['d do dddd ddd dd', '0 0日 日曜日 日 日'], - ['DDD DDDo DDDD', '45 45日 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', '午後 午後'], - ['[the] DDDo [day of the year]', 'the 45日 day of the year'], - ['LTS', '午後3時25分50秒'], - ['L', '2010/02/14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日午後3時25分'], - ['LLLL', '2010年2月14日午後3時25分 日曜日'], - ['l', '2010/2/14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日午後3時25分'], - ['llll', '2010年2月14日午後3時25分 日'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = '日曜日 日 日_月曜日 月 月_火曜日 火 火_水曜日 水 水_木曜日 木 木_金曜日 金 金_土曜日 土 土'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '数秒', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1分', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1分', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2分', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44分', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '1時間', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1時間', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2時間', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5時間', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21時間', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1日', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1日', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2日', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1日', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5日', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25日', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '1ヶ月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1ヶ月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1ヶ月', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2ヶ月', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2ヶ月', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3ヶ月', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '1ヶ月', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5ヶ月', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '1年', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2年', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '1年', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5年', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), '数秒後', 'prefix'); - assert.equal(moment(0).from(30000), '数秒前', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), '数秒前', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), '数秒後', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5日後', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), '今日 午後12時0分', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), '今日 午後12時25分', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), '今日 午後1時0分', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), '明日 午後12時0分', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), '今日 午前11時0分', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), '昨日 午後12時0分', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[来週]dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[来週]dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[来週]dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[前週]dddd LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[前週]dddd LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[前週]dddd LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('jv'); - - test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_Nopember Nop_Desember Des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Minggu, Februari 14 2010, 3:25:50 sonten'], - ['ddd, hA', 'Min, 3sonten'], - ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Minggu Min Mg'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'sonten sonten'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Minggu, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Min, 14 Feb 2010 pukul 15.25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_Nopember Nop_Desember Des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Minggu Min Mg_Senen Sen Sn_Seloso Sel Sl_Rebu Reb Rb_Kemis Kem Km_Jemuwah Jem Jm_Septu Sep Sp'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'sawetawis detik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'setunggal menit', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'setunggal menit', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 menit', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 menit', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'setunggal jam', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'setunggal jam', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sedinten', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sedinten', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dinten', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sedinten', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dinten', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dinten', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sewulan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sewulan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sewulan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 wulan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 wulan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 wulan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sewulan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 wulan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setaun', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 taun', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setaun', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 taun', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'wonten ing sawetawis detik', 'prefix'); - assert.equal(moment(0).from(30000), 'sawetawis detik ingkang kepengker', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'sawetawis detik ingkang kepengker', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'wonten ing sawetawis detik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'wonten ing 5 dinten', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Dinten puniko pukul 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Dinten puniko pukul 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Dinten puniko pukul 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Mbenjang pukul 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dinten puniko pukul 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kala wingi pukul 12.00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kepengker pukul] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 1st is the first week of the year. - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ka'); - - test('parse', function (assert) { - var i, - tests = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' უნდა იყოს თვე ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'კვირა, თებერვალი მე-14 2010, 3:25:50 pm'], - ['ddd, hA', 'კვი, 3PM'], - ['M Mo MM MMMM MMM', '2 მე-2 02 თებერვალი თებ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 მე-14 14'], - ['d do dddd ddd dd', '0 0 კვირა კვი კვ'], - ['DDD DDDo DDDD', '45 45-ე 045'], - ['w wo ww', '7 მე-7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['წლის DDDo დღე', 'წლის 45-ე დღე'], - ['LTS', '3:25:50 PM'], - ['L', '14/02/2010'], - ['LL', '14 თებერვალს 2010'], - ['LLL', '14 თებერვალს 2010 3:25 PM'], - ['LLLL', 'კვირა, 14 თებერვალს 2010 3:25 PM'], - ['l', '14/2/2010'], - ['ll', '14 თებ 2010'], - ['lll', '14 თებ 2010 3:25 PM'], - ['llll', 'კვი, 14 თებ 2010 3:25 PM'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ლი', '1-ლი'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), 'მე-2', 'მე-2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), 'მე-3', 'მე-3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), 'მე-4', 'მე-4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), 'მე-5', 'მე-5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), 'მე-6', 'მე-6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), 'მე-7', 'მე-7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), 'მე-8', 'მე-8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), 'მე-9', 'მე-9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), 'მე-10', 'მე-10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), 'მე-11', 'მე-11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), 'მე-12', 'მე-12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), 'მე-13', 'მე-13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), 'მე-14', 'მე-14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), 'მე-15', 'მე-15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), 'მე-16', 'მე-16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), 'მე-17', 'მე-17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), 'მე-18', 'მე-18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), 'მე-19', 'მე-19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), 'მე-20', 'მე-20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-ე', '21-ე'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-ე', '22-ე'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-ე', '23-ე'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-ე', '24-ე'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-ე', '25-ე'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ე', '26-ე'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-ე', '27-ე'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-ე', '28-ე'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-ე', '29-ე'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-ე', '30-ე'); - - assert.equal(moment('2011 40', 'YYYY DDD').format('DDDo'), 'მე-40', 'მე-40'); - assert.equal(moment('2011 50', 'YYYY DDD').format('DDDo'), '50-ე', '50-ე'); - assert.equal(moment('2011 60', 'YYYY DDD').format('DDDo'), 'მე-60', 'მე-60'); - assert.equal(moment('2011 100', 'YYYY DDD').format('DDDo'), 'მე-100', 'მე-100'); - assert.equal(moment('2011 101', 'YYYY DDD').format('DDDo'), '101-ე', '101-ე'); - }); - - test('format month', function (assert) { - var i, - expected = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'კვირა კვი კვ_ორშაბათი ორშ ორ_სამშაბათი სამ სა_ოთხშაბათი ოთხ ოთ_ხუთშაბათი ხუთ ხუ_პარასკევი პარ პა_შაბათი შაბ შა'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'რამდენიმე წამი', '44 წამი = რამდენიმე წამი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'წუთი', '45 წამი = წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'წუთი', '89 წამი = წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 წუთი', '90 წამი = 2 წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 წუთი', '44 წამი = 44 წუთი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'საათი', '45 წამი = საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'საათი', '89 წამი = საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 საათი', '90 წამი = 2 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 საათი', '5 საათი = 5 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 საათი', '21 საათი = 21 საათი'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'დღე', '22 საათი = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'დღე', '35 საათი = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 დღე', '36 საათი = 2 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'დღე', '1 დღე = დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 დღე', '5 დღე = 5 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 დღე', '25 დღე = 25 დღე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'თვე', '26 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'თვე', '30 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'თვე', '45 დღე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 თვე', '46 დღე = 2 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 თვე', '75 დღე = 2 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 თვე', '76 დღე = 3 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'თვე', '1 თვე = თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 თვე', '5 თვე = 5 თვე'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'წელი', '345 დღე = წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 წელი', '548 დღე = 2 წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'წელი', '1 წელი = წელი'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 წელი', '5 წელი = 5 წელი'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'რამდენიმე წამში', 'ში სუფიქსი'); - assert.equal(moment(0).from(30000), 'რამდენიმე წამის წინ', 'წინ სუფიქსი'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'რამდენიმე წამის წინ', 'უნდა აჩვენოს როგორც წარსული'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'რამდენიმე წამში', 'რამდენიმე წამში'); - assert.equal(moment().add({d: 5}).fromNow(), '5 დღეში', '5 დღეში'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'დღეს 12:00 PM-ზე', 'დღეს ამავე დროს'); - assert.equal(moment(a).add({m: 25}).calendar(), 'დღეს 12:25 PM-ზე', 'ახლანდელ დროს დამატებული 25 წუთი'); - assert.equal(moment(a).add({h: 1}).calendar(), 'დღეს 1:00 PM-ზე', 'ახლანდელ დროს დამატებული 1 საათი'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ხვალ 12:00 PM-ზე', 'ხვალ ამავე დროს'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'დღეს 11:00 AM-ზე', 'ახლანდელ დროს გამოკლებული 1 საათი'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'გუშინ 12:00 PM-ზე', 'გუშინ ამავე დროს'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე ახლანდელ დროს'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე დღის დასაწყისში'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[შემდეგ] dddd LT[-ზე]'), 'დღეს + ' + i + ' დღე დღის დასასრულს'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე ახლანდელ დროს'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე დღის დასაწყისში'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[წინა] dddd LT[-ზე]'), 'დღეს - ' + i + ' დღე დღის დასასრულს'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 კვირის წინ'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '1 კვირაში'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 კვირის წინ'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '2 კვირაში'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ლი', 'დეკ 26 2011 უნდა იყოს კვირა 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ლი', 'იან 1 2012 უნდა იყოს კვირა 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 მე-2', 'იან 2 2012 უნდა იყოს კვირა 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 მე-2', 'იან 8 2012 უნდა იყოს კვირა 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 მე-3', 'იან 9 2012 უნდა იყოს კვირა 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('kk'); - - test('parse', function (assert) { - var tests = 'қаңтар қаң_ақпан ақп_наурыз нау_сәуір сәу_мамыр мам_маусым мау_шілде шіл_тамыз там_қыркүйек қыр_қазан қаз_қараша қар_желтоқсан жел'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'жексенбі, 14-ші ақпан 2010, 15:25:50'], - ['ddd, hA', 'жек, 3PM'], - ['M Mo MM MMMM MMM', '2 2-ші 02 ақпан ақп'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-ші 14'], - ['d do dddd ddd dd', '0 0-ші жексенбі жек жк'], - ['DDD DDDo DDDD', '45 45-ші 045'], - ['w wo ww', '7 7-ші 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[жылдың] DDDo [күні]', 'жылдың 45-ші күні'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 ақпан 2010'], - ['LLL', '14 ақпан 2010 15:25'], - ['LLLL', 'жексенбі, 14 ақпан 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 ақп 2010'], - ['lll', '14 ақп 2010 15:25'], - ['llll', 'жек, 14 ақп 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ші', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-ші', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-ші', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-ші', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-ші', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-шы', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-ші', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-ші', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-шы', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-шы', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-ші', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-ші', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-ші', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-ші', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-ші', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-шы', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-ші', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-ші', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-шы', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-шы', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-ші', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-ші', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-ші', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-ші', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-ші', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-шы', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-ші', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-ші', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-шы', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-шы', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-ші', '31st'); - }); - - test('format month', function (assert) { - var expected = 'қаңтар қаң_ақпан ақп_наурыз нау_сәуір сәу_мамыр мам_маусым мау_шілде шіл_тамыз там_қыркүйек қыр_қазан қаз_қараша қар_желтоқсан жел'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'жексенбі жек жк_дүйсенбі дүй дй_сейсенбі сей сй_сәрсенбі сәр ср_бейсенбі бей бй_жұма жұм жм_сенбі сен сн'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'бірнеше секунд', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'бір минут', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'бір минут', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 минут', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 минут', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'бір сағат', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'бір сағат', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 сағат', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 сағат', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 сағат', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'бір күн', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'бір күн', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 күн', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'бір күн', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 күн', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 күн', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'бір ай', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'бір ай', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'бір ай', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ай', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ай', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ай', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'бір ай', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ай', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'бір жыл', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 жыл', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'бір жыл', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 жыл', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'бірнеше секунд ішінде', 'prefix'); - assert.equal(moment(0).from(30000), 'бірнеше секунд бұрын', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'бірнеше секунд бұрын', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'бірнеше секунд ішінде', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 күн ішінде', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Бүгін сағат 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Бүгін сағат 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Бүгін сағат 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ертең сағат 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бүгін сағат 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кеше сағат 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [сағат] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [сағат] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [сағат] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Өткен аптаның] dddd [сағат] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Өткен аптаның] dddd [сағат] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Өткен аптаның] dddd [сағат] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ші', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-ші', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-ші', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-ші', 'Jan 9 2012 should be week 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3-ші', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('km'); - - test('parse', function (assert) { - var tests = 'មករា មករា_កុម្ភៈ កុម្ភៈ_មីនា មីនា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split('_'), - i; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'អាទិត្យ, កុម្ភៈ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'អាទិត្យ, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 កុម្ភៈ កុម្ភៈ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 អាទិត្យ អាទិត្យ អាទិត្យ'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 កុម្ភៈ 2010'], - ['LLL', '14 កុម្ភៈ 2010 15:25'], - ['LLLL', 'អាទិត្យ, 14 កុម្ភៈ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 កុម្ភៈ 2010'], - ['lll', '14 កុម្ភៈ 2010 15:25'], - ['llll', 'អាទិត្យ, 14 កុម្ភៈ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31st'); - }); - - test('format month', function (assert) { - var expected = 'មករា មករា_កុម្ភៈ កុម្ភៈ_មីនា មីនា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'អាទិត្យ អាទិត្យ អាទិត្យ_ច័ន្ទ ច័ន្ទ ច័ន្ទ_អង្គារ អង្គារ អង្គារ_ពុធ ពុធ ពុធ_ព្រហស្បតិ៍ ព្រហស្បតិ៍ ព្រហស្បតិ៍_សុក្រ សុក្រ សុក្រ_សៅរ៍ សៅរ៍ សៅរ៍'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ប៉ុន្មានវិនាទី', '44 seconds = ប៉ុន្មានវិនាទី'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'មួយនាទី', '45 seconds = មួយនាទី'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'មួយនាទី', '89 seconds = មួយនាទី'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 នាទី', '90 seconds = 2 នាទី'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 នាទី', '44 minutes = 44 នាទី'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'មួយម៉ោង', '45 minutes = មួយម៉ោង'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'មួយម៉ោង', '89 minutes = មួយម៉ោង'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ម៉ោង', '90 minutes = 2 ម៉ោង'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ម៉ោង', '5 hours = 5 ម៉ោង'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ម៉ោង', '21 hours = 21 ម៉ោង'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'មួយថ្ងៃ', '22 hours = មួយថ្ងៃ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'មួយថ្ងៃ', '35 hours = មួយថ្ងៃ'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ថ្ងៃ', '36 hours = 2 ថ្ងៃ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'មួយថ្ងៃ', '1 day = មួយថ្ងៃ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ថ្ងៃ', '5 days = 5 ថ្ងៃ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ថ្ងៃ', '25 days = 25 ថ្ងៃ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'មួយខែ', '26 days = មួយខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'មួយខែ', '30 days = មួយខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'មួយខែ', '43 days = មួយខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ខែ', '46 days = 2 ខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ខែ', '75 days = 2 ខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ខែ', '76 days = 3 ខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'មួយខែ', '1 month = មួយខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ខែ', '5 months = 5 ខែ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'មួយឆ្នាំ', '345 days = មួយឆ្នាំ'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ឆ្នាំ', '548 days = 2 ឆ្នាំ'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'មួយឆ្នាំ', '1 year = មួយឆ្នាំ'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ឆ្នាំ', '5 years = 5 ឆ្នាំ'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ប៉ុន្មានវិនាទីទៀត', 'prefix'); - assert.equal(moment(0).from(30000), 'ប៉ុន្មានវិនាទីមុន', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ប៉ុន្មានវិនាទីមុន', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({ - s: 30 - }).fromNow(), 'ប៉ុន្មានវិនាទីទៀត', 'in a few seconds'); - assert.equal(moment().add({ - d: 5 - }).fromNow(), '5 ថ្ងៃទៀត', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ថ្ងៃនេះ ម៉ោង 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ថ្ងៃនេះ ម៉ោង 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ថ្ងៃនេះ ម៉ោង 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ស្អែក ម៉ោង 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ថ្ងៃនេះ ម៉ោង 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ម្សិលមិញ ម៉ោង 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({ - d: i - }); - assert.equal(m.calendar(), m.format('dddd [ម៉ោង] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ម៉ោង] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ម៉ោង] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({ - d: i - }); - assert.equal(m.calendar(), m.format('dddd [សប្តាហ៍មុន] [ម៉ោង] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [សប្តាហ៍មុន] [ម៉ោង] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [សប្តាហ៍មុន] [ម៉ោង] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({ - w: 1 - }), - weeksFromNow = moment().add({ - w: 1 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({ - w: 2 - }); - weeksFromNow = moment().add({ - w: 2 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ko'); - - test('parse', function (assert) { - var tests = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse meridiem', function (assert) { - var elements = [{ - expression : '1981년 9월 8일 오후 2시 30분', - inputFormat : 'YYYY[년] M[월] D[일] A h[시] m[분]', - outputFormat : 'A', - expected : '오후' - }, { - expression : '1981년 9월 8일 오전 2시 30분', - inputFormat : 'YYYY[년] M[월] D[일] A h[시] m[분]', - outputFormat : 'A h시', - expected : '오전 2시' - }, { - expression : '14시 30분', - inputFormat : 'H[시] m[분]', - outputFormat : 'A', - expected : '오후' - }, { - expression : '오후 4시', - inputFormat : 'A h[시]', - outputFormat : 'H', - expected : '16' - }], i, l, it, actual; - - for (i = 0, l = elements.length; i < l; ++i) { - it = elements[i]; - actual = moment(it.expression, it.inputFormat).format(it.outputFormat); - - assert.equal( - actual, - it.expected, - '\'' + it.outputFormat + '\' of \'' + it.expression + '\' must be \'' + it.expected + '\' but was \'' + actual + '\'.' - ); - } - }); - - test('format', function (assert) { - var a = [ - ['YYYY년 MMMM Do dddd a h:mm:ss', '2010년 2월 14일 일요일 오후 3:25:50'], - ['ddd A h', '일 오후 3'], - ['M Mo MM MMMM MMM', '2 2일 02 2월 2월'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14일 14'], - ['d do dddd ddd dd', '0 0일 일요일 일 일'], - ['DDD DDDo DDDD', '45 45일 045'], - ['w wo ww', '8 8일 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', '오후 오후'], - ['일년 중 DDDo째 되는 날', '일년 중 45일째 되는 날'], - ['LTS', '오후 3시 25분 50초'], - ['L', '2010.02.14'], - ['LL', '2010년 2월 14일'], - ['LLL', '2010년 2월 14일 오후 3시 25분'], - ['LLLL', '2010년 2월 14일 일요일 오후 3시 25분'], - ['l', '2010.2.14'], - ['ll', '2010년 2월 14일'], - ['lll', '2010년 2월 14일 오후 3시 25분'], - ['llll', '2010년 2월 14일 일 오후 3시 25분'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1일', '1일'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2일', '2일'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3일', '3일'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4일', '4일'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5일', '5일'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6일', '6일'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7일', '7일'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8일', '8일'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9일', '9일'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10일', '10일'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11일', '11일'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12일', '12일'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13일', '13일'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14일', '14일'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15일', '15일'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16일', '16일'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17일', '17일'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18일', '18일'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19일', '19일'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20일', '20일'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21일', '21일'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22일', '22일'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23일', '23일'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24일', '24일'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25일', '25일'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26일', '26일'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27일', '27일'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28일', '28일'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29일', '29일'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30일', '30일'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31일', '31일'); - }); - - test('format month', function (assert) { - var expected = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = '일요일 일 일_월요일 월 월_화요일 화 화_수요일 수 수_목요일 목 목_금요일 금 금_토요일 토 토'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '몇 초', '44초 = 몇 초'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '일분', '45초 = 일분'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '일분', '89초 = 일분'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2분', '90초 = 2분'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44분', '44분 = 44분'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '한 시간', '45분 = 한 시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '한 시간', '89분 = 한 시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2시간', '90분 = 2시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5시간', '5시간 = 5시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21시간', '21시간 = 21시간'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '하루', '22시간 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '하루', '35시간 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2일', '36시간 = 2일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '하루', '하루 = 하루'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5일', '5일 = 5일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25일', '25일 = 25일'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '한 달', '26일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '한 달', '30일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '한 달', '45일 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2달', '46일 = 2달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2달', '75일 = 2달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3달', '76일 = 3달'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '한 달', '1달 = 한 달'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5달', '5달 = 5달'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '일 년', '345일 = 일 년'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2년', '548일 = 2년'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '일 년', '일 년 = 일 년'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5년', '5년 = 5년'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), '몇 초 후', 'prefix'); - assert.equal(moment(0).from(30000), '몇 초 전', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), '몇 초 전', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), '몇 초 후', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5일 후', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), '오늘 오후 12시 0분', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), '오늘 오후 12시 25분', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), '오늘 오후 1시 0분', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), '내일 오후 12시 0분', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), '오늘 오전 11시 0분', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), '어제 오후 12시 0분', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('지난주 dddd LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('지난주 dddd LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('지난주 dddd LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1일', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1일', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2일', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2일', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3일', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ky'); - - test('parse', function (assert) { - var tests = 'январь янв_февраль фев_март март_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'Жекшемби, 14-чү февраль 2010, 15:25:50'], - ['ddd, hA', 'Жек, 3PM'], - ['M Mo MM MMMM MMM', '2 2-чи 02 февраль фев'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-чү 14'], - ['d do dddd ddd dd', '0 0-чү Жекшемби Жек Жк'], - ['DDD DDDo DDDD', '45 45-чи 045'], - ['w wo ww', '7 7-чи 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[жылдын] DDDo [күнү]', 'жылдын 45-чи күнү'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 февраль 2010'], - ['LLL', '14 февраль 2010 15:25'], - ['LLLL', 'Жекшемби, 14 февраль 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 фев 2010'], - ['lll', '14 фев 2010 15:25'], - ['llll', 'Жек, 14 фев 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-чи', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-чи', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-чү', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-чү', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-чи', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-чы', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-чи', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-чи', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-чу', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-чу', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-чи', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-чи', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-чү', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-чү', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-чи', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-чы', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-чи', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-чи', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-чу', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-чы', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-чи', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-чи', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-чү', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-чү', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-чи', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-чы', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-чи', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-чи', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-чу', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-чу', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-чи', '31st'); - }); - - test('format month', function (assert) { - var expected = 'январь янв_февраль фев_март март_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Жекшемби Жек Жк_Дүйшөмбү Дүй Дй_Шейшемби Шей Шй_Шаршемби Шар Шр_Бейшемби Бей Бй_Жума Жум Жм_Ишемби Ише Иш'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'бирнече секунд', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'бир мүнөт', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'бир мүнөт', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 мүнөт', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 мүнөт', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'бир саат', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'бир саат', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 саат', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 саат', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 саат', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'бир күн', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'бир күн', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 күн', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'бир күн', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 күн', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 күн', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'бир ай', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'бир ай', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'бир ай', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ай', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ай', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ай', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'бир ай', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ай', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'бир жыл', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 жыл', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'бир жыл', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 жыл', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'бирнече секунд ичинде', 'prefix'); - assert.equal(moment(0).from(30000), 'бирнече секунд мурун', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'бирнече секунд мурун', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'бирнече секунд ичинде', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 күн ичинде', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Бүгүн саат 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Бүгүн саат 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Бүгүн саат 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Эртең саат 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бүгүн саат 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кече саат 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [саат] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [саат] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [саат] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Өткен аптанын] dddd [күнү] [саат] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Өткен аптанын] dddd [күнү] [саат] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Өткен аптанын] dddd [күнү] [саат] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-чи', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-чи', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-чи', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-чү', 'Jan 9 2012 should be week 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3-чү', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('lb'); - - test('parse', function (assert) { - var tests = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split('_'), i; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'Sonndeg, 14. Februar 2010, 15:25:50'], - ['ddd, HH:mm', 'So., 15:25'], - ['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Sonndeg So. So'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50 Auer'], - ['L', '14.02.2010'], - ['LL', '14. Februar 2010'], - ['LLL', '14. Februar 2010 15:25 Auer'], - ['LLLL', 'Sonndeg, 14. Februar 2010 15:25 Auer'], - ['l', '14.2.2010'], - ['ll', '14. Febr. 2010'], - ['lll', '14. Febr. 2010 15:25 Auer'], - ['llll', 'So., 14. Febr. 2010 15:25 Auer'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Sonndeg So. So_Méindeg Mé. Mé_Dënschdeg Dë. Dë_Mëttwoch Më. Më_Donneschdeg Do. Do_Freideg Fr. Fr_Samschdeg Sa. Sa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'e puer Sekonnen', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eng Minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eng Minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 Minutten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 Minutten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'eng Stonn', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'eng Stonn', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 Stonnen', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 Stonnen', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 Stonnen', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'een Dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'een Dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 Deeg', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'een Dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 Deeg', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 Deeg', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ee Mount', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ee Mount', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ee Mount', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 Méint', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 Méint', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 Méint', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ee Mount', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 Méint', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ee Joer', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 Joer', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ee Joer', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 Joer', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'an e puer Sekonnen', 'prefix'); - assert.equal(moment(0).from(30000), 'virun e puer Sekonnen', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'an e puer Sekonnen', 'in a few seconds'); - assert.equal(moment().add({d: 1}).fromNow(), 'an engem Dag', 'in one day'); - assert.equal(moment().add({d: 2}).fromNow(), 'an 2 Deeg', 'in 2 days'); - assert.equal(moment().add({d: 3}).fromNow(), 'an 3 Deeg', 'in 3 days'); - assert.equal(moment().add({d: 4}).fromNow(), 'a 4 Deeg', 'in 4 days'); - assert.equal(moment().add({d: 5}).fromNow(), 'a 5 Deeg', 'in 5 days'); - assert.equal(moment().add({d: 6}).fromNow(), 'a 6 Deeg', 'in 6 days'); - assert.equal(moment().add({d: 7}).fromNow(), 'a 7 Deeg', 'in 7 days'); - assert.equal(moment().add({d: 8}).fromNow(), 'an 8 Deeg', 'in 8 days'); - assert.equal(moment().add({d: 9}).fromNow(), 'an 9 Deeg', 'in 9 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'an 10 Deeg', 'in 10 days'); - assert.equal(moment().add({y: 100}).fromNow(), 'an 100 Joer', 'in 100 years'); - assert.equal(moment().add({y: 400}).fromNow(), 'a 400 Joer', 'in 400 years'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Haut um 12:00 Auer', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Haut um 12:25 Auer', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Haut um 13:00 Auer', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Muer um 12:00 Auer', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Haut um 11:00 Auer', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Gëschter um 12:00 Auer', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [um] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, weekday, datestring; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) - weekday = parseInt(m.format('d'), 10); - datestring = (weekday === 2 || weekday === 4 ? '[Leschten] dddd [um] LT' : '[Leschte] dddd [um] LT'); - - assert.equal(m.calendar(), m.format(datestring), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(datestring), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(datestring), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1.', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2.', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('lo'); - - test('parse', function (assert) { - var tests = 'ມັງກອນ ມັງກອນ_ກຸມພາ ກຸມພາ_ມີນາ ມີນາ_ເມສາ ເມສາ_ພຶດສະພາ ພຶດສະພາ_ມິຖຸນາ ມິຖຸນາ_ກໍລະກົດ ກໍລະກົດ_ສິງຫາ ສິງຫາ_ກັນຍາ ກັນຍາ_ຕຸລາ ຕຸລາ_ພະຈິກ ພະຈິກ_ທັນວາ ທັນວາ'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ອາທິດ, ກຸມພາ ທີ່14 2010, 3:25:50 ຕອນແລງ'], - ['ddd, hA', 'ທິດ, 3ຕອນແລງ'], - ['M Mo MM MMMM MMM', '2 ທີ່2 02 ກຸມພາ ກຸມພາ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 ທີ່14 14'], - ['d do dddd ddd dd', '0 ທີ່0 ອາທິດ ທິດ ທ'], - ['DDD DDDo DDDD', '45 ທີ່45 045'], - ['w wo ww', '8 ທີ່8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ຕອນແລງ ຕອນແລງ'], - ['[ວັນ]DDDo [ຂອງປີ]', 'ວັນທີ່45 ຂອງປີ'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 ກຸມພາ 2010'], - ['LLL', '14 ກຸມພາ 2010 15:25'], - ['LLLL', 'ວັນອາທິດ 14 ກຸມພາ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 ກຸມພາ 2010'], - ['lll', '14 ກຸມພາ 2010 15:25'], - ['llll', 'ວັນທິດ 14 ກຸມພາ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), 'ທີ່1', 'ທີ່1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), 'ທີ່2', 'ທີ່2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), 'ທີ່3', 'ທີ່3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), 'ທີ່4', 'ທີ່4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), 'ທີ່5', 'ທີ່5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), 'ທີ່6', 'ທີ່6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), 'ທີ່7', 'ທີ່7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), 'ທີ່8', 'ທີ່8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), 'ທີ່9', 'ທີ່9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), 'ທີ່10', 'ທີ່10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), 'ທີ່11', 'ທີ່11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), 'ທີ່12', 'ທີ່12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), 'ທີ່13', 'ທີ່13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), 'ທີ່14', 'ທີ່14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), 'ທີ່15', 'ທີ່15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), 'ທີ່16', 'ທີ່16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), 'ທີ່17', 'ທີ່17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), 'ທີ່18', 'ທີ່18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), 'ທີ່19', 'ທີ່19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), 'ທີ່20', 'ທີ່20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), 'ທີ່21', 'ທີ່21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), 'ທີ່22', 'ທີ່22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), 'ທີ່23', 'ທີ່23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), 'ທີ່24', 'ທີ່24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), 'ທີ່25', 'ທີ່25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), 'ທີ່26', 'ທີ່26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), 'ທີ່27', 'ທີ່27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), 'ທີ່28', 'ທີ່28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), 'ທີ່29', 'ທີ່29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), 'ທີ່30', 'ທີ່30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), 'ທີ່31', 'ທີ່31'); - }); - - test('format month', function (assert) { - var expected = 'ມັງກອນ ມັງກອນ_ກຸມພາ ກຸມພາ_ມີນາ ມີນາ_ເມສາ ເມສາ_ພຶດສະພາ ພຶດສະພາ_ມິຖຸນາ ມິຖຸນາ_ກໍລະກົດ ກໍລະກົດ_ສິງຫາ ສິງຫາ_ກັນຍາ ກັນຍາ_ຕຸລາ ຕຸລາ_ພະຈິກ ພະຈິກ_ທັນວາ ທັນວາ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ອາທິດ ທິດ ທ_ຈັນ ຈັນ ຈ_ອັງຄານ ອັງຄານ ອຄ_ພຸດ ພຸດ ພ_ພະຫັດ ພະຫັດ ພຫ_ສຸກ ສຸກ ສກ_ເສົາ ເສົາ ສ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ບໍ່ເທົ່າໃດວິນາທີ', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 ນາທີ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 ນາທີ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 ນາທີ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 ນາທີ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '1 ຊົ່ວໂມງ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 ຊົ່ວໂມງ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ຊົ່ວໂມງ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ຊົ່ວໂມງ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ຊົ່ວໂມງ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1 ມື້', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 ມື້', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ມື້', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1 ມື້', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ມື້', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ມື້', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '1 ເດືອນ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 ເດືອນ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 ເດືອນ', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ເດືອນ', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ເດືອນ', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ເດືອນ', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '1 ເດືອນ', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ເດືອນ', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '1 ປີ', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ປີ', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '1 ປີ', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ປີ', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ອີກ ບໍ່ເທົ່າໃດວິນາທີ', 'prefix'); - assert.equal(moment(0).from(30000), 'ບໍ່ເທົ່າໃດວິນາທີຜ່ານມາ', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ບໍ່ເທົ່າໃດວິນາທີຜ່ານມາ', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ອີກ ບໍ່ເທົ່າໃດວິນາທີ', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ອີກ 5 ມື້', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ມື້ນີ້ເວລາ 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ມື້ນີ້ເວລາ 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ມື້ນີ້ເວລາ 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ມື້ອື່ນເວລາ 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ມື້ນີ້ເວລາ 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ມື້ວານນີ້ເວລາ 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[ວັນ]dddd[ໜ້າເວລາ] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ວັນ]dddd[ໜ້າເວລາ] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ວັນ]dddd[ໜ້າເວລາ] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 ທີ່1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 ທີ່1', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 ທີ່2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 ທີ່2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 ທີ່3', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('lt'); - - test('parse', function (assert) { - var tests = 'sausis sau_vasaris vas_kovas kov_balandis bal_gegužė geg_birželis bir_liepa lie_rugpjūtis rgp_rugsėjis rgs_spalis spa_lapkritis lap_gruodis grd'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'sekmadienis, 14-oji vasario 2010, 3:25:50 pm'], - ['ddd, hA', 'Sek, 3PM'], - ['M Mo MM MMMM MMM', '2 2-oji 02 vasaris vas'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-oji 14'], - ['d do dddd ddd dd', '0 0-oji sekmadienis Sek S'], - ['DDD DDDo DDDD', '45 45-oji 045'], - ['w wo ww', '6 6-oji 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['DDDo [metų diena]', '45-oji metų diena'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '2010 m. vasaris 14 d.'], - ['LLL', '2010 m. vasaris 14 d., 15:25 val.'], - ['LLLL', '2010 m. vasaris 14 d., sekmadienis, 15:25 val.'], - ['l', '2010-02-14'], - ['ll', '2010 m. vasaris 14 d.'], - ['lll', '2010 m. vasaris 14 d., 15:25 val.'], - ['llll', '2010 m. vasaris 14 d., Sek, 15:25 val.'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-oji', '1-oji'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-oji', '2-oji'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-oji', '3-oji'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-oji', '4-oji'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-oji', '5-oji'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-oji', '6-oji'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-oji', '7-oji'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-oji', '8-oji'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-oji', '9-oji'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-oji', '10-oji'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-oji', '11-oji'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-oji', '12-oji'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-oji', '13-oji'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-oji', '14-oji'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-oji', '15-oji'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-oji', '16-oji'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-oji', '17-oji'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-oji', '18-oji'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-oji', '19-oji'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-oji', '20-oji'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-oji', '21-oji'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-oji', '22-oji'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-oji', '23-oji'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-oji', '24-oji'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-oji', '25-oji'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-oji', '26-oji'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-oji', '27-oji'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-oji', '28-oji'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-oji', '29-oji'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-oji', '30-oji'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-oji', '31-oji'); - }); - - test('format month', function (assert) { - var expected = 'sausis sau_vasaris vas_kovas kov_balandis bal_gegužė geg_birželis bir_liepa lie_rugpjūtis rgp_rugsėjis rgs_spalis spa_lapkritis lap_gruodis grd'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('format week on US calendar', function (assert) { - // Tests, whether the weekday names are correct, even if the week does not start on Monday - moment.updateLocale('lt', {week: {dow: 0, doy: 6}}); - var expected = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - moment.updateLocale('lt', null); - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'kelios sekundės', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minutė', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minutė', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutės', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 10}), true), '10 minučių', '10 minutes = 10 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 11}), true), '11 minučių', '11 minutes = 11 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 19}), true), '19 minučių', '19 minutes = 19 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 20}), true), '20 minučių', '20 minutes = 20 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutės', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'valanda', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'valanda', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 valandos', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 valandos', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 10}), true), '10 valandų', '10 hours = 10 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 valandos', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diena', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diena', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dienos', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diena', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dienos', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 10}), true), '10 dienų', '10 days = 10 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dienos', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mėnuo', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mėnuo', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mėnuo', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mėnesiai', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mėnesiai', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mėnesiai', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mėnuo', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mėnesiai', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 10}), true), '10 mėnesių', '10 months = 10 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'metai', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 metai', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'metai', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 metai', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'po kelių sekundžių', 'prefix'); - assert.equal(moment(0).from(30000), 'prieš kelias sekundes', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prieš kelias sekundes', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'po kelių sekundžių', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'po 5 dienų', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Šiandien 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Šiandien 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Šiandien 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Rytoj 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šiandien 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Praėjusį] dddd LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52-oji', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1-oji', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1-oji', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2-oji', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2-oji', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('lv'); - - test('parse', function (assert) { - var tests = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'svētdiena, 14. februāris 2010, 3:25:50 pm'], - ['ddd, hA', 'Sv, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februāris feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. svētdiena Sv Sv'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010.'], - ['LL', '2010. gada 14. februāris'], - ['LLL', '2010. gada 14. februāris, 15:25'], - ['LLLL', '2010. gada 14. februāris, svētdiena, 15:25'], - ['l', '14.2.2010.'], - ['ll', '2010. gada 14. feb'], - ['lll', '2010. gada 14. feb, 15:25'], - ['llll', '2010. gada 14. feb, Sv, 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'svētdiena Sv Sv_pirmdiena P P_otrdiena O O_trešdiena T T_ceturtdiena C C_piektdiena Pk Pk_sestdiena S S'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - // Includes testing the cases of withoutSuffix = true and false. - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'dažas sekundes', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), false), 'pirms dažām sekundēm', '44 seconds with suffix = seconds ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minūte', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), false), 'pirms minūtes', '45 seconds with suffix = a minute ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minūte', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: -89}), false), 'pēc minūtes', '89 seconds with suffix/prefix = in a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minūtes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), false), 'pirms 2 minūtēm', '90 seconds with suffix = 2 minutes ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minūtes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), false), 'pirms 44 minūtēm', '44 minutes with suffix = 44 minutes ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'stunda', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), false), 'pirms stundas', '45 minutes with suffix = an hour ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'stunda', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 stundas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: -90}), false), 'pēc 2 stundām', '90 minutes with suffix = in 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 stundas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), false), 'pirms 5 stundām', '5 hours with suffix = 5 hours ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 stunda', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), false), 'pirms 21 stundas', '21 hours with suffix = 21 hours ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'diena', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), false), 'pirms dienas', '22 hours with suffix = a day ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'diena', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dienas', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), false), 'pirms 2 dienām', '36 hours with suffix = 2 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'diena', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dienas', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), false), 'pirms 5 dienām', '5 days with suffix = 5 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dienas', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), false), 'pirms 25 dienām', '25 days with suffix = 25 days ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mēnesis', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), false), 'pirms mēneša', '26 days with suffix = a month ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mēnesis', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mēnesis', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mēneši', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), false), 'pirms 2 mēnešiem', '46 days with suffix = 2 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mēneši', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mēneši', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), false), 'pirms 3 mēnešiem', '76 days with suffix = 3 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mēnesis', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mēneši', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), false), 'pirms 5 mēnešiem', '5 months with suffix = 5 months ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'gads', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), false), 'pirms gada', '345 days with suffix = a year ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 gadi', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), false), 'pirms 2 gadiem', '548 days with suffix = 2 years ago'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'gads', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 gadi', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), false), 'pirms 5 gadiem', '5 years with suffix = 5 years ago'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'pēc dažām sekundēm', 'prefix'); - assert.equal(moment(0).from(30000), 'pirms dažām sekundēm', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pirms dažām sekundēm', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'pēc dažām sekundēm', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'pēc 5 dienām', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Šodien pulksten 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Šodien pulksten 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Šodien pulksten 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Rīt pulksten 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Šodien pulksten 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Vakar pulksten 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [pulksten] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pulksten] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pulksten] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Pagājušā] dddd [pulksten] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('me'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. nedjelja ned. ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14. 02. 2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedjelja, 14. februar 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 14. feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nekoliko sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mjesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mjesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mjesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mjeseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mjeseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mjeseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mjesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mjeseci', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za nekoliko sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'prije nekoliko sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'prije nekoliko sekundi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko sekundi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sjutra u 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'juče u 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - var lastWeekDay = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 1st is the first week of the year. - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('mk'); - - test('parse', function (assert) { - var tests = 'јануари јан_февруари фев_март мар_април апр_мај мај_јуни јун_јули јул_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, H:mm:ss', 'недела, февруари 14-ти 2010, 15:25:50'], - ['ddd, hA', 'нед, 3PM'], - ['M Mo MM MMMM MMM', '2 2-ри 02 февруари фев'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-ти 14'], - ['d do dddd ddd dd', '0 0-ев недела нед нe'], - ['DDD DDDo DDDD', '45 45-ти 045'], - ['w wo ww', '7 7-ми 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45-ти day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 февруари 2010'], - ['LLL', '14 февруари 2010 15:25'], - ['LLLL', 'недела, 14 февруари 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 фев 2010'], - ['lll', '14 фев 2010 15:25'], - ['llll', 'нед, 14 фев 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-ви', '1-ви'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-ри', '2-ри'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-ти', '3-ти'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-ти', '4-ти'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-ти', '5-ти'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-ти', '6-ти'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-ми', '7-ми'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-ми', '8-ми'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-ти', '9-ти'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-ти', '10-ти'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-ти', '11-ти'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-ти', '12-ти'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-ти', '13-ти'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-ти', '14-ти'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-ти', '15-ти'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-ти', '16-ти'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-ти', '17-ти'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-ти', '18-ти'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-ти', '19-ти'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-ти', '20-ти'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-ви', '21-ви'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-ри', '22-ри'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-ти', '23-ти'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-ти', '24-ти'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-ти', '25-ти'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-ти', '26-ти'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-ми', '27-ми'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-ми', '28-ми'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-ти', '29-ти'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-ти', '30-ти'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-ви', '31-ви'); - }); - - test('format month', function (assert) { - var expected = 'јануари јан_февруари фев_март мар_април апр_мај мај_јуни јун_јули јул_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'недела нед нe_понеделник пон пo_вторник вто вт_среда сре ср_четврток чет че_петок пет пе_сабота саб сa'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'неколку секунди', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'минута', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'минута', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 минути', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 минути', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'час', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'час', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 часа', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 часа', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 часа', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ден', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ден', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 дена', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ден', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 дена', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 дена', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'месец', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'месец', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'месец', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 месеци', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 месеци', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 месеци', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'месец', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 месеци', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'година', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 години', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'година', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 години', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'после неколку секунди', 'prefix'); - assert.equal(moment(0).from(30000), 'пред неколку секунди', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'пред неколку секунди', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'после неколку секунди', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'после 5 дена', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Денес во 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Денес во 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Денес во 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Утре во 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Денес во 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера во 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[Во] dddd [во] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Во] dddd [во] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Во] dddd [во] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ви', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ви', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-ри', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-ри', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-ти', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ml'); - - test('parse', function (assert) { - var tests = 'ജനുവരി ജനു._ഫെബ്രുവരി ഫെബ്രു._മാർച്ച് മാർ._ഏപ്രിൽ ഏപ്രി._മേയ് മേയ്_ജൂൺ ജൂൺ_ജൂലൈ ജൂലൈ._ഓഗസ്റ്റ് ഓഗ._സെപ്റ്റംബർ സെപ്റ്റ._ഒക്ടോബർ ഒക്ടോ._നവംബർ നവം._ഡിസംബർ ഡിസം.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss -നു', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'], - ['ddd, a h -നു', 'ഞായർ, ഉച്ച കഴിഞ്ഞ് 3 -നു'], - ['M Mo MM MMMM MMM', '2 2 02 ഫെബ്രുവരി ഫെബ്രു.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 ഞായറാഴ്ച ഞായർ ഞാ'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ഉച്ച കഴിഞ്ഞ് ഉച്ച കഴിഞ്ഞ്'], - ['LTS', 'ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'], - ['L', '14/02/2010'], - ['LL', '14 ഫെബ്രുവരി 2010'], - ['LLL', '14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['LLLL', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['l', '14/2/2010'], - ['ll', '14 ഫെബ്രു. 2010'], - ['lll', '14 ഫെബ്രു. 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'], - ['llll', 'ഞായർ, 14 ഫെബ്രു. 2010, ഉച്ച കഴിഞ്ഞ് 3:25 -നു'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'ജനുവരി ജനു._ഫെബ്രുവരി ഫെബ്രു._മാർച്ച് മാർ._ഏപ്രിൽ ഏപ്രി._മേയ് മേയ്_ജൂൺ ജൂൺ_ജൂലൈ ജൂലൈ._ഓഗസ്റ്റ് ഓഗ._സെപ്റ്റംബർ സെപ്റ്റ._ഒക്ടോബർ ഒക്ടോ._നവംബർ നവം._ഡിസംബർ ഡിസം.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ഞായറാഴ്ച ഞായർ ഞാ_തിങ്കളാഴ്ച തിങ്കൾ തി_ചൊവ്വാഴ്ച ചൊവ്വ ചൊ_ബുധനാഴ്ച ബുധൻ ബു_വ്യാഴാഴ്ച വ്യാഴം വ്യാ_വെള്ളിയാഴ്ച വെള്ളി വെ_ശനിയാഴ്ച ശനി ശ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'അൽപ നിമിഷങ്ങൾ', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ഒരു മിനിറ്റ്', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ഒരു മിനിറ്റ്', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 മിനിറ്റ്', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 മിനിറ്റ്', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ഒരു മണിക്കൂർ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ഒരു മണിക്കൂർ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 മണിക്കൂർ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 മണിക്കൂർ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 മണിക്കൂർ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ഒരു ദിവസം', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ഒരു ദിവസം', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ദിവസം', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ഒരു ദിവസം', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ദിവസം', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ദിവസം', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ഒരു മാസം', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ഒരു മാസം', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ഒരു മാസം', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 മാസം', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 മാസം', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 മാസം', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ഒരു മാസം', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 മാസം', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ഒരു വർഷം', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 വർഷം', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ഒരു വർഷം', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 വർഷം', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്', 'prefix'); - assert.equal(moment(0).from(30000), 'അൽപ നിമിഷങ്ങൾ മുൻപ്', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'അൽപ നിമിഷങ്ങൾ മുൻപ്', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്', 'അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്'); - assert.equal(moment().add({d: 5}).fromNow(), '5 ദിവസം കഴിഞ്ഞ്', '5 ദിവസം കഴിഞ്ഞ്'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ഇന്ന് ഉച്ച കഴിഞ്ഞ് 12:00 -നു', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ഇന്ന് ഉച്ച കഴിഞ്ഞ് 12:25 -നു', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'ഇന്ന് ഉച്ച കഴിഞ്ഞ് 3:00 -നു', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'നാളെ ഉച്ച കഴിഞ്ഞ് 12:00 -നു', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ഇന്ന് രാവിലെ 11:00 -നു', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ഇന്നലെ ഉച്ച കഴിഞ്ഞ് 12:00 -നു', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[കഴിഞ്ഞ] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[കഴിഞ്ഞ] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[കഴിഞ്ഞ] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'രാത്രി', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'രാവിലെ', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'ഉച്ച കഴിഞ്ഞ്', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'വൈകുന്നേരം', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'വൈകുന്നേരം', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'രാത്രി', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'രാത്രി', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'രാവിലെ', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'ഉച്ച കഴിഞ്ഞ്', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'വൈകുന്നേരം', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'വൈകുന്നേരം', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'രാത്രി', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('mr'); - - test('parse', function (assert) { - var tests = 'जानेवारी जाने._फेब्रुवारी फेब्रु._मार्च मार्च._एप्रिल एप्रि._मे मे._जून जून._जुलै जुलै._ऑगस्ट ऑग._सप्टेंबर सप्टें._ऑक्टोबर ऑक्टो._नोव्हेंबर नोव्हें._डिसेंबर डिसें.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss वाजता', 'रविवार, १४ फेब्रुवारी २०१०, दुपारी ३:२५:५० वाजता'], - ['ddd, a h वाजता', 'रवि, दुपारी ३ वाजता'], - ['M Mo MM MMMM MMM', '२ २ ०२ फेब्रुवारी फेब्रु.'], - ['YYYY YY', '२०१० १०'], - ['D Do DD', '१४ १४ १४'], - ['d do dddd ddd dd', '० ० रविवार रवि र'], - ['DDD DDDo DDDD', '४५ ४५ ०४५'], - ['w wo ww', '८ ८ ०८'], - ['h hh', '३ ०३'], - ['H HH', '१५ १५'], - ['m mm', '२५ २५'], - ['s ss', '५० ५०'], - ['a A', 'दुपारी दुपारी'], - ['LTS', 'दुपारी ३:२५:५० वाजता'], - ['L', '१४/०२/२०१०'], - ['LL', '१४ फेब्रुवारी २०१०'], - ['LLL', '१४ फेब्रुवारी २०१०, दुपारी ३:२५ वाजता'], - ['LLLL', 'रविवार, १४ फेब्रुवारी २०१०, दुपारी ३:२५ वाजता'], - ['l', '१४/२/२०१०'], - ['ll', '१४ फेब्रु. २०१०'], - ['lll', '१४ फेब्रु. २०१०, दुपारी ३:२५ वाजता'], - ['llll', 'रवि, १४ फेब्रु. २०१०, दुपारी ३:२५ वाजता'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '३', '३'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '४', '४'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '५', '५'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '६', '६'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '७', '७'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '८', '८'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '९', '९'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '१०', '१०'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '११', '११'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '१२', '१२'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '१३', '१३'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '१४', '१४'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '१५', '१५'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '१६', '१६'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '१७', '१७'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '१८', '१८'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '१९', '१९'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '२०', '२०'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '२१', '२१'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '२२', '२२'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '२३', '२३'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '२४', '२४'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '२५', '२५'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '२६', '२६'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '२७', '२७'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '२८', '२८'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '२९', '२९'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '३०', '३०'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '३१', '३१'); - }); - - test('format month', function (assert) { - var expected = 'जानेवारी जाने._फेब्रुवारी फेब्रु._मार्च मार्च._एप्रिल एप्रि._मे मे._जून जून._जुलै जुलै._ऑगस्ट ऑग._सप्टेंबर सप्टें._ऑक्टोबर ऑक्टो._नोव्हेंबर नोव्हें._डिसेंबर डिसें.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'रविवार रवि र_सोमवार सोम सो_मंगळवार मंगळ मं_बुधवार बुध बु_गुरूवार गुरू गु_शुक्रवार शुक्र शु_शनिवार शनि श'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'काही सेकंद', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'एक मिनिट', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'एक मिनिट', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '२ मिनिटे', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '४४ मिनिटे', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'एक तास', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'एक तास', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '२ तास', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '५ तास', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '२१ तास', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'एक दिवस', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'एक दिवस', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '२ दिवस', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'एक दिवस', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '५ दिवस', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '२५ दिवस', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'एक महिना', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'एक महिना', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'एक महिना', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '२ महिने', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '२ महिने', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '३ महिने', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'एक महिना', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '५ महिने', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'एक वर्ष', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '२ वर्षे', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'एक वर्ष', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '५ वर्षे', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'काही सेकंदांमध्ये', 'prefix'); - assert.equal(moment(0).from(30000), 'काही सेकंदांपूर्वी', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'काही सेकंदांपूर्वी', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'काही सेकंदांमध्ये', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '५ दिवसांमध्ये', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'आज दुपारी १२:०० वाजता', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'आज दुपारी १२:२५ वाजता', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'आज दुपारी ३:०० वाजता', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'उद्या दुपारी १२:०० वाजता', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'आज दुपारी ११:०० वाजता', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'काल दुपारी १२:०० वाजता', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[मागील] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[मागील] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[मागील] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'रात्री', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'सकाळी', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'दुपारी', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'सायंकाळी', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'सायंकाळी', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'रात्री', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'रात्री', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'सकाळी', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'दुपारी', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'सायंकाळी', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'सायंकाळी', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'रात्री', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '१ ०१ १', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '२ ०२ २', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '२ ०२ २', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '३ ०३ ३', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ms-my'); - - test('parse', function (assert) { - var i, - tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' sepatutnya bulan ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Ahad, Februari 14 2010, 3:25:50 petang'], - ['ddd, hA', 'Ahd, 3petang'], - ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Ahad Ahd Ah'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'petang petang'], - ['[hari] [ke] DDDo [tahun] ini', 'hari ke 45 tahun ini'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Ahad, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Ahd, 14 Feb 2010 pukul 15.25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var i, - expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'beberapa saat', '44 saat = beberapa saat'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'seminit', '45 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'seminit', '89 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minit', '90 saat = 2 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minit', '44 minit = 44 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minit = 2 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 jam = 5 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 jam = 21 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 jam = 2 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 hari = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 hari = 5 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 hari = 25 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '45 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 hari = 3 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 bulan = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 bulan = 5 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 hari = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 hari = 2 tahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 tahun = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 tahun = 5 tahun'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa saat', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa saat yang lepas', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa saat yang lepas', 'waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa saat', 'dalam beberapa saat'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'dalam 5 hari'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'hari ini pada waktu yang sama'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Sekarang tambah 25 minit'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Sekarang tambah 1 jam'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 12.00', 'esok pada waktu yang sama'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Sekarang tolak 1 jam'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 12.00', 'kelmarin pada waktu yang sama'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari tamat hari'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari tamat hari'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 1 minggu'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 2 minggu'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 sepatutnya minggu 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 sepatutnya minggu 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ms'); - - test('parse', function (assert) { - var i, - tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' sepatutnya bulan ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Ahad, Februari 14 2010, 3:25:50 petang'], - ['ddd, hA', 'Ahd, 3petang'], - ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Ahad Ahd Ah'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'petang petang'], - ['[hari] [ke] DDDo [tahun] ini', 'hari ke 45 tahun ini'], - ['LTS', '15.25.50'], - ['L', '14/02/2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 pukul 15.25'], - ['LLLL', 'Ahad, 14 Februari 2010 pukul 15.25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 pukul 15.25'], - ['llll', 'Ahd, 14 Feb 2010 pukul 15.25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var i, - expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'beberapa saat', '44 saat = beberapa saat'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'seminit', '45 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'seminit', '89 saat = seminit'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minit', '90 saat = 2 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minit', '44 minit = 44 minit'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'sejam', '45 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'sejam', '89 minit = sejam'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 jam', '90 minit = 2 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 jam', '5 jam = 5 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 jam', '21 jam = 21 jam'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'sehari', '22 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'sehari', '35 jam = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 hari', '36 jam = 2 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'sehari', '1 hari = sehari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 hari', '5 hari = 5 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 hari', '25 hari = 25 hari'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'sebulan', '26 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'sebulan', '30 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'sebulan', '45 hari = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 bulan', '46 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 bulan', '75 hari = 2 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 bulan', '76 hari = 3 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'sebulan', '1 bulan = sebulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 bulan', '5 bulan = 5 bulan'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'setahun', '345 hari = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 tahun', '548 hari = 2 tahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'setahun', '1 tahun = setahun'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 tahun', '5 tahun = 5 tahun'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dalam beberapa saat', 'prefix'); - assert.equal(moment(0).from(30000), 'beberapa saat yang lepas', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'beberapa saat yang lepas', 'waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dalam beberapa saat', 'dalam beberapa saat'); - assert.equal(moment().add({d: 5}).fromNow(), 'dalam 5 hari', 'dalam 5 hari'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hari ini pukul 12.00', 'hari ini pada waktu yang sama'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hari ini pukul 12.25', 'Sekarang tambah 25 minit'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hari ini pukul 13.00', 'Sekarang tambah 1 jam'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Esok pukul 12.00', 'esok pada waktu yang sama'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hari ini pukul 11.00', 'Sekarang tolak 1 jam'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kelmarin pukul 12.00', 'kelmarin pada waktu yang sama'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [pukul] LT'), 'Hari ini + ' + i + ' hari tamat hari'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari waktu sekarang'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari permulaan hari'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [lepas] [pukul] LT'), 'Hari ini - ' + i + ' hari tamat hari'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 1 minggu'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 minggu lepas'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'dalam 2 minggu'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 sepatutnya minggu 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 sepatutnya minggu 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 sepatutnya minggu 3'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 sepatutnya minggu 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('my'); - - test('parse', function (assert) { - var tests = 'ဇန်နဝါရီ ဇန်_ဖေဖော်ဝါရီ ဖေ_မတ် မတ်_ဧပြီ ပြီ_မေ မေ_ဇွန် ဇွန်_ဇူလိုင် လိုင်_သြဂုတ် သြ_စက်တင်ဘာ စက်_အောက်တိုဘာ အောက်_နိုဝင်ဘာ နို_ဒီဇင်ဘာ ဒီ'.split('_'), - i; - - function equalTest (input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'တနင်္ဂနွေ, ဖေဖော်ဝါရီ ၁၄ ၂၀၁၀, ၃:၂၅:၅၀ pm'], - ['ddd, hA', 'နွေ, ၃PM'], - ['M Mo MM MMMM MMM', '၂ ၂ ၀၂ ဖေဖော်ဝါရီ ဖေ'], - ['YYYY YY', '၂၀၁၀ ၁၀'], - ['D Do DD', '၁၄ ၁၄ ၁၄'], - ['d do dddd ddd dd', '၀ ၀ တနင်္ဂနွေ နွေ နွေ'], - ['DDD DDDo DDDD', '၄၅ ၄၅ ၀၄၅'], - ['w wo ww', '၆ ၆ ၀၆'], - ['h hh', '၃ ၀၃'], - ['H HH', '၁၅ ၁၅'], - ['m mm', '၂၅ ၂၅'], - ['s ss', '၅၀ ၅၀'], - ['a A', 'pm PM'], - ['[နှစ်၏] DDDo [ရက်မြောက်]', 'နှစ်၏ ၄၅ ရက်မြောက်'], - ['LTS', '၁၅:၂၅:၅၀'], - ['L', '၁၄/၀၂/၂၀၁၀'], - ['LL', '၁၄ ဖေဖော်ဝါရီ ၂၀၁၀'], - ['LLL', '၁၄ ဖေဖော်ဝါရီ ၂၀၁၀ ၁၅:၂၅'], - ['LLLL', 'တနင်္ဂနွေ ၁၄ ဖေဖော်ဝါရီ ၂၀၁၀ ၁၅:၂၅'], - ['l', '၁၄/၂/၂၀၁၀'], - ['ll', '၁၄ ဖေ ၂၀၁၀'], - ['lll', '၁၄ ဖေ ၂၀၁၀ ၁၅:၂၅'], - ['llll', 'နွေ ၁၄ ဖေ ၂၀၁၀ ၁၅:၂၅'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '၁', '၁'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '၂', '၂'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '၃', '၃'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '၄', '၄'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '၅', '၅'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '၆', '၆'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '၇', '၇'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '၈', '၈'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '၉', '၉'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '၁၀', '၁၀'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '၁၁', '၁၁'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '၁၂', '၁၂'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '၁၃', '၁၃'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '၁၄', '၁၄'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '၁၅', '၁၅'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '၁၆', '၁၆'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '၁၇', '၁၇'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '၁၈', '၁၈'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '၁၉', '၁၉'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '၂၀', '၂၀'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '၂၁', '၂၁'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '၂၂', '၂၂'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '၂၃', '၂၃'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '၂၄', '၂၄'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '၂၅', '၂၅'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '၂၆', '၂၆'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '၂၇', '၂၇'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '၂၈', '၂၈'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '၂၉', '၂၉'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '၃၀', '၃၀'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '၃၁', '၃၁'); - }); - - test('format month', function (assert) { - var expected = 'ဇန်နဝါရီ ဇန်_ဖေဖော်ဝါရီ ဖေ_မတ် မတ်_ဧပြီ ပြီ_မေ မေ_ဇွန် ဇွန်_ဇူလိုင် လိုင်_သြဂုတ် သြ_စက်တင်ဘာ စက်_အောက်တိုဘာ အောက်_နိုဝင်ဘာ နို_ဒီဇင်ဘာ ဒီ'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'တနင်္ဂနွေ နွေ နွေ_တနင်္လာ လာ လာ_အင်္ဂါ ဂါ ဂါ_ဗုဒ္ဓဟူး ဟူး ဟူး_ကြာသပတေး ကြာ ကြာ_သောကြာ သော သော_စနေ နေ နေ'.split('_'), - i; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 44 - }), true), 'စက္ကန်.အနည်းငယ်', '၄၄ စက္ကန်. = စက္ကန်.အနည်းငယ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 45 - }), true), 'တစ်မိနစ်', '၄၅ စက္ကန်. = တစ်မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 89 - }), true), 'တစ်မိနစ်', '၈၉ စက္ကန်. = တစ်မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - s: 90 - }), true), '၂ မိနစ်', '၉၀ စက္ကန်. = ၂ မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 44 - }), true), '၄၄ မိနစ်', '၄၄ မိနစ် = ၄၄ မိနစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 45 - }), true), 'တစ်နာရီ', '၄၅ မိနစ် = ၁ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 89 - }), true), 'တစ်နာရီ', '၈၉ မိနစ် = တစ်နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - m: 90 - }), true), '၂ နာရီ', 'မိနစ် ၉၀= ၂ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 5 - }), true), '၅ နာရီ', '၅ နာရီ= ၅ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 21 - }), true), '၂၁ နာရီ', '၂၁ နာရီ =၂၁ နာရီ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 22 - }), true), 'တစ်ရက်', '၂၂ နာရီ =တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 35 - }), true), 'တစ်ရက်', '၃၅ နာရီ =တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - h: 36 - }), true), '၂ ရက်', '၃၆ နာရီ = ၂ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 1 - }), true), 'တစ်ရက်', '၁ ရက်= တစ်ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 5 - }), true), '၅ ရက်', '၅ ရက် = ၅ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 25 - }), true), '၂၅ ရက်', '၂၅ ရက်= ၂၅ ရက်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 26 - }), true), 'တစ်လ', '၂၆ ရက် = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 30 - }), true), 'တစ်လ', 'ရက် ၃၀ = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 43 - }), true), 'တစ်လ', '၄၃ ရက် = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 46 - }), true), '၂ လ', '၄၆ ရက် = ၂ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 74 - }), true), '၂ လ', '၇၅ ရက်= ၂ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 76 - }), true), '၃ လ', '၇၆ ရက် = ၃ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 1 - }), true), 'တစ်လ', '၁ လ = တစ်လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - M: 5 - }), true), '၅ လ', '၅ လ = ၅ လ'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 345 - }), true), 'တစ်နှစ်', '၃၄၅ ရက် = တစ်နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - d: 548 - }), true), '၂ နှစ်', '၅၄၈ ရက် = ၂ နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 1 - }), true), 'တစ်နှစ်', '၁ နှစ် = တစ်နှစ်'); - assert.equal(start.from(moment([2007, 1, 28]).add({ - y: 5 - }), true), '၅ နှစ်', '၅ နှစ် = ၅ နှစ်'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'လာမည့် စက္ကန်.အနည်းငယ် မှာ', 'prefix'); - assert.equal(moment(0).from(30000), 'လွန်ခဲ့သော စက္ကန်.အနည်းငယ် က', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'လွန်ခဲ့သော စက္ကန်.အနည်းငယ် က', 'ယခုမှစပြီး အတိတ်တွင်ဖော်ပြသလိုဖော်ပြမည်'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({ - s: 30 - }).fromNow(), 'လာမည့် စက္ကန်.အနည်းငယ် မှာ', 'လာမည့် စက္ကန်.အနည်းငယ် မှာ'); - assert.equal(moment().add({ - d: 5 - }).fromNow(), 'လာမည့် ၅ ရက် မှာ', 'လာမည့် ၅ ရက် မှာ'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ယနေ. ၁၂:၀၀ မှာ', 'ယနေ. ဒီအချိန်'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ယနေ. ၁၂:၂၅ မှာ', 'ယခုမှ ၂၅ မိနစ်ပေါင်းထည့်'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ယနေ. ၁၃:၀၀ မှာ', 'ယခုမှ ၁ နာရီပေါင်းထည့်'); - assert.equal(moment(a).add({d: 1}).calendar(), 'မနက်ဖြန် ၁၂:၀၀ မှာ', 'မနက်ဖြန် ဒီအချိန်'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ယနေ. ၁၁:၀၀ မှာ', 'ယခုမှ ၁ နာရီနှုတ်'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'မနေ.က ၁၂:၀၀ မှာ', 'မနေ.က ဒီအချိန်'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({ - d: i - }); - assert.equal(m.calendar(), m.format('dddd LT [မှာ]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT [မှာ]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT [မှာ]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({ - d: i - }); - assert.equal(m.calendar(), m.format('[ပြီးခဲ့သော] dddd LT [မှာ]'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ပြီးခဲ့သော] dddd LT [မှာ]'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ပြီးခဲ့သော] dddd LT [မှာ]'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({ - w: 1 - }), - weeksFromNow = moment().add({ - w: 1 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), 'လွန်ခဲ့သော ၁ ပတ်က'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '၁ ပတ်အတွင်း'); - - weeksAgo = moment().subtract({ - w: 2 - }); - weeksFromNow = moment().add({ - w: 2 - }); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '၂ ပတ် အရင်က'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), '၂ ပတ် အတွင်း'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '၅၂ ၅၂ ၅၂', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '၁ ၀၁ ၁', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '၁ ၀၁ ၁', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '၂ ၀၂ ၂', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '၂ ၀၂ ၂', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('nb'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_august aug._september sep._oktober okt._november nov._desember des.'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'søndag, februar 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sø., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. søndag sø. sø'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[den] DDDo [dagen i året]', 'den 45. dagen i året'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 kl. 15:25'], - ['LLLL', 'søndag 14. februar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 kl. 15:25'], - ['llll', 'sø. 14. feb. 2010 kl. 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_august aug._september sep._oktober okt._november nov._desember des.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'søndag sø. sø_mandag ma. ma_tirsdag ti. ti_onsdag on. on_torsdag to. to_fredag fr. fr_lørdag lø. lø'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'noen sekunder', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ett minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ett minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timer', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timer', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timer', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dager', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dager', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dager', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en måned', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en måned', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en måned', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 måneder', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 måneder', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 måneder', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en måned', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 måneder', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ett år', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 år', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ett år', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 år', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'om noen sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'noen sekunder siden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'noen sekunder siden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om noen sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dager', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'i dag kl. 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'i dag kl. 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'i dag kl. 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'i morgen kl. 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'i dag kl. 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'i går kl. 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [kl.] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[forrige] dddd [kl.] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ne'); - - test('parse', function (assert) { - var tests = 'जनवरी जन._फेब्रुवरी फेब्रु._मार्च मार्च_अप्रिल अप्रि._मई मई_जुन जुन_जुलाई जुलाई._अगष्ट अग._सेप्टेम्बर सेप्ट._अक्टोबर अक्टो._नोभेम्बर नोभे._डिसेम्बर डिसे.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, aको h:mm:ss बजे', 'आइतबार, १४ फेब्रुवरी २०१०, दिउँसोको ३:२५:५० बजे'], - ['ddd, aको h बजे', 'आइत., दिउँसोको ३ बजे'], - ['M Mo MM MMMM MMM', '२ २ ०२ फेब्रुवरी फेब्रु.'], - ['YYYY YY', '२०१० १०'], - ['D Do DD', '१४ १४ १४'], - ['d do dddd ddd dd', '० ० आइतबार आइत. आ.'], - ['DDD DDDo DDDD', '४५ ४५ ०४५'], - ['w wo ww', '८ ८ ०८'], - ['h hh', '३ ०३'], - ['H HH', '१५ १५'], - ['m mm', '२५ २५'], - ['s ss', '५० ५०'], - ['a A', 'दिउँसो दिउँसो'], - ['LTS', 'दिउँसोको ३:२५:५० बजे'], - ['L', '१४/०२/२०१०'], - ['LL', '१४ फेब्रुवरी २०१०'], - ['LLL', '१४ फेब्रुवरी २०१०, दिउँसोको ३:२५ बजे'], - ['LLLL', 'आइतबार, १४ फेब्रुवरी २०१०, दिउँसोको ३:२५ बजे'], - ['l', '१४/२/२०१०'], - ['ll', '१४ फेब्रु. २०१०'], - ['lll', '१४ फेब्रु. २०१०, दिउँसोको ३:२५ बजे'], - ['llll', 'आइत., १४ फेब्रु. २०१०, दिउँसोको ३:२५ बजे'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '३', '३'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '४', '४'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '५', '५'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '६', '६'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '७', '७'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '८', '८'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '९', '९'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '१०', '१०'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '११', '११'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '१२', '१२'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '१३', '१३'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '१४', '१४'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '१५', '१५'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '१६', '१६'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '१७', '१७'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '१८', '१८'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '१९', '१९'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '२०', '२०'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '२१', '२१'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '२२', '२२'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '२३', '२३'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '२४', '२४'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '२५', '२५'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '२६', '२६'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '२७', '२७'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '२८', '२८'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '२९', '२९'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '३०', '३०'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '३१', '३१'); - }); - - test('format month', function (assert) { - var expected = 'जनवरी जन._फेब्रुवरी फेब्रु._मार्च मार्च_अप्रिल अप्रि._मई मई_जुन जुन_जुलाई जुलाई._अगष्ट अग._सेप्टेम्बर सेप्ट._अक्टोबर अक्टो._नोभेम्बर नोभे._डिसेम्बर डिसे.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'आइतबार आइत. आ._सोमबार सोम. सो._मङ्गलबार मङ्गल. मं._बुधबार बुध. बु._बिहिबार बिहि. बि._शुक्रबार शुक्र. शु._शनिबार शनि. श.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'केही क्षण', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'एक मिनेट', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'एक मिनेट', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '२ मिनेट', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '४४ मिनेट', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'एक घण्टा', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'एक घण्टा', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '२ घण्टा', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '५ घण्टा', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '२१ घण्टा', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'एक दिन', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'एक दिन', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '२ दिन', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'एक दिन', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '५ दिन', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '२५ दिन', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'एक महिना', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'एक महिना', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'एक महिना', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '२ महिना', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '२ महिना', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '३ महिना', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'एक महिना', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '५ महिना', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'एक बर्ष', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '२ बर्ष', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'एक बर्ष', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '५ बर्ष', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'केही क्षणमा', 'prefix'); - assert.equal(moment(0).from(30000), 'केही क्षण अगाडि', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'केही क्षण अगाडि', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'केही क्षणमा', 'केही क्षणमा'); - assert.equal(moment().add({d: 5}).fromNow(), '५ दिनमा', '५ दिनमा'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'आज दिउँसोको १२:०० बजे', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'आज दिउँसोको १२:२५ बजे', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'आज दिउँसोको १:०० बजे', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'भोलि दिउँसोको १२:०० बजे', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'आज बिहानको ११:०० बजे', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'हिजो दिउँसोको १२:०० बजे', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[आउँदो] dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[आउँदो] dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[आउँदो] dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[गएको] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[गएको] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[गएको] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'राति', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'बिहान', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'दिउँसो', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'साँझ', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'साँझ', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'राति', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'राति', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'बिहान', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'दिउँसो', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'साँझ', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'साँझ', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'राति', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '५३ ५३ ५३', 'Dec 26 2011 should be week 53'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '१ ०१ १', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '२ ०२ २', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '२ ०२ २', 'Jan 9 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('nl'); - - test('parse', function (assert) { - var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, HH:mm:ss', 'zondag, februari 14de 2010, 15:25:50'], - ['ddd, HH', 'zo., 15'], - ['M Mo MM MMMM MMM', '2 2de 02 februari feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14de 14'], - ['d do dddd ddd dd', '0 0de zondag zo. Zo'], - ['DDD DDDo DDDD', '45 45ste 045'], - ['w wo ww', '6 6de 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45ste day of the year'], - ['LTS', '15:25:50'], - ['L', '14-02-2010'], - ['LL', '14 februari 2010'], - ['LLL', '14 februari 2010 15:25'], - ['LLLL', 'zondag 14 februari 2010 15:25'], - ['l', '14-2-2010'], - ['ll', '14 feb. 2010'], - ['lll', '14 feb. 2010 15:25'], - ['llll', 'zo. 14 feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14de', '14de'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24ste', '24ste'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste'); - }); - - test('format month', function (assert) { - var expected = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'zondag zo. Zo_maandag ma. Ma_dinsdag di. Di_woensdag wo. Wo_donderdag do. Do_vrijdag vr. Vr_zaterdag za. Za'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'een paar seconden', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'één minuut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'één minuut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuten', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuten', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'één uur', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'één uur', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uur', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 uur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 uur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'één dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'één dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagen', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'één dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagen', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagen', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'één maand', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'één maand', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'één maand', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 maanden', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 maanden', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 maanden', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'één maand', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 maanden', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'één jaar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jaar', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'één jaar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jaar', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'over een paar seconden', 'prefix'); - assert.equal(moment(0).from(30000), 'een paar seconden geleden', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'een paar seconden geleden', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'over een paar seconden', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'over 5 dagen', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'vandaag om 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'vandaag om 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'vandaag om 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'morgen om 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'vandaag om 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'gisteren om 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [om] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('month abbreviation', function (assert) { - assert.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot'); - assert.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ste', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1ste', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1ste', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2de', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2de', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('nn'); - - test('parse', function (assert) { - var tests = 'januar jan_februar feb_mars mar_april apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'sundag, februar 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sun, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sundag sun su'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 kl. 15:25'], - ['LLLL', 'sundag 14. februar 2010 kl. 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 kl. 15:25'], - ['llll', 'sun 14. feb 2010 kl. 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan_februar feb_mars mar_april apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'sundag sun su_måndag mån må_tysdag tys ty_onsdag ons on_torsdag tor to_fredag fre fr_laurdag lau lø'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nokre sekund', '44 sekunder = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'eit minutt', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'eit minutt', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutt', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutt', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ein time', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ein time', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ein dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ein dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ein dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ein månad', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ein månad', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ein månad', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 månader', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 månader', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 månader', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ein månad', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 månader', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eit år', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 år', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eit år', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 år', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'om nokre sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'nokre sekund sidan', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'nokre sekund sidan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om nokre sekund', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'I dag klokka 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'I dag klokka 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'I dag klokka 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'I morgon klokka 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'I dag klokka 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'I går klokka 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [klokka] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [klokka] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [klokka] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Føregåande] dddd [klokka] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('pa-in'); - - test('parse', function (assert) { - var tests = 'ਜਨਵਰੀ ਜਨਵਰੀ_ਫ਼ਰਵਰੀ ਫ਼ਰਵਰੀ_ਮਾਰਚ ਮਾਰਚ_ਅਪ੍ਰੈਲ ਅਪ੍ਰੈਲ_ਮਈ ਮਈ_ਜੂਨ ਜੂਨ_ਜੁਲਾਈ ਜੁਲਾਈ_ਅਗਸਤ ਅਗਸਤ_ਸਤੰਬਰ ਸਤੰਬਰ_ਅਕਤੂਬਰ ਅਕਤੂਬਰ_ਨਵੰਬਰ ਨਵੰਬਰ_ਦਸੰਬਰ ਦਸੰਬਰ'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, a h:mm:ss ਵਜੇ', 'ਐਤਵਾਰ, ੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦, ਦੁਪਹਿਰ ੩:੨੫:੫੦ ਵਜੇ'], - ['ddd, a h ਵਜੇ', 'ਐਤ, ਦੁਪਹਿਰ ੩ ਵਜੇ'], - ['M Mo MM MMMM MMM', '੨ ੨ ੦੨ ਫ਼ਰਵਰੀ ਫ਼ਰਵਰੀ'], - ['YYYY YY', '੨੦੧੦ ੧੦'], - ['D Do DD', '੧੪ ੧੪ ੧੪'], - ['d do dddd ddd dd', '੦ ੦ ਐਤਵਾਰ ਐਤ ਐਤ'], - ['DDD DDDo DDDD', '੪੫ ੪੫ ੦੪੫'], - ['w wo ww', '੮ ੮ ੦੮'], - ['h hh', '੩ ੦੩'], - ['H HH', '੧੫ ੧੫'], - ['m mm', '੨੫ ੨੫'], - ['s ss', '੫੦ ੫੦'], - ['a A', 'ਦੁਪਹਿਰ ਦੁਪਹਿਰ'], - ['LTS', 'ਦੁਪਹਿਰ ੩:੨੫:੫੦ ਵਜੇ'], - ['L', '੧੪/੦੨/੨੦੧੦'], - ['LL', '੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦'], - ['LLL', '੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦, ਦੁਪਹਿਰ ੩:੨੫ ਵਜੇ'], - ['LLLL', 'ਐਤਵਾਰ, ੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦, ਦੁਪਹਿਰ ੩:੨੫ ਵਜੇ'], - ['l', '੧੪/੨/੨੦੧੦'], - ['ll', '੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦'], - ['lll', '੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦, ਦੁਪਹਿਰ ੩:੨੫ ਵਜੇ'], - ['llll', 'ਐਤ, ੧੪ ਫ਼ਰਵਰੀ ੨੦੧੦, ਦੁਪਹਿਰ ੩:੨੫ ਵਜੇ'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '੧', '੧'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '੨', '੨'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '੩', '੩'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '੪', '੪'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '੫', '੫'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '੬', '੬'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '੭', '੭'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '੮', '੮'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '੯', '੯'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '੧੦', '੧੦'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '੧੧', '੧੧'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '੧੨', '੧੨'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '੧੩', '੧੩'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '੧੪', '੧੪'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '੧੫', '੧੫'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '੧੬', '੧੬'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '੧੭', '੧੭'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '੧੮', '੧੮'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '੧੯', '੧੯'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '੨੦', '੨੦'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '੨੧', '੨੧'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '੨੨', '੨੨'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '੨੩', '੨੩'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '੨੪', '੨੪'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '੨੫', '੨੫'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '੨੬', '੨੬'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '੨੭', '੨੭'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '੨੮', '੨੮'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '੨੯', '੨੯'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '੩੦', '੩੦'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '੩੧', '੩੧'); - }); - - test('format month', function (assert) { - var expected = 'ਜਨਵਰੀ ਜਨਵਰੀ_ਫ਼ਰਵਰੀ ਫ਼ਰਵਰੀ_ਮਾਰਚ ਮਾਰਚ_ਅਪ੍ਰੈਲ ਅਪ੍ਰੈਲ_ਮਈ ਮਈ_ਜੂਨ ਜੂਨ_ਜੁਲਾਈ ਜੁਲਾਈ_ਅਗਸਤ ਅਗਸਤ_ਸਤੰਬਰ ਸਤੰਬਰ_ਅਕਤੂਬਰ ਅਕਤੂਬਰ_ਨਵੰਬਰ ਨਵੰਬਰ_ਦਸੰਬਰ ਦਸੰਬਰ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ਐਤਵਾਰ ਐਤ ਐਤ_ਸੋਮਵਾਰ ਸੋਮ ਸੋਮ_ਮੰਗਲਵਾਰ ਮੰਗਲ ਮੰਗਲ_ਬੁਧਵਾਰ ਬੁਧ ਬੁਧ_ਵੀਰਵਾਰ ਵੀਰ ਵੀਰ_ਸ਼ੁੱਕਰਵਾਰ ਸ਼ੁਕਰ ਸ਼ੁਕਰ_ਸ਼ਨੀਚਰਵਾਰ ਸ਼ਨੀ ਸ਼ਨੀ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ਕੁਝ ਸਕਿੰਟ', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ਇਕ ਮਿੰਟ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ਇਕ ਮਿੰਟ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '੨ ਮਿੰਟ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '੪੪ ਮਿੰਟ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ਇੱਕ ਘੰਟਾ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ਇੱਕ ਘੰਟਾ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '੨ ਘੰਟੇ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '੫ ਘੰਟੇ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '੨੧ ਘੰਟੇ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ਇੱਕ ਦਿਨ', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ਇੱਕ ਦਿਨ', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '੨ ਦਿਨ', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ਇੱਕ ਦਿਨ', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '੫ ਦਿਨ', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '੨੫ ਦਿਨ', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ਇੱਕ ਮਹੀਨਾ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ਇੱਕ ਮਹੀਨਾ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ਇੱਕ ਮਹੀਨਾ', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '੨ ਮਹੀਨੇ', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '੨ ਮਹੀਨੇ', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '੩ ਮਹੀਨੇ', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ਇੱਕ ਮਹੀਨਾ', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '੫ ਮਹੀਨੇ', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ਇੱਕ ਸਾਲ', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '੨ ਸਾਲ', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ਇੱਕ ਸਾਲ', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '੫ ਸਾਲ', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ਕੁਝ ਸਕਿੰਟ ਵਿੱਚ', 'prefix'); - assert.equal(moment(0).from(30000), 'ਕੁਝ ਸਕਿੰਟ ਪਿਛਲੇ', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ਕੁਝ ਸਕਿੰਟ ਪਿਛਲੇ', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ਕੁਝ ਸਕਿੰਟ ਵਿੱਚ', 'ਕੁਝ ਸਕਿੰਟ ਵਿੱਚ'); - assert.equal(moment().add({d: 5}).fromNow(), '੫ ਦਿਨ ਵਿੱਚ', '੫ ਦਿਨ ਵਿੱਚ'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ਅਜ ਦੁਪਹਿਰ ੧੨:੦੦ ਵਜੇ', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ਅਜ ਦੁਪਹਿਰ ੧੨:੨੫ ਵਜੇ', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'ਅਜ ਦੁਪਹਿਰ ੩:੦੦ ਵਜੇ', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ਕਲ ਦੁਪਹਿਰ ੧੨:੦੦ ਵਜੇ', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ਅਜ ਦੁਪਹਿਰ ੧੧:੦੦ ਵਜੇ', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ਕਲ ਦੁਪਹਿਰ ੧੨:੦੦ ਵਜੇ', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ਪਿਛਲੇ] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ਪਿਛਲੇ] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ਪਿਛਲੇ] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem invariant', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'ਰਾਤ', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'ਸਵੇਰ', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'ਦੁਪਹਿਰ', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'ਸ਼ਾਮ', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'ਸ਼ਾਮ', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'ਰਾਤ', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'ਰਾਤ', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'ਸਵੇਰ', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'ਦੁਪਹਿਰ', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'ਸ਼ਾਮ', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'ਸ਼ਾਮ', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'ਰਾਤ', 'night'); - }); - - test('weeks year starting sunday', function (assert) { - assert.equal(moment([2012, 0, 1]).week(), 1, 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).week(), 1, 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).week(), 2, 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).week(), 2, 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).week(), 3, 'Jan 15 2012 should be week 3'); - }); - - test('weeks year starting monday', function (assert) { - assert.equal(moment([2006, 11, 31]).week(), 1, 'Dec 31 2006 should be week 1'); - assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); - assert.equal(moment([2007, 0, 6]).week(), 1, 'Jan 6 2007 should be week 1'); - assert.equal(moment([2007, 0, 7]).week(), 2, 'Jan 7 2007 should be week 2'); - assert.equal(moment([2007, 0, 13]).week(), 2, 'Jan 13 2007 should be week 2'); - assert.equal(moment([2007, 0, 14]).week(), 3, 'Jan 14 2007 should be week 3'); - }); - - test('weeks year starting tuesday', function (assert) { - assert.equal(moment([2007, 11, 29]).week(), 52, 'Dec 29 2007 should be week 52'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 5]).week(), 1, 'Jan 5 2008 should be week 1'); - assert.equal(moment([2008, 0, 6]).week(), 2, 'Jan 6 2008 should be week 2'); - assert.equal(moment([2008, 0, 12]).week(), 2, 'Jan 12 2008 should be week 2'); - assert.equal(moment([2008, 0, 13]).week(), 3, 'Jan 13 2008 should be week 3'); - }); - - test('weeks year starting wednesday', function (assert) { - assert.equal(moment([2002, 11, 29]).week(), 1, 'Dec 29 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 4]).week(), 1, 'Jan 4 2003 should be week 1'); - assert.equal(moment([2003, 0, 5]).week(), 2, 'Jan 5 2003 should be week 2'); - assert.equal(moment([2003, 0, 11]).week(), 2, 'Jan 11 2003 should be week 2'); - assert.equal(moment([2003, 0, 12]).week(), 3, 'Jan 12 2003 should be week 3'); - }); - - test('weeks year starting thursday', function (assert) { - assert.equal(moment([2008, 11, 28]).week(), 1, 'Dec 28 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 3]).week(), 1, 'Jan 3 2009 should be week 1'); - assert.equal(moment([2009, 0, 4]).week(), 2, 'Jan 4 2009 should be week 2'); - assert.equal(moment([2009, 0, 10]).week(), 2, 'Jan 10 2009 should be week 2'); - assert.equal(moment([2009, 0, 11]).week(), 3, 'Jan 11 2009 should be week 3'); - }); - - test('weeks year starting friday', function (assert) { - assert.equal(moment([2009, 11, 27]).week(), 1, 'Dec 27 2009 should be week 1'); - assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1'); - assert.equal(moment([2010, 0, 2]).week(), 1, 'Jan 2 2010 should be week 1'); - assert.equal(moment([2010, 0, 3]).week(), 2, 'Jan 3 2010 should be week 2'); - assert.equal(moment([2010, 0, 9]).week(), 2, 'Jan 9 2010 should be week 2'); - assert.equal(moment([2010, 0, 10]).week(), 3, 'Jan 10 2010 should be week 3'); - }); - - test('weeks year starting saturday', function (assert) { - assert.equal(moment([2010, 11, 26]).week(), 1, 'Dec 26 2010 should be week 1'); - assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1'); - assert.equal(moment([2011, 0, 2]).week(), 2, 'Jan 2 2011 should be week 2'); - assert.equal(moment([2011, 0, 8]).week(), 2, 'Jan 8 2011 should be week 2'); - assert.equal(moment([2011, 0, 9]).week(), 3, 'Jan 9 2011 should be week 3'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '੧ ੦੧ ੧', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '੧ ੦੧ ੧', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '੨ ੦੨ ੨', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '੨ ੦੨ ੨', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '੩ ੦੩ ੩', 'Jan 15 2012 should be week 3'); - }); - - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('pl'); - - test('parse', function (assert) { - var tests = 'styczeń stycznia sty_luty lutego lut_marzec marca mar_kwiecień kwietnia kwi_maj maja maj_czerwiec czerwca cze_lipiec lipca lip_sierpień sierpnia sie_wrzesień września wrz_październik października paź_listopad listopada lis_grudzień grudnia gru'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][2], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse strict', function (assert) { - var tests = 'styczeń stycznia sty_luty lutego lut_marzec marca mar_kwiecień kwietnia kwi_maj maja maj_czerwiec czerwca cze_lipiec lipca lip_sierpień sierpnia sie_wrzesień września wrz_październik października paź_listopad listopada lis_grudzień grudnia gru'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm, true).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][2], 'MMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleLowerCase(), 'MMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][2].toLocaleUpperCase(), 'MMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'niedziela, luty 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'nie, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 luty lut'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. niedziela nie Nd'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 lutego 2010'], - ['LLL', '14 lutego 2010 15:25'], - ['LLLL', 'niedziela, 14 lutego 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 lut 2010'], - ['lll', '14 lut 2010 15:25'], - ['llll', 'nie, 14 lut 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'niedziela nie Nd_poniedziałek pon Pn_wtorek wt Wt_środa śr Śr_czwartek czw Cz_piątek pt Pt_sobota sb So'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'kilka sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuty', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'godzina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'godzina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 godziny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 godzin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 godzin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1 dzień', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 dzień', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1 dzień', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'miesiąc', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'miesiąc', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'miesiąc', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 miesiące', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 miesiące', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 miesiące', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'miesiąc', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 miesięcy', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 lata', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 lat', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 112}), true), '112 lat', '112 years = 112 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 122}), true), '122 lata', '122 years = 122 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 213}), true), '213 lat', '213 years = 213 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 223}), true), '223 lata', '223 years = 223 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za kilka sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'kilka sekund temu', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'kilka sekund temu', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za kilka sekund', 'in a few seconds'); - assert.equal(moment().add({h: 1}).fromNow(), 'za godzinę', 'in an hour'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dni', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Dziś o 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Dziś o 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Dziś o 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Jutro o 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Dziś o 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Wczoraj o 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[W] dddd [o] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[W] dddd [o] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[W] dddd [o] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('pt-br'); - - test('parse', function (assert) { - var tests = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split('_'), i; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd', '0 0º Domingo Dom'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '8 8º 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 de Fevereiro de 2010'], - ['LLL', '14 de Fevereiro de 2010 às 15:25'], - ['LLLL', 'Domingo, 14 de Fevereiro de 2010 às 15:25'], - ['l', '14/2/2010'], - ['ll', '14 de Fev de 2010'], - ['lll', '14 de Fev de 2010 às 15:25'], - ['llll', 'Dom, 14 de Fev de 2010 às 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); - }); - - test('format month', function (assert) { - var expected = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Domingo Dom_Segunda-feira Seg_Terça-feira Ter_Quarta-feira Qua_Quinta-feira Qui_Sexta-feira Sex_Sábado Sáb'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'poucos segundos', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'um minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'um minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'uma hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uma hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'um dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'um dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dias', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'um dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dias', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dias', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'um mês', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'um mês', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'um mês', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'um mês', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'um ano', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anos', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'um ano', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anos', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'em poucos segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'poucos segundos atrás', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'em poucos segundos', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'em 5 dias', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hoje às 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1º', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1º', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2º', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2º', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3º', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('pt'); - - test('parse', function (assert) { - var tests = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'], - ['ddd, hA', 'Dom, 3PM'], - ['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14º 14'], - ['d do dddd ddd', '0 0º Domingo Dom'], - ['DDD DDDo DDDD', '45 45º 045'], - ['w wo ww', '6 6º 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45º day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 de Fevereiro de 2010'], - ['LLL', '14 de Fevereiro de 2010 15:25'], - ['LLLL', 'Domingo, 14 de Fevereiro de 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 de Fev de 2010'], - ['lll', '14 de Fev de 2010 15:25'], - ['llll', 'Dom, 14 de Fev de 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14º', '14º'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24º', '24º'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º'); - }); - - test('format month', function (assert) { - var expected = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Domingo Dom Dom_Segunda-Feira Seg 2ª_Terça-Feira Ter 3ª_Quarta-Feira Qua 4ª_Quinta-Feira Qui 5ª_Sexta-Feira Sex 6ª_Sábado Sáb Sáb'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'segundos', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'um minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'um minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minutos', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minutos', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'uma hora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'uma hora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 horas', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 horas', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 horas', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'um dia', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'um dia', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dias', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'um dia', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dias', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dias', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'um mês', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'um mês', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'um mês', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meses', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meses', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meses', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'um mês', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meses', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'um ano', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 anos', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'um ano', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 anos', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'em segundos', 'prefix'); - assert.equal(moment(0).from(30000), 'há segundos', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'em segundos', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'em 5 dias', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hoje às 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hoje às 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hoje às 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Amanhã às 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hoje às 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ontem às 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [às] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1º', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2º', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ro'); - - test('parse', function (assert) { - var tests = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss A', 'duminică, februarie 14 2010, 3:25:50 PM'], - ['ddd, hA', 'Dum, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 februarie febr.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 duminică Dum Du'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[a] DDDo[a zi a anului]', 'a 45a zi a anului'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 februarie 2010'], - ['LLL', '14 februarie 2010 15:25'], - ['LLLL', 'duminică, 14 februarie 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 febr. 2010'], - ['lll', '14 febr. 2010 15:25'], - ['llll', 'Dum, 14 febr. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie dec.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'duminică Dum Du_luni Lun Lu_marți Mar Ma_miercuri Mie Mi_joi Joi Jo_vineri Vin Vi_sâmbătă Sâm Sâ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'câteva secunde', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 de minute', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'o oră', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'o oră', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ore', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ore', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 de ore', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'o zi', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'o zi', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zile', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'o zi', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 zile', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 de zile', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'o lună', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'o lună', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'o lună', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 luni', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 luni', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 luni', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'o lună', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 luni', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ani', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ani', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 19}), true), '19 ani', '19 years = 19 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 20}), true), '20 de ani', '20 years = 20 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 100}), true), '100 de ani', '100 years = 100 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 101}), true), '101 ani', '101 years = 101 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 119}), true), '119 ani', '119 years = 119 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 120}), true), '120 de ani', '120 years = 120 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 219}), true), '219 ani', '219 years = 219 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 220}), true), '220 de ani', '220 years = 220 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'peste câteva secunde', 'prefix'); - assert.equal(moment(0).from(30000), 'câteva secunde în urmă', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'câteva secunde în urmă', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'peste câteva secunde', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'peste 5 zile', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'azi la 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'azi la 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'azi la 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'mâine la 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'azi la 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieri la 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ru'); - - test('parse', function (assert) { - var tests = 'январь янв._февраль февр._март март_апрель апр._май май_июнь июнь_июль июль_август авг._сентябрь сент._октябрь окт._ноябрь нояб._декабрь дек.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - function equalTestStrict(input, mmm, monthIndex) { - assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - - equalTestStrict(tests[i][1], 'MMM', i); - equalTestStrict(tests[i][0], 'MMMM', i); - equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i); - equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i); - equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse exceptional case', function (assert) { - assert.equal(moment('11 Мая 1989', ['DD MMMM YYYY']).format('DD-MM-YYYY'), '11-05-1989'); - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'воскресенье, 14-го февраля 2010, 15:25:50'], - ['ddd, h A', 'вс, 3 дня'], - ['M Mo MM MMMM MMM', '2 2-й 02 февраль февр.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-го 14'], - ['d do dddd ddd dd', '0 0-й воскресенье вс вс'], - ['DDD DDDo DDDD', '45 45-й 045'], - ['w wo ww', '7 7-я 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'дня дня'], - ['DDDo [день года]', '45-й день года'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 февраля 2010 г.'], - ['LLL', '14 февраля 2010 г., 15:25'], - ['LLLL', 'воскресенье, 14 февраля 2010 г., 15:25'], - ['l', '14.2.2010'], - ['ll', '14 февр. 2010 г.'], - ['lll', '14 февр. 2010 г., 15:25'], - ['llll', 'вс, 14 февр. 2010 г., 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'ночи', 'night'); - assert.equal(moment([2012, 11, 28, 3, 59]).format('A'), 'ночи', 'night'); - assert.equal(moment([2012, 11, 28, 4, 0]).format('A'), 'утра', 'morning'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'утра', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'дня', 'afternoon'); - assert.equal(moment([2012, 11, 28, 16, 59]).format('A'), 'дня', 'afternoon'); - assert.equal(moment([2012, 11, 28, 17, 0]).format('A'), 'вечера', 'evening'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'вечера', 'evening'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-й', '1-й'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-й', '2-й'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-й', '3-й'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-й', '4-й'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-й', '5-й'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-й', '6-й'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-й', '7-й'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-й', '8-й'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-й', '9-й'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-й', '10-й'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-й', '11-й'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-й', '12-й'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-й', '13-й'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-й', '14-й'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-й', '15-й'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-й', '16-й'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-й', '17-й'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-й', '18-й'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-й', '19-й'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-й', '20-й'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-й', '21-й'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-й', '22-й'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-й', '23-й'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-й', '24-й'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-й', '25-й'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-й', '26-й'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-й', '27-й'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-й', '28-й'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-й', '29-й'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-й', '30-й'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-й', '31-й'); - }); - - test('format month', function (assert) { - var expected = 'январь янв._февраль февр._март март_апрель апр._май май_июнь июнь_июль июль_август авг._сентябрь сент._октябрь окт._ноябрь нояб._декабрь дек.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format month case', function (assert) { - var months = { - 'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - 'accusative': 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]); - } - }); - - test('format month short case', function (assert) { - var monthsShort = { - 'nominative': 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_'), - 'accusative': 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMM'), monthsShort.nominative[i], '1 ' + monthsShort.nominative[i]); - } - }); - - test('format month case with escaped symbols', function (assert) { - var months = { - 'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - 'accusative': 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMMM[]'), '1 ' + months.accusative[i] + '', '1 ' + months.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-й день] MMMM'), '1-й день ' + months.accusative[i], '1-й день ' + months.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMMM'), '1, ' + months.nominative[i], '1, ' + months.nominative[i]); - } - }); - - test('format month short case with escaped symbols', function (assert) { - var monthsShort = { - 'nominative': 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_'), - 'accusative': 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2013, i, 1]).format('D[] MMM'), '1 ' + monthsShort.accusative[i], '1 ' + monthsShort.accusative[i]); - assert.equal(moment([2013, i, 1]).format('[]D[] []MMM[]'), '1 ' + monthsShort.accusative[i] + '', '1 ' + monthsShort.accusative[i] + ''); - assert.equal(moment([2013, i, 1]).format('D[-й день] MMM'), '1-й день ' + monthsShort.accusative[i], '1-й день ' + monthsShort.accusative[i]); - assert.equal(moment([2013, i, 1]).format('D, MMM'), '1, ' + monthsShort.nominative[i], '1, ' + monthsShort.nominative[i]); - } - }); - - test('format week', function (assert) { - var expected = 'воскресенье вс вс_понедельник пн пн_вторник вт вт_среда ср ср_четверг чт чт_пятница пт пт_суббота сб сб'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'несколько секунд', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'минута', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'минута', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 минуты', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 31}), true), '31 минута', '31 minutes = 31 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 минуты', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'час', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'час', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 часа', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 часов', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 час', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'день', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'день', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 дня', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'день', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 дней', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 дней', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 день', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 дней', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'месяц', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'месяц', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'месяц', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 месяца', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 месяца', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 месяца', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'месяц', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 месяцев', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'год', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 года', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'год', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 лет', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'через несколько секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'несколько секунд назад', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'через несколько секунд', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'через 5 дней', 'in 5 days'); - assert.equal(moment().add({m: 31}).fromNow(), 'через 31 минуту', 'in 31 minutes = in 31 minutes'); - assert.equal(moment().subtract({m: 31}).fromNow(), '31 минуту назад', '31 minutes ago = 31 minutes ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Сегодня в 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Сегодня в 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Сегодня в 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Завтра в 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сегодня в 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчера в 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, now; - - function makeFormatNext(d) { - switch (d.day()) { - case 0: - return '[В следующее] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd [в] LT'; - } - } - - function makeFormatThis(d) { - if (d.day() === 2) { - return '[Во] dddd [в] LT'; - } - else { - return '[В] dddd [в] LT'; - } - } - - now = moment().startOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).add({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today + ' + i + ' days end of day'); - } - - now = moment().endOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).add({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatNext(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, now; - - function makeFormatLast(d) { - switch (d.day()) { - case 0: - return '[В прошлое] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd [в] LT'; - } - } - - function makeFormatThis(d) { - if (d.day() === 2) { - return '[Во] dddd [в] LT'; - } - else { - return '[В] dddd [в] LT'; - } - } - - now = moment().startOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).subtract({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days end of day'); - } - - now = moment().endOf('week'); - for (i = 2; i < 7; i++) { - m = moment(now).subtract({d: i}); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-я', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-я', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-я', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-я', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-я', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('se'); - - test('parse', function (assert) { - var i, - tests = 'ođđajagemánnu ođđj_guovvamánnu guov_njukčamánnu njuk_cuoŋománnu cuo_miessemánnu mies_geassemánnu geas_suoidnemánnu suoi_borgemánnu borg_čakčamánnu čakč_golggotmánnu golg_skábmamánnu skáb_juovlamánnu juov'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'sotnabeaivi, guovvamánnu 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'sotn, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 guovvamánnu guov'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. sotnabeaivi sotn s'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[jagi] DDDo [beaivi]', 'jagi 45. beaivi'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', 'guovvamánnu 14. b. 2010'], - ['LLL', 'guovvamánnu 14. b. 2010 ti. 15:25'], - ['LLLL', 'sotnabeaivi, guovvamánnu 14. b. 2010 ti. 15:25'], - ['l', '14.2.2010'], - ['ll', 'guov 14. b. 2010'], - ['lll', 'guov 14. b. 2010 ti. 15:25'], - ['llll', 'sotn, guov 14. b. 2010 ti. 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var i, - expected = 'ođđajagemánnu ođđj_guovvamánnu guov_njukčamánnu njuk_cuoŋománnu cuo_miessemánnu mies_geassemánnu geas_suoidnemánnu suoi_borgemánnu borg_čakčamánnu čakč_golggotmánnu golg_skábmamánnu skáb_juovlamánnu juov'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'sotnabeaivi sotn s_vuossárga vuos v_maŋŋebárga maŋ m_gaskavahkku gask g_duorastat duor d_bearjadat bear b_lávvardat láv L'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'moadde sekunddat', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'okta minuhta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'okta minuhta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuhtat', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuhtat', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'okta diimmu', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'okta diimmu', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 diimmut', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 diimmut', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 diimmut', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'okta beaivi', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'okta beaivi', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 beaivvit', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'okta beaivi', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 beaivvit', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 beaivvit', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'okta mánnu', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'okta mánnu', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'okta mánnu', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mánut', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mánut', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mánut', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'okta mánnu', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mánut', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'okta jahki', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 jagit', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'okta jahki', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 jagit', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'moadde sekunddat geažes', 'prefix'); - assert.equal(moment(0).from(30000), 'maŋit moadde sekunddat', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'maŋit moadde sekunddat', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'moadde sekunddat geažes', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 beaivvit geažes', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'otne ti 12:00', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'otne ti 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'otne ti 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ihttin ti 12:00', 'Tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'otne ti 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ikte ti 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [ti] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ti] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ti] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ovddit] dddd [ti] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('si'); - - /*jshint -W100*/ - test('parse', function (assert) { - var tests = 'ජනවාරි ජන_පෙබරවාරි පෙබ_මාර්තු මාර්_අප්‍රේල් අප්_මැයි මැයි_ජූනි ජූනි_ජූලි ජූලි_අගෝස්තු අගෝ_සැප්තැම්බර් සැප්_ඔක්තෝබර් ඔක්_නොවැම්බර් නොවැ_දෙසැම්බර් දෙසැ'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['YYYY MMMM Do dddd, a h:mm:ss', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['YYYY MMMM Do dddd, a h:mm:ss', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['ddd, A h', 'ඉරි, පස් වරු 3'], - ['M Mo MM MMMM MMM', '2 2 වැනි 02 පෙබරවාරි පෙබ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 වැනි 14'], - ['d do dddd ddd dd', '0 0 වැනි ඉරිදා ඉරි ඉ'], - ['DDD DDDo DDDD', '45 45 වැනි 045'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ප.ව. පස් වරු'], - ['[වසරේ] DDDo [දිනය]', 'වසරේ 45 වැනි දිනය'], - ['LTS', 'ප.ව. 3:25:50'], - ['LT', 'ප.ව. 3:25'], - ['L', '2010/02/14'], - ['LL', '2010 පෙබරවාරි 14'], - ['LLL', '2010 පෙබරවාරි 14, ප.ව. 3:25'], - ['LLLL', '2010 පෙබරවාරි 14 වැනි ඉරිදා, ප.ව. 3:25:50'], - ['l', '2010/2/14'], - ['ll', '2010 පෙබ 14'], - ['lll', '2010 පෙබ 14, ප.ව. 3:25'], - ['llll', '2010 පෙබ 14 වැනි ඉරි, ප.ව. 3:25:50'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1 වැනි', '1 වැනි'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2 වැනි', '2 වැනි'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3 වැනි', '3 වැනි'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4 වැනි', '4 වැනි'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5 වැනි', '5 වැනි'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6 වැනි', '6 වැනි'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7 වැනි', '7 වැනි'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8 වැනි', '8 වැනි'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9 වැනි', '9 වැනි'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10 වැනි', '10 වැනි'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11 වැනි', '11 වැනි'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12 වැනි', '12 වැනි'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13 වැනි', '13 වැනි'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14 වැනි', '14 වැනි'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15 වැනි', '15 වැනි'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16 වැනි', '16 වැනි'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17 වැනි', '17 වැනි'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18 වැනි', '18 වැනි'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19 වැනි', '19 වැනි'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20 වැනි', '20 වැනි'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21 වැනි', '21 වැනි'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22 වැනි', '22 වැනි'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23 වැනි', '23 වැනි'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24 වැනි', '24 වැනි'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25 වැනි', '25 වැනි'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26 වැනි', '26 වැනි'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27 වැනි', '27 වැනි'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28 වැනි', '28 වැනි'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29 වැනි', '29 වැනි'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30 වැනි', '30 වැනි'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31 වැනි', '31 වැනි'); - }); - - test('format month', function (assert) { - var expected = 'ජනවාරි ජන_පෙබරවාරි පෙබ_මාර්තු මාර්_අප්‍රේල් අප්_මැයි මැයි_ජූනි ජූනි_ජූලි ජූලි_අගෝස්තු අගෝ_සැප්තැම්බර් සැප්_ඔක්තෝබර් ඔක්_නොවැම්බර් නොවැ_දෙසැම්බර් දෙසැ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ඉරිදා ඉරි ඉ_සඳුදා සඳු ස_අඟහරුවාදා අඟ අ_බදාදා බදා බ_බ්‍රහස්පතින්දා බ්‍රහ බ්‍ර_සිකුරාදා සිකු සි_සෙනසුරාදා සෙන සෙ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'තත්පර කිහිපය', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'මිනිත්තුව', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'මිනිත්තුව', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'මිනිත්තු 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'මිනිත්තු 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'පැය', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'පැය', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'පැය 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'පැය 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'පැය 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'දිනය', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'දිනය', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'දින 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'දිනය', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'දින 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'දින 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'මාසය', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'මාසය', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'මාසය', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'මාස 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'මාස 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'මාස 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'මාසය', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'මාස 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'වසර', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'වසර 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'වසර', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'වසර 5', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'තත්පර කිහිපයකින්', 'prefix'); - assert.equal(moment(0).from(30000), 'තත්පර කිහිපයකට පෙර', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'තත්පර කිහිපයකට පෙර', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'තත්පර කිහිපයකින්', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'දින 5කින්', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'අද ප.ව. 12:00ට', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'අද ප.ව. 12:25ට', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'අද ප.ව. 1:00ට', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'හෙට ප.ව. 12:00ට', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'අද පෙ.ව. 11:00ට', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ඊයේ ප.ව. 12:00ට', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd LT[ට]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd LT[ට]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd LT[ට]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[පසුගිය] dddd LT[ට]'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[පසුගිය] dddd LT[ට]'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[පසුගිය] dddd LT[ට]'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sk'); - - test('parse', function (assert) { - var tests = 'január jan._február feb._marec mar._apríl apr._máj máj_jún jún._júl júl._august aug._september sep._október okt._november nov._december dec.'.split('_'), i; - function equalTest(input, mmm, monthIndex) { - assert.equal(moment(input, mmm).month(), monthIndex, input + ' should be month ' + (monthIndex + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss', 'nedeľa, február 14. 2010, 3:25:50'], - ['ddd, h', 'ne, 3'], - ['M Mo MM MMMM MMM', '2 2. 02 február feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. nedeľa ne ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['DDDo [deň v roku]', '45. deň v roku'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14. február 2010'], - ['LLL', '14. február 2010 15:25'], - ['LLLL', 'nedeľa 14. február 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14. feb 2010'], - ['lll', '14. feb 2010 15:25'], - ['llll', 'ne 14. feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'január jan_február feb_marec mar_apríl apr_máj máj_jún jún_júl júl_august aug_september sep_október okt_november nov_december dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'nedeľa ne ne_pondelok po po_utorok ut ut_streda st st_štvrtok št št_piatok pi pi_sobota so so'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'pár sekúnd', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minúta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minúta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minúty', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minút', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'hodina', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'hodina', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 hodiny', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 hodín', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 hodín', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'deň', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'deň', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'deň', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dní', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dní', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mesiac', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mesiac', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mesiac', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesiace', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesiace', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesiace', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mesiac', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesiacov', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'rok', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 roky', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'rok', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 rokov', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za pár sekúnd', 'prefix'); - assert.equal(moment(0).from(30000), 'pred pár sekundami', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pred pár sekundami', 'now from now should display as in the past'); - }); - - test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekúnd', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'za minútu', 'in a minute'); - assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minúty', 'in 3 minutes'); - assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minút', 'in 10 minutes'); - assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); - assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); - assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodín', 'in 10 hours'); - assert.equal(moment().add({d: 1}).fromNow(), 'za deň', 'in a day'); - assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dni', 'in 3 days'); - assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); - assert.equal(moment().add({M: 1}).fromNow(), 'za mesiac', 'in a month'); - assert.equal(moment().add({M: 3}).fromNow(), 'za 3 mesiace', 'in 3 months'); - assert.equal(moment().add({M: 10}).fromNow(), 'za 10 mesiacov', 'in 10 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); - assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); - assert.equal(moment().add({y: 10}).fromNow(), 'za 10 rokov', 'in 10 years'); - }); - - test('fromNow (past)', function (assert) { - assert.equal(moment().subtract({s: 30}).fromNow(), 'pred pár sekundami', 'a few seconds ago'); - assert.equal(moment().subtract({m: 1}).fromNow(), 'pred minútou', 'a minute ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'pred 3 minútami', '3 minutes ago'); - assert.equal(moment().subtract({m: 10}).fromNow(), 'pred 10 minútami', '10 minutes ago'); - assert.equal(moment().subtract({h: 1}).fromNow(), 'pred hodinou', 'an hour ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'pred 3 hodinami', '3 hours ago'); - assert.equal(moment().subtract({h: 10}).fromNow(), 'pred 10 hodinami', '10 hours ago'); - assert.equal(moment().subtract({d: 1}).fromNow(), 'pred dňom', 'a day ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'pred 3 dňami', '3 days ago'); - assert.equal(moment().subtract({d: 10}).fromNow(), 'pred 10 dňami', '10 days ago'); - assert.equal(moment().subtract({M: 1}).fromNow(), 'pred mesiacom', 'a month ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'pred 3 mesiacmi', '3 months ago'); - assert.equal(moment().subtract({M: 10}).fromNow(), 'pred 10 mesiacmi', '10 months ago'); - assert.equal(moment().subtract({y: 1}).fromNow(), 'pred rokom', 'a year ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'pred 3 rokmi', '3 years ago'); - assert.equal(moment().subtract({y: 10}).fromNow(), 'pred 10 rokmi', '10 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'dnes o 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'dnes o 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'dnes o 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'zajtra o 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'dnes o 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včera o 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m, nextDay; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - nextDay = ''; - switch (m.day()) { - case 0: - nextDay = 'v nedeľu'; - break; - case 1: - nextDay = 'v pondelok'; - break; - case 2: - nextDay = 'v utorok'; - break; - case 3: - nextDay = 'v stredu'; - break; - case 4: - nextDay = 'vo štvrtok'; - break; - case 5: - nextDay = 'v piatok'; - break; - case 6: - nextDay = 'v sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + nextDay + '] [o] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m, lastDay; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - lastDay = ''; - switch (m.day()) { - case 0: - lastDay = 'minulú nedeľu'; - break; - case 1: - lastDay = 'minulý pondelok'; - break; - case 2: - lastDay = 'minulý utorok'; - break; - case 3: - lastDay = 'minulú stredu'; - break; - case 4: - lastDay = 'minulý štvrtok'; - break; - case 5: - lastDay = 'minulý piatok'; - break; - case 6: - lastDay = 'minulú sobotu'; - break; - } - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[' + lastDay + '] [o] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('humanize duration', function (assert) { - assert.equal(moment.duration(1, 'minutes').humanize(), 'minúta', 'a minute (future)'); - assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minútu', 'in a minute'); - assert.equal(moment.duration(-1, 'minutes').humanize(), 'minúta', 'a minute (past)'); - assert.equal(moment.duration(-1, 'minutes').humanize(true), 'pred minútou', 'a minute ago'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sl'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._marec mar._april apr._maj maj_junij jun._julij jul._avgust avg._september sep._oktober okt._november nov._december dec.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. nedelja ned. ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14. 02. 2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedelja, 14. februar 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 14. feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan._februar feb._marec mar._april apr._maj maj._junij jun._julij jul._avgust avg._september sep._oktober okt._november nov._december dec.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'nedelja ned. ne_ponedeljek pon. po_torek tor. to_sreda sre. sr_četrtek čet. če_petek pet. pe_sobota sob. so'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nekaj sekund', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ena minuta', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ena minuta', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuti', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minut', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ena ura', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ena ura', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 uri', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ur', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ur', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dni', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dni', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en mesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en mesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en mesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesece', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en mesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesecev', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'eno leto', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 leti', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eno leto', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years = 5 years'); - - assert.equal(start.from(moment([2007, 1, 28]).add({m: 1}), true), 'ena minuta', 'a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 2}), true), '2 minuti', '2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 3}), true), '3 minute', '3 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 4}), true), '4 minute', '4 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 5}), true), '5 minut', '5 minutes'); - - assert.equal(start.from(moment([2007, 1, 28]).add({h: 1}), true), 'ena ura', 'an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 2}), true), '2 uri', '2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 3}), true), '3 ure', '3 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 4}), true), '4 ure', '4 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ur', '5 hours'); - - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dan', 'a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 2}), true), '2 dni', '2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 3}), true), '3 dni', '3 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 4}), true), '4 dni', '4 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dni', '5 days'); - - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en mesec', 'a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 2}), true), '2 meseca', '2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 3}), true), '3 mesece', '3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 4}), true), '4 mesece', '4 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesecev', '5 months'); - - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'eno leto', 'a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 2}), true), '2 leti', '2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 3}), true), '3 leta', '3 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 4}), true), '4 leta', '4 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 let', '5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'čez nekaj sekund', 'prefix'); - assert.equal(moment(0).from(30000), 'pred nekaj sekundami', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pred nekaj sekundami', 'now from now should display as in the past'); - }); - - test('fromNow (future)', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'čez nekaj sekund', 'in a few seconds'); - assert.equal(moment().add({m: 1}).fromNow(), 'čez eno minuto', 'in a minute'); - assert.equal(moment().add({m: 2}).fromNow(), 'čez 2 minuti', 'in 2 minutes'); - assert.equal(moment().add({m: 3}).fromNow(), 'čez 3 minute', 'in 3 minutes'); - assert.equal(moment().add({m: 4}).fromNow(), 'čez 4 minute', 'in 4 minutes'); - assert.equal(moment().add({m: 5}).fromNow(), 'čez 5 minut', 'in 5 minutes'); - - assert.equal(moment().add({h: 1}).fromNow(), 'čez eno uro', 'in an hour'); - assert.equal(moment().add({h: 2}).fromNow(), 'čez 2 uri', 'in 2 hours'); - assert.equal(moment().add({h: 3}).fromNow(), 'čez 3 ure', 'in 3 hours'); - assert.equal(moment().add({h: 4}).fromNow(), 'čez 4 ure', 'in 4 hours'); - assert.equal(moment().add({h: 5}).fromNow(), 'čez 5 ur', 'in 5 hours'); - - assert.equal(moment().add({d: 1}).fromNow(), 'čez en dan', 'in a day'); - assert.equal(moment().add({d: 2}).fromNow(), 'čez 2 dni', 'in 2 days'); - assert.equal(moment().add({d: 3}).fromNow(), 'čez 3 dni', 'in 3 days'); - assert.equal(moment().add({d: 4}).fromNow(), 'čez 4 dni', 'in 4 days'); - assert.equal(moment().add({d: 5}).fromNow(), 'čez 5 dni', 'in 5 days'); - - assert.equal(moment().add({M: 1}).fromNow(), 'čez en mesec', 'in a month'); - assert.equal(moment().add({M: 2}).fromNow(), 'čez 2 meseca', 'in 2 months'); - assert.equal(moment().add({M: 3}).fromNow(), 'čez 3 mesece', 'in 3 months'); - assert.equal(moment().add({M: 4}).fromNow(), 'čez 4 mesece', 'in 4 months'); - assert.equal(moment().add({M: 5}).fromNow(), 'čez 5 mesecev', 'in 5 months'); - - assert.equal(moment().add({y: 1}).fromNow(), 'čez eno leto', 'in a year'); - assert.equal(moment().add({y: 2}).fromNow(), 'čez 2 leti', 'in 2 years'); - assert.equal(moment().add({y: 3}).fromNow(), 'čez 3 leta', 'in 3 years'); - assert.equal(moment().add({y: 4}).fromNow(), 'čez 4 leta', 'in 4 years'); - assert.equal(moment().add({y: 5}).fromNow(), 'čez 5 let', 'in 5 years'); - - assert.equal(moment().subtract({s: 30}).fromNow(), 'pred nekaj sekundami', 'a few seconds ago'); - - assert.equal(moment().subtract({m: 1}).fromNow(), 'pred eno minuto', 'a minute ago'); - assert.equal(moment().subtract({m: 2}).fromNow(), 'pred 2 minutama', '2 minutes ago'); - assert.equal(moment().subtract({m: 3}).fromNow(), 'pred 3 minutami', '3 minutes ago'); - assert.equal(moment().subtract({m: 4}).fromNow(), 'pred 4 minutami', '4 minutes ago'); - assert.equal(moment().subtract({m: 5}).fromNow(), 'pred 5 minutami', '5 minutes ago'); - - assert.equal(moment().subtract({h: 1}).fromNow(), 'pred eno uro', 'an hour ago'); - assert.equal(moment().subtract({h: 2}).fromNow(), 'pred 2 urama', '2 hours ago'); - assert.equal(moment().subtract({h: 3}).fromNow(), 'pred 3 urami', '3 hours ago'); - assert.equal(moment().subtract({h: 4}).fromNow(), 'pred 4 urami', '4 hours ago'); - assert.equal(moment().subtract({h: 5}).fromNow(), 'pred 5 urami', '5 hours ago'); - - assert.equal(moment().subtract({d: 1}).fromNow(), 'pred enim dnem', 'a day ago'); - assert.equal(moment().subtract({d: 2}).fromNow(), 'pred 2 dnevoma', '2 days ago'); - assert.equal(moment().subtract({d: 3}).fromNow(), 'pred 3 dnevi', '3 days ago'); - assert.equal(moment().subtract({d: 4}).fromNow(), 'pred 4 dnevi', '4 days ago'); - assert.equal(moment().subtract({d: 5}).fromNow(), 'pred 5 dnevi', '5 days ago'); - - assert.equal(moment().subtract({M: 1}).fromNow(), 'pred enim mesecem', 'a month ago'); - assert.equal(moment().subtract({M: 2}).fromNow(), 'pred 2 mesecema', '2 months ago'); - assert.equal(moment().subtract({M: 3}).fromNow(), 'pred 3 meseci', '3 months ago'); - assert.equal(moment().subtract({M: 4}).fromNow(), 'pred 4 meseci', '4 months ago'); - assert.equal(moment().subtract({M: 5}).fromNow(), 'pred 5 meseci', '5 months ago'); - - assert.equal(moment().subtract({y: 1}).fromNow(), 'pred enim letom', 'a year ago'); - assert.equal(moment().subtract({y: 2}).fromNow(), 'pred 2 letoma', '2 years ago'); - assert.equal(moment().subtract({y: 3}).fromNow(), 'pred 3 leti', '3 years ago'); - assert.equal(moment().subtract({y: 4}).fromNow(), 'pred 4 leti', '4 years ago'); - assert.equal(moment().subtract({y: 5}).fromNow(), 'pred 5 leti', '5 years ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danes ob 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danes ob 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danes ob 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'jutri ob 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danes ob 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'včeraj ob 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sq'); - - test('parse', function (assert) { - var i, - tests = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, HH:mm:ss', 'E Diel, Shkurt 14. 2010, 15:25:50'], - ['ddd, HH', 'Die, 15'], - ['M Mo MM MMMM MMM', '2 2. 02 Shkurt Shk'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. E Diel Die D'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'MD MD'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Shkurt 2010'], - ['LLL', '14 Shkurt 2010 15:25'], - ['LLLL', 'E Diel, 14 Shkurt 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Shk 2010'], - ['lll', '14 Shk 2010 15:25'], - ['llll', 'Die, 14 Shk 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), 'PD', 'before dawn'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), 'MD', 'noon'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var i, - expected = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'E Diel Die D_E Hënë Hën H_E Martë Mar Ma_E Mërkurë Mër Më_E Enjte Enj E_E Premte Pre P_E Shtunë Sht Sh'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'disa sekonda', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'një minutë', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'një minutë', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuta', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'një orë', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'një orë', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 orë', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 orë', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 orë', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'një ditë', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'një ditë', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ditë', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'një ditë', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ditë', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ditë', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'një muaj', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'një muaj', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'një muaj', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 muaj', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 muaj', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 muaj', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'një muaj', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 muaj', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'një vit', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 vite', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'një vit', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 vite', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'në disa sekonda', 'prefix'); - assert.equal(moment(0).from(30000), 'disa sekonda më parë', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'disa sekonda më parë', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'në disa sekonda', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'në 5 ditë', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Sot në 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Sot në 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Sot në 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Nesër në 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Sot në 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Dje në 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [në] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [në] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [në] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [e kaluar në] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sr-cyrl'); - - test('parse', function (assert) { - var tests = 'јануар јан._фебруар феб._март мар._април апр._мај мај_јун јун_јул јул_август авг._септембар сеп._октобар окт._новембар нов._децембар дец.'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'недеља, 14. фебруар 2010, 3:25:50 pm'], - ['ddd, hA', 'нед., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 фебруар феб.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. недеља нед. не'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14. 02. 2010'], - ['LL', '14. фебруар 2010'], - ['LLL', '14. фебруар 2010 15:25'], - ['LLLL', 'недеља, 14. фебруар 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. феб. 2010'], - ['lll', '14. феб. 2010 15:25'], - ['llll', 'нед., 14. феб. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'јануар јан._фебруар феб._март мар._април апр._мај мај_јун јун_јул јул_август авг._септембар сеп._октобар окт._новембар нов._децембар дец.'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'недеља нед. не_понедељак пон. по_уторак уто. ут_среда сре. ср_четвртак чет. че_петак пет. пе_субота суб. су'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'неколико секунди', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'један минут', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'један минут', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 минуте', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 минута', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'један сат', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'један сат', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 сата', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 сати', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 сати', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'дан', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'дан', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 дана', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'дан', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 дана', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 дана', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'месец', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'месец', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'месец', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 месеца', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 месеца', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 месеца', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'месец', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 месеци', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'годину', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 године', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'годину', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 година', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'за неколико секунди', 'prefix'); - assert.equal(moment(0).from(30000), 'пре неколико секунди', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'пре неколико секунди', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'за неколико секунди', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'за 5 дана', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'данас у 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'данас у 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'данас у 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'сутра у 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'данас у 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'јуче у 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - var lastWeekDay = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sr'); - - test('parse', function (assert) { - var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'], - ['ddd, hA', 'ned., 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 februar feb.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. nedelja ned. ne'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '7 7. 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15:25:50'], - ['L', '14. 02. 2010'], - ['LL', '14. februar 2010'], - ['LLL', '14. februar 2010 15:25'], - ['LLLL', 'nedelja, 14. februar 2010 15:25'], - ['l', '14. 2. 2010'], - ['ll', '14. feb. 2010'], - ['lll', '14. feb. 2010 15:25'], - ['llll', 'ned., 14. feb. 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'nedelja ned. ne_ponedeljak pon. po_utorak uto. ut_sreda sre. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split('_'), - i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'nekoliko sekundi', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'jedan minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'jedan minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuta', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'jedan sat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'jedan sat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 sata', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 sati', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 sati', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'dan', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'dan', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dana', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'dan', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dana', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dana', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mesec', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mesec', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mesec', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 meseca', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 meseca', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 meseca', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mesec', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 meseci', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'godinu', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 godine', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'godinu', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 godina', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'za nekoliko sekundi', 'prefix'); - assert.equal(moment(0).from(30000), 'pre nekoliko sekundi', 'prefix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'pre nekoliko sekundi', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'za nekoliko sekundi', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'za 5 dana', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'danas u 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'danas u 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'danas u 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'sutra u 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'danas u 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'juče u 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - var lastWeekDay = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - - return lastWeekDay[d.day()]; - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2.', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2.', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3.', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ss'); - - test('parse', function (assert) { - var tests = "Bhimbidvwane Bhi_Indlovana Ina_Indlov'lenkhulu Inu_Mabasa Mab_Inkhwekhweti Ink_Inhlaba Inh_Kholwane Kho_Ingci Igc_Inyoni Iny_Imphala Imp_Lweti lwe_Ingongoni Igo".split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('parse meridiem', function (assert) { - var i, - b = moment(), - meridiemTests = [ - // h a patterns, expected hours, isValid - ['10 ekuseni', 10, true], - ['11 emini', 11, true], - ['3 entsambama', 15, true], - ['4 entsambama', 16, true], - ['6 entsambama', 18, true], - ['7 ebusuku', 19, true], - ['12 ebusuku', 0, true], - ['10 am', 10, false], - ['10 pm', 10, false] - ], - parsed; - - // test that a formatted moment including meridiem string can be parsed back to the same moment - assert.ok(b.isSame(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true), 'seconds'), b.format('h:mm:ss a') + ' should be equal to ' + moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true).format('h:mm:ss a')); - - // test that a formatted moment having a meridiem string can be parsed with strict flag - assert.ok(moment(b.format('h:mm:ss a'), 'h:mm:ss a', 'ss', true).isValid(), b.format('h:mm:ss a') + ' should be parsed as valid'); - - for (i = 0; i < meridiemTests.length; i++) { - parsed = moment(meridiemTests[i][0], 'h a', 'ss', true); - assert.equal(parsed.isValid(), meridiemTests[i][2], 'validity for ' + meridiemTests[i][0]); - if (parsed.isValid()) { - assert.equal(parsed.hours(), meridiemTests[i][1], 'hours for ' + meridiemTests[i][0]); - } - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Lisontfo, Indlovana 14 2010, 3:25:50 entsambama'], - ['ddd, h A', 'Lis, 3 entsambama'], - ['M Mo MM MMMM MMM', '2 2 02 Indlovana Ina'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Lisontfo Lis Li'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'entsambama entsambama'], - ['[Lilanga] DDDo [lilanga lelinyaka]', 'Lilanga 45 lilanga lelinyaka'], - ['LTS', '3:25:50 entsambama'], - ['L', '14/02/2010'], - ['LL', '14 Indlovana 2010'], - ['LLL', '14 Indlovana 2010 3:25 entsambama'], - ['LLLL', 'Lisontfo, 14 Indlovana 2010 3:25 entsambama'], - ['l', '14/2/2010'], - ['ll', '14 Ina 2010'], - ['lll', '14 Ina 2010 3:25 entsambama'], - ['llll', 'Lis, 14 Ina 2010 3:25 entsambama'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = "Bhimbidvwane Bhi_Indlovana Ina_Indlov'lenkhulu Inu_Mabasa Mab_Inkhwekhweti Ink_Inhlaba Inh_Kholwane Kho_Ingci Igc_Inyoni Iny_Imphala Imp_Lweti Lwe_Ingongoni Igo".split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Lisontfo Lis Li_Umsombuluko Umb Us_Lesibili Lsb Lb_Lesitsatfu Les Lt_Lesine Lsi Ls_Lesihlanu Lsh Lh_Umgcibelo Umg Ug'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'emizuzwana lomcane', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'umzuzu', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'umzuzu', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 emizuzu', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 emizuzu', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'lihora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'lihora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 emahora', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 emahora', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 emahora', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'lilanga', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'lilanga', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 emalanga', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'lilanga', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 emalanga', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 emalanga', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'inyanga', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'inyanga', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'inyanga', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 tinyanga', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 tinyanga', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 tinyanga', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'inyanga', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 tinyanga', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'umnyaka', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 iminyaka', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'umnyaka', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 iminyaka', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'nga emizuzwana lomcane', 'prefix'); - assert.equal(moment(0).from(30000), 'wenteka nga emizuzwana lomcane', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'wenteka nga emizuzwana lomcane', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'nga emizuzwana lomcane', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'nga 5 emalanga', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Namuhla nga 12:00 emini', 'Today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Namuhla nga 12:25 emini', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Namuhla nga 1:00 emini', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Kusasa nga 12:00 emini', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Namuhla nga 11:00 emini', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Itolo nga 12:00 emini', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [nga] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [nga] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [nga] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [leliphelile] [nga] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 4 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sv'); - - test('parse', function (assert) { - var tests = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober okt_november nov_december dec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'söndag, februari 14e 2010, 3:25:50 pm'], - ['ddd, hA', 'sön, 3PM'], - ['M Mo MM MMMM MMM', '2 2a 02 februari feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14e 14'], - ['d do dddd ddd dd', '0 0e söndag sön sö'], - ['DDD DDDo DDDD', '45 45e 045'], - ['w wo ww', '6 6e 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45e day of the year'], - ['LTS', '15:25:50'], - ['L', '2010-02-14'], - ['LL', '14 februari 2010'], - ['LLL', '14 februari 2010 kl. 15:25'], - ['LLLL', 'söndag 14 februari 2010 kl. 15:25'], - ['l', '2010-2-14'], - ['ll', '14 feb 2010'], - ['lll', '14 feb 2010 15:25'], - ['llll', 'sön 14 feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4e', '4e'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5e', '5e'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6e', '6e'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7e', '7e'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8e', '8e'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9e', '9e'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10e', '10e'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11e', '11e'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12e', '12e'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13e', '13e'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14e', '14e'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15e', '15e'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16e', '16e'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17e', '17e'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18e', '18e'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19e', '19e'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20e', '20e'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23e', '23e'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24e', '24e'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25e', '25e'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26e', '26e'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27e', '27e'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28e', '28e'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29e', '29e'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30e', '30e'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a'); - }); - - test('format month', function (assert) { - var expected = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober okt_november nov_december dec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'söndag sön sö_måndag mån må_tisdag tis ti_onsdag ons on_torsdag tor to_fredag fre fr_lördag lör lö'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'några sekunder', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'en minut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'en minut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuter', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuter', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'en timme', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'en timme', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 timmar', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 timmar', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 timmar', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'en dag', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'en dag', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 dagar', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'en dag', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 dagar', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 dagar', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'en månad', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'en månad', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'en månad', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 månader', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 månader', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 månader', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'en månad', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 månader', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ett år', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 år', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ett år', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 år', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'om några sekunder', 'prefix'); - assert.equal(moment(0).from(30000), 'för några sekunder sedan', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'för några sekunder sedan', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'om några sekunder', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'om 5 dagar', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Idag 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Idag 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Idag 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Imorgon 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Idag 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Igår 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[På] dddd LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[På] dddd LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[På] dddd LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[I] dddd[s] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[I] dddd[s] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[I] dddd[s] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52a', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1a', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2a', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2a', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('sw'); - - test('parse', function (assert) { - var tests = 'Januari Jan_Februari Feb_Machi Mac_Aprili Apr_Mei Mei_Juni Jun_Julai Jul_Agosti Ago_Septemba Sep_Oktoba Okt_Novemba Nov_Desemba Des'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Jumapili, Februari 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Jpl, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 Februari Feb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Jumapili Jpl J2'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[siku] DDDo [ya mwaka]', 'siku 45 ya mwaka'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 Februari 2010'], - ['LLL', '14 Februari 2010 15:25'], - ['LLLL', 'Jumapili, 14 Februari 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Jpl, 14 Feb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'Januari Jan_Februari Feb_Machi Mac_Aprili Apr_Mei Mei_Juni Jun_Julai Jul_Agosti Ago_Septemba Sep_Oktoba Okt_Novemba Nov_Desemba Des'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Jumapili Jpl J2_Jumatatu Jtat J3_Jumanne Jnne J4_Jumatano Jtan J5_Alhamisi Alh Al_Ijumaa Ijm Ij_Jumamosi Jmos J1'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'hivi punde', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'dakika moja', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'dakika moja', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'dakika 2', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'dakika 44', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'saa limoja', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'saa limoja', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'masaa 2', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'masaa 5', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'masaa 21', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'siku moja', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'siku moja', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'masiku 2', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'siku moja', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'masiku 5', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'masiku 25', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'mwezi mmoja', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'mwezi mmoja', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'mwezi mmoja', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'miezi 2', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'miezi 2', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'miezi 3', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'mwezi mmoja', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'miezi 5', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'mwaka mmoja', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'miaka 2', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'mwaka mmoja', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'miaka 5', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'hivi punde baadaye', 'prefix'); - assert.equal(moment(0).from(30000), 'tokea hivi punde', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'tokea hivi punde', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'hivi punde baadaye', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'masiku 5 baadaye', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'leo saa 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'leo saa 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'leo saa 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'kesho saa 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'leo saa 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'jana 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[wiki ijayo] dddd [saat] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[wiki iliyopita] dddd [saat] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('ta'); - - test('parse', function (assert) { - var tests = 'ஜனவரி ஜனவரி_பிப்ரவரி பிப்ரவரி_மார்ச் மார்ச்_ஏப்ரல் ஏப்ரல்_மே மே_ஜூன் ஜூன்_ஜூலை ஜூலை_ஆகஸ்ட் ஆகஸ்ட்_செப்டெம்பர் செப்டெம்பர்_அக்டோபர் அக்டோபர்_நவம்பர் நவம்பர்_டிசம்பர் டிசம்பர்'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி ௧௪வது ௨௦௧௦, ௩:௨௫:௫௦ எற்பாடு'], - ['ddd, hA', 'ஞாயிறு, ௩ எற்பாடு'], - ['M Mo MM MMMM MMM', '௨ ௨வது ௦௨ பிப்ரவரி பிப்ரவரி'], - ['YYYY YY', '௨௦௧௦ ௧௦'], - ['D Do DD', '௧௪ ௧௪வது ௧௪'], - ['d do dddd ddd dd', '௦ ௦வது ஞாயிற்றுக்கிழமை ஞாயிறு ஞா'], - ['DDD DDDo DDDD', '௪௫ ௪௫வது ௦௪௫'], - ['w wo ww', '௮ ௮வது ௦௮'], - ['h hh', '௩ ௦௩'], - ['H HH', '௧௫ ௧௫'], - ['m mm', '௨௫ ௨௫'], - ['s ss', '௫௦ ௫௦'], - ['a A', ' எற்பாடு எற்பாடு'], - ['[ஆண்டின்] DDDo [நாள்]', 'ஆண்டின் ௪௫வது நாள்'], - ['LTS', '௧௫:௨௫:௫௦'], - ['L', '௧௪/௦௨/௨௦௧௦'], - ['LL', '௧௪ பிப்ரவரி ௨௦௧௦'], - ['LLL', '௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'], - ['LLLL', 'ஞாயிற்றுக்கிழமை, ௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'], - ['l', '௧௪/௨/௨௦௧௦'], - ['ll', '௧௪ பிப்ரவரி ௨௦௧௦'], - ['lll', '௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'], - ['llll', 'ஞாயிறு, ௧௪ பிப்ரவரி ௨௦௧௦, ௧௫:௨௫'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '௧வது', '௧வது'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '௨வது', '௨வது'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '௩வது', '௩வது'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '௪வது', '௪வது'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '௫வது', '௫வது'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '௬வது', '௬வது'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '௭வது', '௭வது'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '௮வது', '௮வது'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '௯வது', '௯வது'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '௧௦வது', '௧௦வது'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '௧௧வது', '௧௧வது'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '௧௨வது', '௧௨வது'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '௧௩வது', '௧௩வது'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '௧௪வது', '௧௪வது'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '௧௫வது', '௧௫வது'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '௧௬வது', '௧௬வது'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '௧௭வது', '௧௭வது'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '௧௮வது', '௧௮வது'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '௧௯வது', '௧௯வது'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '௨௦வது', '௨௦வது'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '௨௧வது', '௨௧வது'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '௨௨வது', '௨௨வது'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '௨௩வது', '௨௩வது'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '௨௪வது', '௨௪வது'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '௨௫வது', '௨௫வது'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '௨௬வது', '௨௬வது'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '௨௭வது', '௨௭வது'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '௨௮வது', '௨௮வது'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '௨௯வது', '௨௯வது'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '௩௦வது', '௩௦வது'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '௩௧வது', '௩௧வது'); - }); - - test('format month', function (assert) { - var expected = 'ஜனவரி ஜனவரி_பிப்ரவரி பிப்ரவரி_மார்ச் மார்ச்_ஏப்ரல் ஏப்ரல்_மே மே_ஜூன் ஜூன்_ஜூலை ஜூலை_ஆகஸ்ட் ஆகஸ்ட்_செப்டெம்பர் செப்டெம்பர்_அக்டோபர் அக்டோபர்_நவம்பர் நவம்பர்_டிசம்பர் டிசம்பர்'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ஞாயிற்றுக்கிழமை ஞாயிறு ஞா_திங்கட்கிழமை திங்கள் தி_செவ்வாய்கிழமை செவ்வாய் செ_புதன்கிழமை புதன் பு_வியாழக்கிழமை வியாழன் வி_வெள்ளிக்கிழமை வெள்ளி வெ_சனிக்கிழமை சனி ச'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ஒரு சில விநாடிகள்', '44 விநாடிகள் = ஒரு சில விநாடிகள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ஒரு நிமிடம்', '45 விநாடிகள் = ஒரு நிமிடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ஒரு நிமிடம்', '89 விநாடிகள் = ஒரு நிமிடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '௨ நிமிடங்கள்', '90 விநாடிகள் = ௨ நிமிடங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '௪௪ நிமிடங்கள்', '44 நிமிடங்கள் = 44 நிமிடங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ஒரு மணி நேரம்', '45 நிமிடங்கள் = ஒரு மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ஒரு மணி நேரம்', '89 நிமிடங்கள் = ஒரு மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '௨ மணி நேரம்', '90 நிமிடங்கள் = ௨ மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '௫ மணி நேரம்', '5 மணி நேரம் = 5 மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '௨௧ மணி நேரம்', '௨௧ மணி நேரம் = ௨௧ மணி நேரம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ஒரு நாள்', '௨௨ மணி நேரம் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ஒரு நாள்', '௩5 மணி நேரம் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '௨ நாட்கள்', '௩6 மணி நேரம் = ௨ days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ஒரு நாள்', '௧ நாள் = ஒரு நாள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '௫ நாட்கள்', '5 நாட்கள் = 5 நாட்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '௨௫ நாட்கள்', '௨5 நாட்கள் = ௨5 நாட்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ஒரு மாதம்', '௨6 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ஒரு மாதம்', '௩0 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ஒரு மாதம்', '45 நாட்கள் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '௨ மாதங்கள்', '46 நாட்கள் = ௨ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '௨ மாதங்கள்', '75 நாட்கள் = ௨ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '௩ மாதங்கள்', '76 நாட்கள் = ௩ மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ஒரு மாதம்', '௧ மாதம் = ஒரு மாதம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '௫ மாதங்கள்', '5 மாதங்கள் = 5 மாதங்கள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ஒரு வருடம்', '௩45 நாட்கள் = ஒரு வருடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '௨ ஆண்டுகள்', '548 நாட்கள் = ௨ ஆண்டுகள்'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ஒரு வருடம்', '௧ வருடம் = ஒரு வருடம்'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '௫ ஆண்டுகள்', '5 ஆண்டுகள் = 5 ஆண்டுகள்'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ஒரு சில விநாடிகள் இல்', 'prefix'); - assert.equal(moment(0).from(30000), 'ஒரு சில விநாடிகள் முன்', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ஒரு சில விநாடிகள் முன்', 'இப்போது இருந்து கடந்த காலத்தில் காட்ட வேண்டும்'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ஒரு சில விநாடிகள் இல்', 'ஒரு சில விநாடிகள் இல்'); - assert.equal(moment().add({d: 5}).fromNow(), '௫ நாட்கள் இல்', '5 நாட்கள் இல்'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'இன்று ௧௨:௦௦', 'இன்று 12:00'); - assert.equal(moment(a).add({m: 25}).calendar(), 'இன்று ௧௨:௨௫', 'இன்று 12:25'); - assert.equal(moment(a).add({h: 1}).calendar(), 'இன்று ௧௩:௦௦', 'இன்று 13:00'); - assert.equal(moment(a).add({d: 1}).calendar(), 'நாளை ௧௨:௦௦', 'நாளை 12:00'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'இன்று ௧௧:௦௦', 'இன்று 11:00'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'நேற்று ௧௨:௦௦', 'நேற்று 12:00'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd, LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd, LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd, LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[கடந்த வாரம்] dddd, LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[கடந்த வாரம்] dddd, LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[கடந்த வாரம்] dddd, LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 30]).format('a'), ' யாமம்', '(after) midnight'); - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), ' வைகறை', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), ' காலை', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), ' எற்பாடு', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), ' எற்பாடு', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), ' மாலை', 'late evening'); - assert.equal(moment([2011, 2, 23, 23, 30]).format('a'), ' யாமம்', '(before) midnight'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('te'); - - test('parse', function (assert) { - var tests = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జూలై జూలై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do తేదీ MMMM YYYY, a h:mm:ss', 'ఆదివారం, 14వ తేదీ ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25:50'], - ['ddd, a h గంటలు', 'ఆది, మధ్యాహ్నం 3 గంటలు'], - ['M Mo నెల MM MMMM MMM', '2 2వ నెల 02 ఫిబ్రవరి ఫిబ్ర.'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14వ 14'], - ['d do dddd ddd dd', '0 0వ ఆదివారం ఆది ఆ'], - ['DDD DDDo DDDD', '45 45వ 045'], - ['w wo ww', '8 8వ 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'మధ్యాహ్నం మధ్యాహ్నం'], - ['LTS', 'మధ్యాహ్నం 3:25:50'], - ['L', '14/02/2010'], - ['LL', '14 ఫిబ్రవరి 2010'], - ['LLL', '14 ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25'], - ['LLLL', 'ఆదివారం, 14 ఫిబ్రవరి 2010, మధ్యాహ్నం 3:25'], - ['l', '14/2/2010'], - ['ll', '14 ఫిబ్ర. 2010'], - ['lll', '14 ఫిబ్ర. 2010, మధ్యాహ్నం 3:25'], - ['llll', 'ఆది, 14 ఫిబ్ర. 2010, మధ్యాహ్నం 3:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1వ', '1వ'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2వ', '2వ'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3వ', '3వ'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4వ', '4వ'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5వ', '5వ'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6వ', '6వ'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7వ', '7వ'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8వ', '8వ'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9వ', '9వ'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10వ', '10వ'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11వ', '11వ'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12వ', '12వ'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13వ', '13వ'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14వ', '14వ'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15వ', '15వ'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16వ', '16వ'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17వ', '17వ'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18వ', '18వ'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19వ', '19వ'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20వ', '20వ'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21వ', '21వ'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22వ', '22వ'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23వ', '23వ'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24వ', '24వ'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25వ', '25వ'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26వ', '26వ'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27వ', '27వ'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28వ', '28వ'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29వ', '29వ'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30వ', '30వ'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31వ', '31వ'); - }); - - test('format month', function (assert) { - var expected = 'జనవరి జన._ఫిబ్రవరి ఫిబ్ర._మార్చి మార్చి_ఏప్రిల్ ఏప్రి._మే మే_జూన్ జూన్_జూలై జూలై_ఆగస్టు ఆగ._సెప్టెంబర్ సెప్._అక్టోబర్ అక్టో._నవంబర్ నవ._డిసెంబర్ డిసె.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ఆదివారం ఆది ఆ_సోమవారం సోమ సో_మంగళవారం మంగళ మం_బుధవారం బుధ బు_గురువారం గురు గు_శుక్రవారం శుక్ర శు_శనివారం శని శ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'కొన్ని క్షణాలు', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ఒక నిమిషం', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ఒక నిమిషం', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 నిమిషాలు', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 నిమిషాలు', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ఒక గంట', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ఒక గంట', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 గంటలు', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 గంటలు', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 గంటలు', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ఒక రోజు', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ఒక రోజు', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 రోజులు', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ఒక రోజు', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 రోజులు', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 రోజులు', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ఒక నెల', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ఒక నెల', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ఒక నెల', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 నెలలు', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 నెలలు', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 నెలలు', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ఒక నెల', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 నెలలు', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ఒక సంవత్సరం', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 సంవత్సరాలు', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ఒక సంవత్సరం', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 సంవత్సరాలు', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'కొన్ని క్షణాలు లో', 'prefix'); - assert.equal(moment(0).from(30000), 'కొన్ని క్షణాలు క్రితం', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'కొన్ని క్షణాలు క్రితం', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'కొన్ని క్షణాలు లో', 'కొన్ని క్షణాలు లో'); - assert.equal(moment().add({d: 5}).fromNow(), '5 రోజులు లో', '5 రోజులు లో'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'నేడు మధ్యాహ్నం 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'నేడు మధ్యాహ్నం 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 3}).calendar(), 'నేడు మధ్యాహ్నం 3:00', 'Now plus 3 hours'); - assert.equal(moment(a).add({d: 1}).calendar(), 'రేపు మధ్యాహ్నం 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'నేడు మధ్యాహ్నం 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'నిన్న మధ్యాహ్నం 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[,] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[గత] dddd[,] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[గత] dddd[,] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[గత] dddd[,] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 2, 30]).format('a'), 'రాత్రి', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('a'), 'ఉదయం', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'మధ్యాహ్నం', 'during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'సాయంత్రం', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'సాయంత్రం', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'రాత్రి', 'night'); - - assert.equal(moment([2011, 2, 23, 2, 30]).format('A'), 'రాత్రి', 'before dawn'); - assert.equal(moment([2011, 2, 23, 9, 30]).format('A'), 'ఉదయం', 'morning'); - assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'మధ్యాహ్నం', ' during day'); - assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'సాయంత్రం', 'evening'); - assert.equal(moment([2011, 2, 23, 19, 30]).format('A'), 'సాయంత్రం', 'late evening'); - assert.equal(moment([2011, 2, 23, 21, 20]).format('A'), 'రాత్రి', 'night'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1వ', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1వ', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2వ', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2వ', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3వ', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('th'); - - test('parse', function (assert) { - var tests = 'มกราคม มกรา_กุมภาพันธ์ กุมภา_มีนาคม มีนา_เมษายน เมษา_พฤษภาคม พฤษภา_มิถุนายน มิถุนา_กรกฎาคม กรกฎา_สิงหาคม สิงหา_กันยายน กันยา_ตุลาคม ตุลา_พฤศจิกายน พฤศจิกา_ธันวาคม ธันวา'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, h:mm:ss a', 'อาทิตย์, 14 กุมภาพันธ์ 2010, 3:25:50 หลังเที่ยง'], - ['ddd, h A', 'อาทิตย์, 3 หลังเที่ยง'], - ['M Mo MM MMMM MMM', '2 2 02 กุมภาพันธ์ กุมภา'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 อาทิตย์ อาทิตย์ อา.'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'หลังเที่ยง หลังเที่ยง'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15 นาฬิกา 25 นาที 50 วินาที'], - ['L', '2010/02/14'], - ['LL', '14 กุมภาพันธ์ 2010'], - ['LLL', '14 กุมภาพันธ์ 2010 เวลา 15 นาฬิกา 25 นาที'], - ['LLLL', 'วันอาทิตย์ที่ 14 กุมภาพันธ์ 2010 เวลา 15 นาฬิกา 25 นาที'], - ['l', '2010/2/14'], - ['ll', '14 กุมภา 2010'], - ['lll', '14 กุมภา 2010 เวลา 15 นาฬิกา 25 นาที'], - ['llll', 'วันอาทิตย์ที่ 14 กุมภา 2010 เวลา 15 นาฬิกา 25 นาที'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = 'มกราคม มกรา_กุมภาพันธ์ กุมภา_มีนาคม มีนา_เมษายน เมษา_พฤษภาคม พฤษภา_มิถุนายน มิถุนา_กรกฎาคม กรกฎา_สิงหาคม สิงหา_กันยายน กันยา_ตุลาคม ตุลา_พฤศจิกายน พฤศจิกา_ธันวาคม ธันวา'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'อาทิตย์ อาทิตย์ อา._จันทร์ จันทร์ จ._อังคาร อังคาร อ._พุธ พุธ พ._พฤหัสบดี พฤหัส พฤ._ศุกร์ ศุกร์ ศ._เสาร์ เสาร์ ส.'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ไม่กี่วินาที', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 นาที', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 นาที', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 นาที', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 นาที', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '1 ชั่วโมง', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 ชั่วโมง', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ชั่วโมง', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ชั่วโมง', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ชั่วโมง', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1 วัน', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 วัน', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 วัน', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1 วัน', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 วัน', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 วัน', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '1 เดือน', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 เดือน', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 เดือน', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 เดือน', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 เดือน', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 เดือน', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '1 เดือน', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 เดือน', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '1 ปี', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ปี', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '1 ปี', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ปี', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'อีก ไม่กี่วินาที', 'prefix'); - assert.equal(moment(0).from(30000), 'ไม่กี่วินาทีที่แล้ว', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ไม่กี่วินาทีที่แล้ว', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'อีก ไม่กี่วินาที', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'อีก 5 วัน', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'วันนี้ เวลา 12 นาฬิกา 0 นาที', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'วันนี้ เวลา 12 นาฬิกา 25 นาที', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'วันนี้ เวลา 13 นาฬิกา 0 นาที', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'พรุ่งนี้ เวลา 12 นาฬิกา 0 นาที', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'วันนี้ เวลา 11 นาฬิกา 0 นาที', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'เมื่อวานนี้ เวลา 12 นาฬิกา 0 นาที', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd[หน้า เวลา] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd[หน้า เวลา] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd[หน้า เวลา] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[วัน]dddd[ที่แล้ว เวลา] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[วัน]dddd[ที่แล้ว เวลา] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[วัน]dddd[ที่แล้ว เวลา] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2', 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('tl-ph'); - - test('parse', function (assert) { - var tests = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.split('_'), - i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Linggo, Pebrero 14 2010, 3:25:50 pm'], - ['ddd, hA', 'Lin, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 Pebrero Peb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Linggo Lin Li'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '02/14/2010'], - ['LL', 'Pebrero 14, 2010'], - ['LLL', 'Pebrero 14, 2010 15:25'], - ['LLLL', 'Linggo, Pebrero 14, 2010 15:25'], - ['l', '2/14/2010'], - ['ll', 'Peb 14, 2010'], - ['lll', 'Peb 14, 2010 15:25'], - ['llll', 'Lin, Peb 14, 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Linggo Lin Li_Lunes Lun Lu_Martes Mar Ma_Miyerkules Miy Mi_Huwebes Huw Hu_Biyernes Biy Bi_Sabado Sab Sab'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ilang segundo', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'isang minuto', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'isang minuto', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuto', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuto', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'isang oras', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'isang oras', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 oras', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 oras', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 oras', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'isang araw', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'isang araw', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 araw', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'isang araw', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 araw', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 araw', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'isang buwan', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'isang buwan', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'isang buwan', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 buwan', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 buwan', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 buwan', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'isang buwan', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 buwan', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'isang taon', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 taon', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'isang taon', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 taon', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'sa loob ng ilang segundo', 'prefix'); - assert.equal(moment(0).from(30000), 'ilang segundo ang nakalipas', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'sa loob ng ilang segundo', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'sa loob ng 5 araw', 'in 5 days'); - }); - - test('same day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Ngayon sa 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Ngayon sa 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Ngayon sa 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Bukas sa 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Ngayon sa 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Kahapon sa 12:00', 'yesterday at the same time'); - }); - - test('same next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [sa] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [sa] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [sa] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('same last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [huling linggo] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [huling linggo] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [huling linggo] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('same all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('tlh'); - - //Current parsing method doesn't allow parsing correctly months 10, 11 and 12. - /* - * test('parse', function (assert) { - var tests = 'tera’ jar wa’.jar wa’_tera’ jar cha’.jar cha’_tera’ jar wej.jar wej_tera’ jar loS.jar loS_tera’ jar vagh.jar vagh_tera’ jar jav.jar jav_tera’ jar Soch.jar Soch_tera’ jar chorgh.jar chorgh_tera’ jar Hut.jar Hut_tera’ jar wa’maH.jar wa’maH_tera’ jar wa’maH wa’.jar wa’maH wa’_tera’ jar wa’maH cha’.jar wa’maH cha’'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split('.'); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - */ - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'lojmItjaj, tera’ jar cha’ 14. 2010, 3:25:50 pm'], - ['ddd, hA', 'lojmItjaj, 3PM'], - ['M Mo MM MMMM MMM', '2 2. 02 tera’ jar cha’ jar cha’'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. lojmItjaj lojmItjaj lojmItjaj'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[DIS jaj] DDDo', 'DIS jaj 45.'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 tera’ jar cha’ 2010'], - ['LLL', '14 tera’ jar cha’ 2010 15:25'], - ['LLLL', 'lojmItjaj, 14 tera’ jar cha’ 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 jar cha’ 2010'], - ['lll', '14 jar cha’ 2010 15:25'], - ['llll', 'lojmItjaj, 14 jar cha’ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'tera’ jar wa’ jar wa’_tera’ jar cha’ jar cha’_tera’ jar wej jar wej_tera’ jar loS jar loS_tera’ jar vagh jar vagh_tera’ jar jav jar jav_tera’ jar Soch jar Soch_tera’ jar chorgh jar chorgh_tera’ jar Hut jar Hut_tera’ jar wa’maH jar wa’maH_tera’ jar wa’maH wa’ jar wa’maH wa’_tera’ jar wa’maH cha’ jar wa’maH cha’'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'lojmItjaj lojmItjaj lojmItjaj_DaSjaj DaSjaj DaSjaj_povjaj povjaj povjaj_ghItlhjaj ghItlhjaj ghItlhjaj_loghjaj loghjaj loghjaj_buqjaj buqjaj buqjaj_ghInjaj ghInjaj ghInjaj'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'puS lup', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'wa’ tup', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'wa’ tup', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), 'cha’ tup', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), 'loSmaH loS tup', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'wa’ rep', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'wa’ rep', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), 'cha’ rep', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), 'vagh rep', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), 'cha’maH wa’ rep', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'wa’ jaj', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'wa’ jaj', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), 'cha’ jaj', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'wa’ jaj', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), 'vagh jaj', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), 'cha’maH vagh jaj', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'wa’ jar', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'wa’ jar', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'wa’ jar', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), 'cha’ jar', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), 'cha’ jar', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), 'wej jar', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'wa’ jar', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), 'vagh jar', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'wa’ DIS', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'cha’ DIS', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'wa’ DIS', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), 'vagh DIS', '5 years = 5 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 112}), true), 'wa’vatlh wa’maH cha’ DIS', '112 years = 112 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 122}), true), 'wa’vatlh cha’maH cha’ DIS', '122 years = 122 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 213}), true), 'cha’vatlh wa’maH wej DIS', '213 years = 213 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 223}), true), 'cha’vatlh cha’maH wej DIS', '223 years = 223 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'puS lup pIq', 'suffix'); - assert.equal(moment(0).from(30000), 'puS lup ret', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'puS lup ret', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'puS lup pIq', 'in a few seconds'); - assert.equal(moment().add({h: 1}).fromNow(), 'wa’ rep pIq', 'in an hour'); - assert.equal(moment().add({d: 5}).fromNow(), 'vagh leS', 'in 5 days'); - assert.equal(moment().add({M: 2}).fromNow(), 'cha’ waQ', 'in 2 months'); - assert.equal(moment().add({y: 1}).fromNow(), 'wa’ nem', 'in a year'); - assert.equal(moment().add({s: -30}).fromNow(), 'puS lup ret', 'a few seconds ago'); - assert.equal(moment().add({h: -1}).fromNow(), 'wa’ rep ret', 'an hour ago'); - assert.equal(moment().add({d: -5}).fromNow(), 'vagh Hu’', '5 days ago'); - assert.equal(moment().add({M: -2}).fromNow(), 'cha’ wen', '2 months ago'); - assert.equal(moment().add({y: -1}).fromNow(), 'wa’ ben', 'a year ago'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'DaHjaj 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'DaHjaj 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'DaHjaj 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'wa’leS 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'DaHjaj 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'wa’Hu’ 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('LLL'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LLL'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LLL'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('LLL'), 'Today - ' + i + ' days current time'); - - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('LLL'), 'Today - ' + i + ' days beginning of day'); - - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('LLL'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('tr'); - - test('parse', function (assert) { - var tests = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Pazar, Şubat 14\'üncü 2010, 3:25:50 pm'], - ['ddd, hA', 'Paz, 3PM'], - ['M Mo MM MMMM MMM', '2 2\'nci 02 Şubat Şub'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14\'üncü 14'], - ['d do dddd ddd dd', '0 0\'ıncı Pazar Paz Pz'], - ['DDD DDDo DDDD', '45 45\'inci 045'], - ['w wo ww', '7 7\'nci 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[yılın] DDDo [günü]', 'yılın 45\'inci günü'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 Şubat 2010'], - ['LLL', '14 Şubat 2010 15:25'], - ['LLLL', 'Pazar, 14 Şubat 2010 15:25'], - ['l', '14.2.2010'], - ['ll', '14 Şub 2010'], - ['lll', '14 Şub 2010 15:25'], - ['llll', 'Paz, 14 Şub 2010 15:25'] - ], - DDDo = [ - [359, '360\'ıncı'], - [199, '200\'üncü'], - [149, '150\'nci'] - ], - dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - DDDoDt, - i; - - for (i = 0; i < a.length; i++) { - assert.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - for (i = 0; i < DDDo.length; i++) { - DDDoDt = moment([2010]); - assert.equal(DDDoDt.add(DDDo[i][0], 'days').format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1\'inci', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2\'nci', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3\'üncü', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4\'üncü', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5\'inci', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6\'ncı', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7\'nci', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8\'inci', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9\'uncu', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10\'uncu', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11\'inci', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12\'nci', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13\'üncü', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14\'üncü', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15\'inci', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16\'ncı', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17\'nci', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18\'inci', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19\'uncu', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20\'nci', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21\'inci', '21th'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22\'nci', '22th'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23\'üncü', '23th'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24\'üncü', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25\'inci', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26\'ncı', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27\'nci', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28\'inci', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29\'uncu', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30\'uncu', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31\'inci', '31st'); - }); - - test('format month', function (assert) { - var expected = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Pazar Paz Pz_Pazartesi Pts Pt_Salı Sal Sa_Çarşamba Çar Ça_Perşembe Per Pe_Cuma Cum Cu_Cumartesi Cts Ct'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'birkaç saniye', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'bir dakika', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'bir dakika', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 dakika', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 dakika', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'bir saat', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'bir saat', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 saat', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 saat', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 saat', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'bir gün', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'bir gün', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 gün', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'bir gün', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 gün', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 gün', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'bir ay', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'bir ay', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'bir ay', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ay', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ay', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ay', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'bir ay', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ay', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'bir yıl', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 yıl', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'bir yıl', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 yıl', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'birkaç saniye sonra', 'prefix'); - assert.equal(moment(0).from(30000), 'birkaç saniye önce', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'birkaç saniye önce', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'birkaç saniye sonra', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 gün sonra', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'bugün saat 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'bugün saat 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'bugün saat 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'yarın saat 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'bugün saat 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'dün 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[haftaya] dddd [saat] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[haftaya] dddd [saat] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[haftaya] dddd [saat] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[geçen hafta] dddd [saat] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[geçen hafta] dddd [saat] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[geçen hafta] dddd [saat] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1\'inci', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1\'inci', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2\'nci', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2\'nci', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3\'üncü', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('tzl'); - - test('parse', function (assert) { - var tests = 'Januar Jan_Fevraglh Fev_Març Mar_Avrïu Avr_Mai Mai_Gün Gün_Julia Jul_Guscht Gus_Setemvar Set_Listopäts Lis_Noemvar Noe_Zecemvar Zec'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h.mm.ss a', 'Súladi, Fevraglh 14. 2010, 3.25.50 d\'o'], - ['ddd, hA', 'Súl, 3D\'O'], - ['M Mo MM MMMM MMM', '2 2. 02 Fevraglh Fev'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14. 14'], - ['d do dddd ddd dd', '0 0. Súladi Súl Sú'], - ['DDD DDDo DDDD', '45 45. 045'], - ['w wo ww', '6 6. 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'd\'o D\'O'], - ['[the] DDDo [day of the year]', 'the 45. day of the year'], - ['LTS', '15.25.50'], - ['L', '14.02.2010'], - ['LL', '14. Fevraglh dallas 2010'], - ['LLL', '14. Fevraglh dallas 2010 15.25'], - ['LLLL', 'Súladi, li 14. Fevraglh dallas 2010 15.25'], - ['l', '14.2.2010'], - ['ll', '14. Fev dallas 2010'], - ['lll', '14. Fev dallas 2010 15.25'], - ['llll', 'Súl, li 14. Fev dallas 2010 15.25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); - }); - - test('format month', function (assert) { - var expected = 'Januar Jan_Fevraglh Fev_Març Mar_Avrïu Avr_Mai Mai_Gün Gün_Julia Jul_Guscht Gus_Setemvar Set_Listopäts Lis_Noemvar Noe_Zecemvar Zec'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Súladi Súl Sú_Lúneçi Lún Lú_Maitzi Mai Ma_Márcuri Már Má_Xhúadi Xhú Xh_Viénerçi Vié Vi_Sáturi Sát Sá'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'viensas secunds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '\'n míut', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '\'n míut', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 míuts', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 míuts', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '\'n þora', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '\'n þora', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 þoras', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 þoras', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 þoras', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '\'n ziua', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '\'n ziua', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ziuas', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '\'n ziua', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ziuas', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ziuas', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '\'n mes', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '\'n mes', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '\'n mes', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 mesen', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 mesen', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 mesen', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '\'n mes', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 mesen', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '\'n ar', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ars', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '\'n ar', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ars', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'osprei viensas secunds', 'prefix'); - assert.equal(moment(0).from(30000), 'ja\'iensas secunds', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ja\'iensas secunds', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'osprei viensas secunds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'osprei 5 ziuas', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'oxhi à 12.00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'oxhi à 12.25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'oxhi à 13.00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'demà à 12.00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'oxhi à 11.00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieiri à 12.00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [à] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[sür el] dddd [lasteu à] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - // Monday is the first day of the week. - // The week that contains Jan 4th is the first week of the year. - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1.', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2.', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2.', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('tzm-latn'); - - test('parse', function (assert) { - var tests = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'asamas, brˤayrˤ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'asamas, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 brˤayrˤ brˤayrˤ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 asamas asamas asamas'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 brˤayrˤ 2010'], - ['LLL', '14 brˤayrˤ 2010 15:25'], - ['LLLL', 'asamas 14 brˤayrˤ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 brˤayrˤ 2010'], - ['lll', '14 brˤayrˤ 2010 15:25'], - ['llll', 'asamas 14 brˤayrˤ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'asamas asamas asamas_aynas aynas aynas_asinas asinas asinas_akras akras akras_akwas akwas akwas_asimwas asimwas asimwas_asiḍyas asiḍyas asiḍyas'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'imik', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'minuḍ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'minuḍ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minuḍ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 minuḍ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'saɛa', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'saɛa', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 tassaɛin', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 tassaɛin', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 tassaɛin', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ass', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ass', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ossan', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ass', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ossan', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ossan', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ayowr', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ayowr', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ayowr', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 iyyirn', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 iyyirn', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 iyyirn', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ayowr', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 iyyirn', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'asgas', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 isgasn', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'asgas', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 isgasn', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'dadkh s yan imik', 'prefix'); - assert.equal(moment(0).from(30000), 'yan imik', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'yan imik', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'dadkh s yan imik', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'dadkh s yan 5 ossan', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'asdkh g 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'asdkh g 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'asdkh g 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'aska g 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'asdkh g 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'assant g 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [g] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('tzm'); - - test('parse', function (assert) { - var tests = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'ⴰⵙⴰⵎⴰⵙ, ⴱⵕⴰⵢⵕ 14 2010, 3:25:50 pm'], - ['ddd, hA', 'ⴰⵙⴰⵎⴰⵙ, 3PM'], - ['M Mo MM MMMM MMM', '2 2 02 ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '8 8 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45 day of the year'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 ⴱⵕⴰⵢⵕ 2010'], - ['LLL', '14 ⴱⵕⴰⵢⵕ 2010 15:25'], - ['LLLL', 'ⴰⵙⴰⵎⴰⵙ 14 ⴱⵕⴰⵢⵕ 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 ⴱⵕⴰⵢⵕ 2010'], - ['lll', '14 ⴱⵕⴰⵢⵕ 2010 15:25'], - ['llll', 'ⴰⵙⴰⵎⴰⵙ 14 ⴱⵕⴰⵢⵕ 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ ⴰⵢⵏⴰⵙ ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ ⴰⵙⵉⵏⴰⵙ ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ ⴰⴽⵔⴰⵙ ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ ⴰⴽⵡⴰⵙ ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ ⴰⵙⵉⵎⵡⴰⵙ ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ ⴰⵙⵉⴹⵢⴰⵙ ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'ⵉⵎⵉⴽ', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'ⵎⵉⵏⵓⴺ', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'ⵎⵉⵏⵓⴺ', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 ⵎⵉⵏⵓⴺ', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 ⵎⵉⵏⵓⴺ', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'ⵙⴰⵄⴰ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'ⵙⴰⵄⴰ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ⵜⴰⵙⵙⴰⵄⵉⵏ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ⵜⴰⵙⵙⴰⵄⵉⵏ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 ⵜⴰⵙⵙⴰⵄⵉⵏ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'ⴰⵙⵙ', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'ⴰⵙⵙ', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 oⵙⵙⴰⵏ', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'ⴰⵙⵙ', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 oⵙⵙⴰⵏ', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 oⵙⵙⴰⵏ', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'ⴰⵢoⵓⵔ', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'ⴰⵢoⵓⵔ', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'ⴰⵢoⵓⵔ', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ⵉⵢⵢⵉⵔⵏ', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ⵉⵢⵢⵉⵔⵏ', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ⵉⵢⵢⵉⵔⵏ', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'ⴰⵢoⵓⵔ', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ⵉⵢⵢⵉⵔⵏ', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'ⴰⵙⴳⴰⵙ', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ⵉⵙⴳⴰⵙⵏ', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'ⴰⵙⴳⴰⵙ', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ⵉⵙⴳⴰⵙⵏ', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ', 'prefix'); - assert.equal(moment(0).from(30000), 'ⵢⴰⵏ ⵉⵎⵉⴽ', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'ⵢⴰⵏ ⵉⵎⵉⴽ', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ 5 oⵙⵙⴰⵏ', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'ⴰⵙⴷⵅ ⴴ 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'ⴰⵙⴷⵅ ⴴ 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'ⴰⵙⴷⵅ ⴴ 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'ⴰⵙⴽⴰ ⴴ 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'ⴰⵙⴷⵅ ⴴ 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'ⴰⵚⴰⵏⵜ ⴴ 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [ⴴ] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ⴴ] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ⴴ] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [ⴴ] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [ⴴ] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [ⴴ] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).format('w ww wo'), '2 02 2', 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '3 03 3', 'Jan 14 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('uk'); - - test('parse', function (assert) { - var tests = 'січень січ_лютий лют_березень бер_квітень квіт_травень трав_червень черв_липень лип_серпень серп_вересень вер_жовтень жовт_листопад лист_грудень груд'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do MMMM YYYY, HH:mm:ss', 'неділя, 14-го лютого 2010, 15:25:50'], - ['ddd, h A', 'нд, 3 дня'], - ['M Mo MM MMMM MMM', '2 2-й 02 лютий лют'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14-го 14'], - ['d do dddd ddd dd', '0 0-й неділя нд нд'], - ['DDD DDDo DDDD', '45 45-й 045'], - ['w wo ww', '7 7-й 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'дня дня'], - ['DDDo [день року]', '45-й день року'], - ['LTS', '15:25:50'], - ['L', '14.02.2010'], - ['LL', '14 лютого 2010 р.'], - ['LLL', '14 лютого 2010 р., 15:25'], - ['LLLL', 'неділя, 14 лютого 2010 р., 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format meridiem', function (assert) { - assert.equal(moment([2012, 11, 28, 0, 0]).format('A'), 'ночі', 'night'); - assert.equal(moment([2012, 11, 28, 3, 59]).format('A'), 'ночі', 'night'); - assert.equal(moment([2012, 11, 28, 4, 0]).format('A'), 'ранку', 'morning'); - assert.equal(moment([2012, 11, 28, 11, 59]).format('A'), 'ранку', 'morning'); - assert.equal(moment([2012, 11, 28, 12, 0]).format('A'), 'дня', 'afternoon'); - assert.equal(moment([2012, 11, 28, 16, 59]).format('A'), 'дня', 'afternoon'); - assert.equal(moment([2012, 11, 28, 17, 0]).format('A'), 'вечора', 'evening'); - assert.equal(moment([2012, 11, 28, 23, 59]).format('A'), 'вечора', 'evening'); - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1-й', '1-й'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2-й', '2-й'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3-й', '3-й'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4-й', '4-й'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5-й', '5-й'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6-й', '6-й'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7-й', '7-й'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8-й', '8-й'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9-й', '9-й'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10-й', '10-й'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11-й', '11-й'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12-й', '12-й'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13-й', '13-й'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14-й', '14-й'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15-й', '15-й'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16-й', '16-й'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17-й', '17-й'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18-й', '18-й'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19-й', '19-й'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20-й', '20-й'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21-й', '21-й'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22-й', '22-й'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23-й', '23-й'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24-й', '24-й'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25-й', '25-й'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26-й', '26-й'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27-й', '27-й'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28-й', '28-й'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29-й', '29-й'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30-й', '30-й'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31-й', '31-й'); - }); - - test('format month', function (assert) { - var expected = 'січень січ_лютий лют_березень бер_квітень квіт_травень трав_червень черв_липень лип_серпень серп_вересень вер_жовтень жовт_листопад лист_грудень груд'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format month case', function (assert) { - var months = { - 'nominative': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_'), - 'accusative': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_') - }, i; - for (i = 0; i < 12; i++) { - assert.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]); - assert.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]); - } - }); - - test('format week', function (assert) { - var expected = 'неділя нд нд_понеділок пн пн_вівторок вт вт_середа ср ср_четвер чт чт_п’ятниця пт пт_субота сб сб'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'декілька секунд', '44 seconds = seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'хвилина', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'хвилина', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 хвилини', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 хвилини', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'годину', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'годину', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 години', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 годин', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 година', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'день', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'день', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 дні', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'день', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 днів', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 11}), true), '11 днів', '11 days = 11 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), '21 день', '21 days = 21 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 днів', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'місяць', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'місяць', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'місяць', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 місяці', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 місяці', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 місяці', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'місяць', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 місяців', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'рік', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 роки', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'рік', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 років', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'за декілька секунд', 'prefix'); - assert.equal(moment(0).from(30000), 'декілька секунд тому', 'suffix'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'за декілька секунд', 'in seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'за 5 днів', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Сьогодні о 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Сьогодні о 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Сьогодні о 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Завтра о 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 2}).calendar(), 'Сьогодні о 10:00', 'Now minus 2 hours'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Вчора о 12:00', 'yesterday at the same time'); - // A special case for Ukrainian since 11 hours have different preposition - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Сьогодні об 11:00', 'same day at 11 o\'clock'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[У] dddd [о' + (m.hours() === 11 ? 'б' : '') + '] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[У] dddd [о] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[У] dddd [о] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - function makeFormat(d) { - switch (d.day()) { - case 0: - case 3: - case 5: - case 6: - return '[Минулої] dddd [о' + (d.hours() === 11 ? 'б' : '') + '] LT'; - case 1: - case 2: - case 4: - return '[Минулого] dddd [о' + (d.hours() === 11 ? 'б' : '') + '] LT'; - } - } - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-й', 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-й', 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2-й', 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2-й', 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3-й', 'Jan 9 2012 should be week 3'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('uz'); - - test('parse', function (assert) { - var tests = 'январ янв_феврал фев_март мар_апрел апр_май май_июн июн_июл июл_август авг_сентябр сен_октябр окт_ноябр ноя_декабр дек'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, Do-MMMM YYYY, h:mm:ss', 'Якшанба, 14-феврал 2010, 3:25:50'], - ['ddd, h:mm', 'Якш, 3:25'], - ['M Mo MM MMMM MMM', '2 2 02 феврал фев'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 Якшанба Якш Як'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '7 7 07'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[йилнинг] DDDo-[куни]', 'йилнинг 45-куни'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 феврал 2010'], - ['LLL', '14 феврал 2010 15:25'], - ['LLLL', '14 феврал 2010, Якшанба 15:25'], - ['l', '14/2/2010'], - ['ll', '14 фев 2010'], - ['lll', '14 фев 2010 15:25'], - ['llll', '14 фев 2010, Якш 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var expected = 'январ янв_феврал фев_март мар_апрел апр_май май_июн июн_июл июл_август авг_сентябр сен_октябр окт_ноябр ноя_декабр дек'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'Якшанба Якш Як_Душанба Душ Ду_Сешанба Сеш Се_Чоршанба Чор Чо_Пайшанба Пай Па_Жума Жум Жу_Шанба Шан Ша'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'фурсат', '44 секунд = фурсат'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'бир дакика', '45 секунд = бир дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'бир дакика', '89 секунд = бир дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 дакика', '90 секунд = 2 дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 дакика', '44 дакика = 44 дакика'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'бир соат', '45 минут = бир соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'бир соат', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 соат', '90 минут = 2 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 соат', '5 соат = 5 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 соат', '21 соат = 21 соат'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'бир кун', '22 соат = бир кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'бир кун', '35 соат = бир кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 кун', '36 соат = 2 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'бир кун', '1 кун = 1 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 кун', '5 кун = 5 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 кун', '25 кун = 25 кун'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'бир ой', '26 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'бир ой', '30 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'бир ой', '45 кун = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 ой', '46 кун = 2 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 ой', '75 кун = 2 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 ой', '76 кун = 3 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'бир ой', 'бир ой = бир ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 ой', '5 ой = 5 ой'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'бир йил', '345 кун = бир йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 йил', '548 кун = 2 йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'бир йил', '1 йил = бир йил'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 йил', '5 йил = 5 йил'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'Якин фурсат ичида', 'prefix'); - assert.equal(moment(0).from(30000), 'Бир неча фурсат олдин', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'Бир неча фурсат олдин', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'Якин фурсат ичида', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'Якин 5 кун ичида', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Бугун соат 12:00 да', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Бугун соат 12:25 да', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Бугун соат 13:00 да', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Эртага 12:00 да', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Бугун соат 11:00 да', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Кеча соат 12:00 да', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [куни соат] LT [да]'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [куни соат] LT [да]'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [куни соат] LT [да]'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[Утган] dddd [куни соат] LT [да]'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[Утган] dddd [куни соат] LT [да]'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[Утган] dddd [куни соат] LT [да]'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('vi'); - - test('parse', function (assert) { - var i, - tests = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split('_'); - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + i); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(','); - equalTest(tests[i][0], '[tháng] M', i); - equalTest(tests[i][1], '[Th]M', i); - equalTest(tests[i][0], '[tháng] MM', i); - equalTest(tests[i][1], '[Th]MM', i); - equalTest(tests[i][0].toLocaleLowerCase(), '[THÁNG] M', i); - equalTest(tests[i][1].toLocaleLowerCase(), '[TH]M', i); - equalTest(tests[i][0].toLocaleUpperCase(), '[THÁNG] MM', i); - equalTest(tests[i][1].toLocaleUpperCase(), '[TH]MM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'chủ nhật, tháng 2 14 2010, 3:25:50 ch'], - ['ddd, hA', 'CN, 3CH'], - ['M Mo MM MMMM MMM', '2 2 02 tháng 2 Th02'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14 14'], - ['d do dddd ddd dd', '0 0 chủ nhật CN CN'], - ['DDD DDDo DDDD', '45 45 045'], - ['w wo ww', '6 6 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'ch CH'], - ['[ngày thứ] DDDo [của năm]', 'ngày thứ 45 của năm'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 tháng 2 năm 2010'], - ['LLL', '14 tháng 2 năm 2010 15:25'], - ['LLLL', 'chủ nhật, 14 tháng 2 năm 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Th02 2010'], - ['lll', '14 Th02 2010 15:25'], - ['llll', 'CN, 14 Th02 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8', '8'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9', '9'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10', '10'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11', '11'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12', '12'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13', '13'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14', '14'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24', '24'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31'); - }); - - test('format month', function (assert) { - var i, - expected = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM,MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var i, - expected = 'chủ nhật CN CN_thứ hai T2 T2_thứ ba T3 T3_thứ tư T4 T4_thứ năm T5 T5_thứ sáu T6 T6_thứ bảy T7 T7'.split('_'); - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'vài giây', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'một phút', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'một phút', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 phút', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 phút', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'một giờ', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'một giờ', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 giờ', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 giờ', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 giờ', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'một ngày', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'một ngày', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 ngày', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'một ngày', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 ngày', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 ngày', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'một tháng', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'một tháng', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'một tháng', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 tháng', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 tháng', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 tháng', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'một tháng', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 tháng', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'một năm', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 năm', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'một năm', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 năm', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'vài giây tới', 'prefix'); - assert.equal(moment(0).from(30000), 'vài giây trước', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'vài giây trước', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'vài giây tới', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 ngày tới', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Hôm nay lúc 12:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Hôm nay lúc 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Hôm nay lúc 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Ngày mai lúc 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Hôm nay lúc 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Hôm qua lúc 12:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [tuần tới lúc] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [tuần tới lúc] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [tuần tới lúc] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [tuần rồi lúc] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('x-pseudo'); - - test('parse', function (assert) { - var tests = 'J~áñúá~rý J~áñ_F~ébrú~árý ~Féb_~Márc~h ~Már_Áp~ríl ~Ápr_~Máý ~Máý_~Júñé~ ~Júñ_Júl~ý ~Júl_Áú~gúst~ ~Áúg_Sép~témb~ér ~Sép_Ó~ctób~ér ~Óct_Ñ~óvém~bér ~Ñóv_~Décé~mbér ~Déc'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'S~úñdá~ý, F~ébrú~árý 14th 2010, 3:25:50 pm'], - ['ddd, hA', 'S~úñ, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 F~ébrú~árý ~Féb'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th S~úñdá~ý S~úñ S~ú'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], - ['LT', '15:25'], - ['L', '14/02/2010'], - ['LL', '14 F~ébrú~árý 2010'], - ['LLL', '14 F~ébrú~árý 2010 15:25'], - ['LLLL', 'S~úñdá~ý, 14 F~ébrú~árý 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 ~Féb 2010'], - ['lll', '14 ~Féb 2010 15:25'], - ['llll', 'S~úñ, 14 ~Féb 2010 15:25'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format ordinal', function (assert) { - assert.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st'); - assert.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd'); - assert.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd'); - assert.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th'); - assert.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th'); - assert.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th'); - assert.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th'); - assert.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th'); - assert.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th'); - assert.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th'); - - assert.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th'); - assert.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th'); - assert.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th'); - assert.equal(moment([2011, 0, 14]).format('DDDo'), '14th', '14th'); - assert.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th'); - assert.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th'); - assert.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th'); - assert.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th'); - assert.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th'); - assert.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th'); - - assert.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st'); - assert.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd'); - assert.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd'); - assert.equal(moment([2011, 0, 24]).format('DDDo'), '24th', '24th'); - assert.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th'); - assert.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th'); - assert.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th'); - assert.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th'); - assert.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th'); - assert.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th'); - - assert.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st'); - }); - - test('format month', function (assert) { - var expected = 'J~áñúá~rý J~áñ_F~ébrú~árý ~Féb_~Márc~h ~Már_Áp~ríl ~Ápr_~Máý ~Máý_~Júñé~ ~Júñ_Júl~ý ~Júl_Áú~gúst~ ~Áúg_Sép~témb~ér ~Sép_Ó~ctób~ér ~Óct_Ñ~óvém~bér ~Ñóv_~Décé~mbér ~Déc'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = 'S~úñdá~ý S~úñ S~ú_Mó~ñdáý~ ~Móñ Mó~_Túé~sdáý~ ~Túé Tú_Wéd~ñésd~áý ~Wéd ~Wé_T~húrs~dáý ~Thú T~h_~Fríd~áý ~Frí Fr~_S~átúr~dáý ~Sát Sá'.split('_'), i; - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'á ~féw ~sécó~ñds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'á ~míñ~úté', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'á ~míñ~úté', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 m~íñú~tés', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 m~íñú~tés', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'á~ñ hó~úr', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'á~ñ hó~úr', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 h~óúrs', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 h~óúrs', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 h~óúrs', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'á ~dáý', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'á ~dáý', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 d~áýs', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'á ~dáý', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 d~áýs', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 d~áýs', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'á ~móñ~th', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'á ~móñ~th', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'á ~móñ~th', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 m~óñt~hs', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 m~óñt~hs', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 m~óñt~hs', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'á ~móñ~th', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 m~óñt~hs', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'á ~ýéár', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ý~éárs', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'á ~ýéár', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ý~éárs', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), 'í~ñ á ~féw ~sécó~ñds', 'prefix'); - assert.equal(moment(0).from(30000), 'á ~féw ~sécó~ñds á~gó', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), 'á ~féw ~sécó~ñds á~gó', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), 'í~ñ á ~féw ~sécó~ñds', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), 'í~ñ 5 d~áýs', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(2).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'T~ódá~ý át 02:00', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'T~ódá~ý át 02:25', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'T~ódá~ý át 03:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'T~ómó~rró~w át 02:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'T~ódá~ý át 01:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Ý~ést~érdá~ý át 02:00', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('dddd [át] LT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [át] LT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [át] LT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[L~ást] dddd [át] LT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[L~ást] dddd [át] LT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[L~ást] dddd [át] LT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', 'Jan 15 2012 should be week 2'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('zh-cn'); - - test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; - - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'], - ['ddd, Ah', '周日, 下午3'], - ['M Mo MM MMMM MMM', '2 2月 02 二月 2月'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14日 14'], - ['d do dddd ddd dd', '0 0日 星期日 周日 日'], - ['DDD DDDo DDDD', '45 45日 045'], - ['w wo ww', '6 6周 06'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', '下午 下午'], - ['[这年的第] DDDo', '这年的第 45日'], - ['LTS', '下午3点25分50秒'], - ['L', '2010-02-14'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日下午3点25分'], - ['LLLL', '2010年2月14日星期日下午3点25分'], - ['l', '2010-02-14'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日下午3点25分'], - ['llll', '2010年2月14日星期日下午3点25分'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = '星期日 周日 日_星期一 周一 一_星期二 周二 二_星期三 周三 三_星期四 周四 四_星期五 周五 五_星期六 周六 六'.split('_'), i; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '几秒', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1 分钟', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1 分钟', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 分钟', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 分钟', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '1 小时', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1 小时', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 小时', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 小时', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 小时', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1 天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1 天', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 天', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1 天', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 天', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 天', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '1 个月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1 个月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1 个月', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 个月', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 个月', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 个月', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '1 个月', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 个月', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '1 年', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 年', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '1 年', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 年', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), '几秒内', 'prefix'); - assert.equal(moment(0).from(30000), '几秒前', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), '几秒前', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), '几秒内', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5 天内', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), '今天中午12点整', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), '今天中午12点25分', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), '今天下午1点整', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), '明天中午12点整', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), '今天上午11点整', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), '昨天中午12点整', 'yesterday at the same time'); - }); - - test('calendar current week', function (assert) { - var i, m, - today = moment().startOf('day'); - - for (i = 0; i < 7; i++) { - m = moment().startOf('week').add({d: i}); - if (Math.abs(m.diff(today, 'days')) <= 1) { - continue; // skip today, yesterday, tomorrow - } - assert.equal(m.calendar(), m.format('[本]ddd凌晨12点整'), 'Monday + ' + i + ' days current time'); - } - }); - - test('calendar next week', function (assert) { - var i, m, - today = moment().startOf('day'); - - for (i = 7; i < 14; i++) { - m = moment().startOf('week').add({d: i}); - if (Math.abs(m.diff(today, 'days')) >= 7) { - continue; - } - if (Math.abs(m.diff(today, 'days')) <= 1) { - continue; // skip today, yesterday, tomorrow - } - assert.equal(m.calendar(), m.format('[下]ddd凌晨12点整'), 'Today + ' + i + ' days beginning of day'); - } - assert.equal(42, 42, 'at least one assert'); - }); - - test('calendar last week', function (assert) { - var i, m, - today = moment().startOf('day'); - - for (i = 1; i < 8; i++) { - m = moment().startOf('week').subtract({d: i}); - if ((Math.abs(m.diff(today, 'days')) >= 7) || (Math.abs(m.diff(today, 'days')) <= 1)) { - continue; - } - assert.equal(m.calendar(), m.format('[上]ddd凌晨12点整'), 'Monday - ' + i + ' days next week'); - } - assert.equal(42, 42, 'at least one assert'); - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('LL'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('LL'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('LL'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('LL'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '凌晨', 'before dawn'); - assert.equal(moment([2011, 2, 23, 6, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52周', 'Jan 1 2012 应该是第52周'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1周', 'Jan 7 2012 应该是第 1周'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2周', 'Jan 14 2012 应该是第 2周'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - localeModule('zh-tw'); - - test('parse', function (assert) { - var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; - function equalTest(input, mmm, i) { - assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); - } - for (i = 0; i < 12; i++) { - tests[i] = tests[i].split(' '); - equalTest(tests[i][0], 'MMM', i); - equalTest(tests[i][1], 'MMM', i); - equalTest(tests[i][0], 'MMMM', i); - equalTest(tests[i][1], 'MMMM', i); - equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i); - equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i); - equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i); - } - }); - - test('format', function (assert) { - var a = [ - ['dddd, MMMM Do YYYY, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'], - ['ddd, Ah', '週日, 下午3'], - ['M Mo MM MMMM MMM', '2 2月 02 二月 2月'], - ['YYYY YY', '2010 10'], - ['D Do DD', '14 14日 14'], - ['d do dddd ddd dd', '0 0日 星期日 週日 日'], - ['DDD DDDo DDDD', '45 45日 045'], - ['w wo ww', '8 8週 08'], - ['h hh', '3 03'], - ['H HH', '15 15'], - ['m mm', '25 25'], - ['s ss', '50 50'], - ['a A', '下午 下午'], - ['[這年的第] DDDo', '這年的第 45日'], - ['LTS', '下午3點25分50秒'], - ['L', '2010年2月14日'], - ['LL', '2010年2月14日'], - ['LLL', '2010年2月14日下午3點25分'], - ['LLLL', '2010年2月14日星期日下午3點25分'], - ['l', '2010年2月14日'], - ['ll', '2010年2月14日'], - ['lll', '2010年2月14日下午3點25分'], - ['llll', '2010年2月14日星期日下午3點25分'] - ], - b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), - i; - - for (i = 0; i < a.length; i++) { - assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('format month', function (assert) { - var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split('_'), i; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); - } - }); - - test('format week', function (assert) { - var expected = '星期日 週日 日_星期一 週一 一_星期二 週二 二_星期三 週三 三_星期四 週四 四_星期五 週五 五_星期六 週六 六'.split('_'), i; - - for (i = 0; i < expected.length; i++) { - assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); - } - }); - - test('from', function (assert) { - var start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), '幾秒', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), '1分鐘', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), '1分鐘', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2分鐘', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44分鐘', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), '1小時', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), '1小時', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2小時', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5小時', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21小時', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), '1天', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), '1天', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2天', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), '1天', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5天', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25天', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), '1個月', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), '1個月', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), '1個月', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2個月', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2個月', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3個月', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), '1個月', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5個月', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), '1年', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2年', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), '1年', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5年', '5 years = 5 years'); - }); - - test('suffix', function (assert) { - assert.equal(moment(30000).from(0), '幾秒內', 'prefix'); - assert.equal(moment(0).from(30000), '幾秒前', 'suffix'); - }); - - test('now from now', function (assert) { - assert.equal(moment().fromNow(), '幾秒前', 'now from now should display as in the past'); - }); - - test('fromNow', function (assert) { - assert.equal(moment().add({s: 30}).fromNow(), '幾秒內', 'in a few seconds'); - assert.equal(moment().add({d: 5}).fromNow(), '5天內', 'in 5 days'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), '今天中午12點00分', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), '今天中午12點25分', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), '今天下午1點00分', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), '明天中午12點00分', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), '今天上午11點00分', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), '昨天中午12點00分', 'yesterday at the same time'); - }); - - test('calendar next week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().add({d: i}); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[下]ddddLT'), 'Today + ' + i + ' days end of day'); - } - }); - - test('calendar last week', function (assert) { - var i, m; - for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days current time'); - m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days beginning of day'); - m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[上]ddddLT'), 'Today - ' + i + ' days end of day'); - } - }); - - test('calendar all else', function (assert) { - var weeksAgo = moment().subtract({w: 1}), - weeksFromNow = moment().add({w: 1}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); - - weeksAgo = moment().subtract({w: 2}); - weeksFromNow = moment().add({w: 2}); - - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); - }); - - test('meridiem', function (assert) { - assert.equal(moment([2011, 2, 23, 0, 0]).format('a'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('a'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('a'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('a'), '下午', 'after noon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('a'), '晚上', 'night'); - - assert.equal(moment([2011, 2, 23, 0, 0]).format('A'), '早上', 'morning'); - assert.equal(moment([2011, 2, 23, 9, 0]).format('A'), '上午', 'before noon'); - assert.equal(moment([2011, 2, 23, 12, 0]).format('A'), '中午', 'noon'); - assert.equal(moment([2011, 2, 23, 13, 0]).format('A'), '下午', 'afternoon'); - assert.equal(moment([2011, 2, 23, 18, 0]).format('A'), '晚上', 'night'); - }); - - test('weeks year starting sunday format', function (assert) { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1週', 'Jan 1 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1週', 'Jan 7 2012 應該是第 1週'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2週', 'Jan 8 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2週', 'Jan 14 2012 應該是第 2週'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3週', 'Jan 15 2012 應該是第 3週'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('add and subtract'); - - test('add short reverse args', function (assert) { - var a = moment(), b, c, d; - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add({ms: 50}).milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add({s: 1}).seconds(), 9, 'Add seconds'); - assert.equal(a.add({m: 1}).minutes(), 8, 'Add minutes'); - assert.equal(a.add({h: 1}).hours(), 7, 'Add hours'); - assert.equal(a.add({d: 1}).date(), 13, 'Add date'); - assert.equal(a.add({w: 1}).date(), 20, 'Add week'); - assert.equal(a.add({M: 1}).month(), 10, 'Add month'); - assert.equal(a.add({y: 1}).year(), 2012, 'Add year'); - assert.equal(a.add({Q: 1}).month(), 1, 'Add quarter'); - - b = moment([2010, 0, 31]).add({M: 1}); - c = moment([2010, 1, 28]).subtract({M: 1}); - d = moment([2010, 1, 28]).subtract({Q: 1}); - - assert.equal(b.month(), 1, 'add month, jan 31st to feb 28th'); - assert.equal(b.date(), 28, 'add month, jan 31st to feb 28th'); - assert.equal(c.month(), 0, 'subtract month, feb 28th to jan 28th'); - assert.equal(c.date(), 28, 'subtract month, feb 28th to jan 28th'); - assert.equal(d.month(), 10, 'subtract quarter, feb 28th 2010 to nov 28th 2009'); - assert.equal(d.date(), 28, 'subtract quarter, feb 28th 2010 to nov 28th 2009'); - assert.equal(d.year(), 2009, 'subtract quarter, feb 28th 2010 to nov 28th 2009'); - }); - - test('add long reverse args', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add({milliseconds: 50}).milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add({seconds: 1}).seconds(), 9, 'Add seconds'); - assert.equal(a.add({minutes: 1}).minutes(), 8, 'Add minutes'); - assert.equal(a.add({hours: 1}).hours(), 7, 'Add hours'); - assert.equal(a.add({days: 1}).date(), 13, 'Add date'); - assert.equal(a.add({weeks: 1}).date(), 20, 'Add week'); - assert.equal(a.add({months: 1}).month(), 10, 'Add month'); - assert.equal(a.add({years: 1}).year(), 2012, 'Add year'); - assert.equal(a.add({quarters: 1}).month(), 1, 'Add quarter'); - }); - - test('add long singular reverse args', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add({millisecond: 50}).milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add({second: 1}).seconds(), 9, 'Add seconds'); - assert.equal(a.add({minute: 1}).minutes(), 8, 'Add minutes'); - assert.equal(a.add({hour: 1}).hours(), 7, 'Add hours'); - assert.equal(a.add({day: 1}).date(), 13, 'Add date'); - assert.equal(a.add({week: 1}).date(), 20, 'Add week'); - assert.equal(a.add({month: 1}).month(), 10, 'Add month'); - assert.equal(a.add({year: 1}).year(), 2012, 'Add year'); - assert.equal(a.add({quarter: 1}).month(), 1, 'Add quarter'); - }); - - test('add string long reverse args', function (assert) { - var a = moment(), b; - - test.expectedDeprecations('moment().add(period, number)'); - - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - b = a.clone(); - - assert.equal(a.add('millisecond', 50).milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add('second', 1).seconds(), 9, 'Add seconds'); - assert.equal(a.add('minute', 1).minutes(), 8, 'Add minutes'); - assert.equal(a.add('hour', 1).hours(), 7, 'Add hours'); - assert.equal(a.add('day', 1).date(), 13, 'Add date'); - assert.equal(a.add('week', 1).date(), 20, 'Add week'); - assert.equal(a.add('month', 1).month(), 10, 'Add month'); - assert.equal(a.add('year', 1).year(), 2012, 'Add year'); - assert.equal(b.add('day', '01').date(), 13, 'Add date'); - assert.equal(a.add('quarter', 1).month(), 1, 'Add quarter'); - }); - - test('add string long singular reverse args', function (assert) { - var a = moment(), b; - - test.expectedDeprecations('moment().add(period, number)'); - - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - b = a.clone(); - - assert.equal(a.add('milliseconds', 50).milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add('seconds', 1).seconds(), 9, 'Add seconds'); - assert.equal(a.add('minutes', 1).minutes(), 8, 'Add minutes'); - assert.equal(a.add('hours', 1).hours(), 7, 'Add hours'); - assert.equal(a.add('days', 1).date(), 13, 'Add date'); - assert.equal(a.add('weeks', 1).date(), 20, 'Add week'); - assert.equal(a.add('months', 1).month(), 10, 'Add month'); - assert.equal(a.add('years', 1).year(), 2012, 'Add year'); - assert.equal(b.add('days', '01').date(), 13, 'Add date'); - assert.equal(a.add('quarters', 1).month(), 1, 'Add quarter'); - }); - - test('add string short reverse args', function (assert) { - var a = moment(); - test.expectedDeprecations('moment().add(period, number)'); - - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add('ms', 50).milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add('s', 1).seconds(), 9, 'Add seconds'); - assert.equal(a.add('m', 1).minutes(), 8, 'Add minutes'); - assert.equal(a.add('h', 1).hours(), 7, 'Add hours'); - assert.equal(a.add('d', 1).date(), 13, 'Add date'); - assert.equal(a.add('w', 1).date(), 20, 'Add week'); - assert.equal(a.add('M', 1).month(), 10, 'Add month'); - assert.equal(a.add('y', 1).year(), 2012, 'Add year'); - assert.equal(a.add('Q', 1).month(), 1, 'Add quarter'); - }); - - test('add string long', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add(50, 'millisecond').milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add(1, 'second').seconds(), 9, 'Add seconds'); - assert.equal(a.add(1, 'minute').minutes(), 8, 'Add minutes'); - assert.equal(a.add(1, 'hour').hours(), 7, 'Add hours'); - assert.equal(a.add(1, 'day').date(), 13, 'Add date'); - assert.equal(a.add(1, 'week').date(), 20, 'Add week'); - assert.equal(a.add(1, 'month').month(), 10, 'Add month'); - assert.equal(a.add(1, 'year').year(), 2012, 'Add year'); - assert.equal(a.add(1, 'quarter').month(), 1, 'Add quarter'); - }); - - test('add string long singular', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add(50, 'milliseconds').milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add(1, 'seconds').seconds(), 9, 'Add seconds'); - assert.equal(a.add(1, 'minutes').minutes(), 8, 'Add minutes'); - assert.equal(a.add(1, 'hours').hours(), 7, 'Add hours'); - assert.equal(a.add(1, 'days').date(), 13, 'Add date'); - assert.equal(a.add(1, 'weeks').date(), 20, 'Add week'); - assert.equal(a.add(1, 'months').month(), 10, 'Add month'); - assert.equal(a.add(1, 'years').year(), 2012, 'Add year'); - assert.equal(a.add(1, 'quarters').month(), 1, 'Add quarter'); - }); - - test('add string short', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add(50, 'ms').milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add(1, 's').seconds(), 9, 'Add seconds'); - assert.equal(a.add(1, 'm').minutes(), 8, 'Add minutes'); - assert.equal(a.add(1, 'h').hours(), 7, 'Add hours'); - assert.equal(a.add(1, 'd').date(), 13, 'Add date'); - assert.equal(a.add(1, 'w').date(), 20, 'Add week'); - assert.equal(a.add(1, 'M').month(), 10, 'Add month'); - assert.equal(a.add(1, 'y').year(), 2012, 'Add year'); - assert.equal(a.add(1, 'Q').month(), 1, 'Add quarter'); - }); - - test('add strings string short reversed', function (assert) { - var a = moment(); - test.expectedDeprecations('moment().add(period, number)'); - - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add('ms', '50').milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add('s', '1').seconds(), 9, 'Add seconds'); - assert.equal(a.add('m', '1').minutes(), 8, 'Add minutes'); - assert.equal(a.add('h', '1').hours(), 7, 'Add hours'); - assert.equal(a.add('d', '1').date(), 13, 'Add date'); - assert.equal(a.add('w', '1').date(), 20, 'Add week'); - assert.equal(a.add('M', '1').month(), 10, 'Add month'); - assert.equal(a.add('y', '1').year(), 2012, 'Add year'); - assert.equal(a.add('Q', '1').month(), 1, 'Add quarter'); - }); - - test('subtract strings string short reversed', function (assert) { - var a = moment(); - test.expectedDeprecations('moment().subtract(period, number)'); - - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.subtract('ms', '50').milliseconds(), 450, 'Subtract milliseconds'); - assert.equal(a.subtract('s', '1').seconds(), 7, 'Subtract seconds'); - assert.equal(a.subtract('m', '1').minutes(), 6, 'Subtract minutes'); - assert.equal(a.subtract('h', '1').hours(), 5, 'Subtract hours'); - assert.equal(a.subtract('d', '1').date(), 11, 'Subtract date'); - assert.equal(a.subtract('w', '1').date(), 4, 'Subtract week'); - assert.equal(a.subtract('M', '1').month(), 8, 'Subtract month'); - assert.equal(a.subtract('y', '1').year(), 2010, 'Subtract year'); - assert.equal(a.subtract('Q', '1').month(), 5, 'Subtract quarter'); - }); - - test('add strings string short', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.add('50', 'ms').milliseconds(), 550, 'Add milliseconds'); - assert.equal(a.add('1', 's').seconds(), 9, 'Add seconds'); - assert.equal(a.add('1', 'm').minutes(), 8, 'Add minutes'); - assert.equal(a.add('1', 'h').hours(), 7, 'Add hours'); - assert.equal(a.add('1', 'd').date(), 13, 'Add date'); - assert.equal(a.add('1', 'w').date(), 20, 'Add week'); - assert.equal(a.add('1', 'M').month(), 10, 'Add month'); - assert.equal(a.add('1', 'y').year(), 2012, 'Add year'); - assert.equal(a.add('1', 'Q').month(), 1, 'Add quarter'); - }); - - test('subtract strings string short', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(500); - - assert.equal(a.subtract('50', 'ms').milliseconds(), 450, 'Subtract milliseconds'); - assert.equal(a.subtract('1', 's').seconds(), 7, 'Subtract seconds'); - assert.equal(a.subtract('1', 'm').minutes(), 6, 'Subtract minutes'); - assert.equal(a.subtract('1', 'h').hours(), 5, 'Subtract hours'); - assert.equal(a.subtract('1', 'd').date(), 11, 'Subtract date'); - assert.equal(a.subtract('1', 'w').date(), 4, 'Subtract week'); - assert.equal(a.subtract('1', 'M').month(), 8, 'Subtract month'); - assert.equal(a.subtract('1', 'y').year(), 2010, 'Subtract year'); - assert.equal(a.subtract('1', 'Q').month(), 5, 'Subtract quarter'); - }); - - test('add across DST', function (assert) { - // Detect Safari bug and bail. Hours on 13th March 2011 are shifted - // with 1 ahead. - if (new Date(2011, 2, 13, 5, 0, 0).getHours() !== 5) { - expect(0); - return; - } - - var a = moment(new Date(2011, 2, 12, 5, 0, 0)), - b = moment(new Date(2011, 2, 12, 5, 0, 0)), - c = moment(new Date(2011, 2, 12, 5, 0, 0)), - d = moment(new Date(2011, 2, 12, 5, 0, 0)), - e = moment(new Date(2011, 2, 12, 5, 0, 0)); - a.add(1, 'days'); - b.add(24, 'hours'); - c.add(1, 'months'); - e.add(1, 'quarter'); - - assert.equal(a.hours(), 5, 'adding days over DST difference should result in the same hour'); - if (b.isDST() && !d.isDST()) { - assert.equal(b.hours(), 6, 'adding hours over DST difference should result in a different hour'); - } else if (!b.isDST() && d.isDST()) { - assert.equal(b.hours(), 4, 'adding hours over DST difference should result in a different hour'); - } else { - assert.equal(b.hours(), 5, 'adding hours over DST difference should result in a same hour if the timezone does not have daylight savings time'); - } - assert.equal(c.hours(), 5, 'adding months over DST difference should result in the same hour'); - assert.equal(e.hours(), 5, 'adding quarters over DST difference should result in the same hour'); - }); - - test('add decimal values of days and months', function (assert) { - assert.equal(moment([2016,3,3]).add(1.5, 'days').date(), 5, 'adding 1.5 days is rounded to adding 2 day'); - assert.equal(moment([2016,3,3]).add(-1.5, 'days').date(), 1, 'adding -1.5 days is rounded to adding -2 day'); - assert.equal(moment([2016,3,1]).add(-1.5, 'days').date(), 30, 'adding -1.5 days on first of month wraps around'); - assert.equal(moment([2016,3,3]).add(1.5, 'months').month(), 5, 'adding 1.5 months adds 2 months'); - assert.equal(moment([2016,3,3]).add(-1.5, 'months').month(), 1, 'adding -1.5 months adds -2 months'); - assert.equal(moment([2016,0,3]).add(-1.5, 'months').month(), 10, 'adding -1.5 months at start of year wraps back'); - assert.equal(moment([2016,3,3]).subtract(1.5, 'days').date(),1, 'subtract 1.5 days is rounded to subtract 2 day'); - assert.equal(moment([2016,3,2]).subtract(1.5, 'days').date(), 31, 'subtract 1.5 days subtracts 2 days'); - assert.equal(moment([2016,1,1]).subtract(1.1, 'days').date(), 31, 'subtract 1.1 days wraps to previous month'); - assert.equal(moment([2016,3,3]).subtract(-1.5, 'days').date(), 5, 'subtract -1.5 days is rounded to subtract -2 day'); - assert.equal(moment([2016,3,30]).subtract(-1.5, 'days').date(), 2, 'subtract -1.5 days on last of month wraps around'); - assert.equal(moment([2016,3,3]).subtract(1.5, 'months').month(), 1, 'subtract 1.5 months subtract 2 months'); - assert.equal(moment([2016,3,3]).subtract(-1.5, 'months').month(), 5, 'subtract -1.5 months subtract -2 month'); - assert.equal(moment([2016,11,31]).subtract(-1.5, 'months').month(),1, 'subtract -1.5 months at end of year wraps back'); - assert.equal(moment([2016, 0,1]).add(1.5, 'years').format('YYYY-MM-DD'), '2017-07-01', 'add 1.5 years adds 1 year six months'); - assert.equal(moment([2016, 0,1]).add(1.6, 'years').format('YYYY-MM-DD'), '2017-08-01', 'add 1.6 years becomes 1.6*12 = 19.2, round, 19 months'); - assert.equal(moment([2016,0,1]).add(1.1, 'quarters').format('YYYY-MM-DD'), '2016-04-01', 'add 1.1 quarters 1.1*3=3.3, round, 3 months'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - // These tests are for locale independent features - // locale dependent tests would be in locale test folder - module('calendar'); - - test('passing a function', function (assert) { - var a = moment().hours(13).minutes(0).seconds(0); - assert.equal(moment(a).calendar(null, { - 'sameDay': function () { - return 'h:mmA'; - } - }), '1:00PM', 'should equate'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('create'); - - test('array', function (assert) { - assert.ok(moment([2010]).toDate() instanceof Date, '[2010]'); - assert.ok(moment([2010, 1]).toDate() instanceof Date, '[2010, 1]'); - assert.ok(moment([2010, 1, 12]).toDate() instanceof Date, '[2010, 1, 12]'); - assert.ok(moment([2010, 1, 12, 1]).toDate() instanceof Date, '[2010, 1, 12, 1]'); - assert.ok(moment([2010, 1, 12, 1, 1]).toDate() instanceof Date, '[2010, 1, 12, 1, 1]'); - assert.ok(moment([2010, 1, 12, 1, 1, 1]).toDate() instanceof Date, '[2010, 1, 12, 1, 1, 1]'); - assert.ok(moment([2010, 1, 12, 1, 1, 1, 1]).toDate() instanceof Date, '[2010, 1, 12, 1, 1, 1, 1]'); - assert.equal(+moment(new Date(2010, 1, 14, 15, 25, 50, 125)), +moment([2010, 1, 14, 15, 25, 50, 125]), 'constructing with array === constructing with new Date()'); - }); - - test('array with invalid arguments', function (assert) { - assert.ok(!moment([2010, null, null]).isValid(), '[2010, null, null]'); - assert.ok(!moment([1945, null, null]).isValid(), '[1945, null, null] (pre-1970)'); - }); - - test('array copying', function (assert) { - var importantArray = [2009, 11]; - moment(importantArray); - assert.deepEqual(importantArray, [2009, 11], 'initializer should not mutate the original array'); - }); - - test('object', function (assert) { - var fmt = 'YYYY-MM-DD HH:mm:ss.SSS', - tests = [ - [{year: 2010}, '2010-01-01 00:00:00.000'], - [{year: 2010, month: 1}, '2010-02-01 00:00:00.000'], - [{year: 2010, month: 1, day: 12}, '2010-02-12 00:00:00.000'], - [{year: 2010, month: 1, date: 12}, '2010-02-12 00:00:00.000'], - [{year: 2010, month: 1, day: 12, hours: 1}, '2010-02-12 01:00:00.000'], - [{year: 2010, month: 1, date: 12, hours: 1}, '2010-02-12 01:00:00.000'], - [{year: 2010, month: 1, day: 12, hours: 1, minutes: 1}, '2010-02-12 01:01:00.000'], - [{year: 2010, month: 1, date: 12, hours: 1, minutes: 1}, '2010-02-12 01:01:00.000'], - [{year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1}, '2010-02-12 01:01:01.000'], - [{year: 2010, month: 1, day: 12, hours: 1, minutes: 1, seconds: 1, milliseconds: 1}, '2010-02-12 01:01:01.001'], - [{years: 2010, months: 1, days: 14, hours: 15, minutes: 25, seconds: 50, milliseconds: 125}, '2010-02-14 15:25:50.125'], - [{year: 2010, month: 1, day: 14, hour: 15, minute: 25, second: 50, millisecond: 125}, '2010-02-14 15:25:50.125'], - [{y: 2010, M: 1, d: 14, h: 15, m: 25, s: 50, ms: 125}, '2010-02-14 15:25:50.125'] - ], i; - for (i = 0; i < tests.length; ++i) { - assert.equal(moment(tests[i][0]).format(fmt), tests[i][1]); - } - }); - - test('multi format array copying', function (assert) { - var importantArray = ['MM/DD/YYYY', 'YYYY-MM-DD', 'MM-DD-YYYY']; - moment('1999-02-13', importantArray); - assert.deepEqual(importantArray, ['MM/DD/YYYY', 'YYYY-MM-DD', 'MM-DD-YYYY'], 'initializer should not mutate the original array'); - }); - - test('number', function (assert) { - assert.ok(moment(1000).toDate() instanceof Date, '1000'); - assert.equal(moment(1000).valueOf(), 1000, 'asserting valueOf'); - assert.equal(moment.utc(1000).valueOf(), 1000, 'asserting valueOf'); - }); - - test('unix', function (assert) { - assert.equal(moment.unix(1).valueOf(), 1000, '1 unix timestamp == 1000 Date.valueOf'); - assert.equal(moment(1000).unix(), 1, '1000 Date.valueOf == 1 unix timestamp'); - assert.equal(moment.unix(1000).valueOf(), 1000000, '1000 unix timestamp == 1000000 Date.valueOf'); - assert.equal(moment(1500).unix(), 1, '1500 Date.valueOf == 1 unix timestamp'); - assert.equal(moment(1900).unix(), 1, '1900 Date.valueOf == 1 unix timestamp'); - assert.equal(moment(2100).unix(), 2, '2100 Date.valueOf == 2 unix timestamp'); - assert.equal(moment(1333129333524).unix(), 1333129333, '1333129333524 Date.valueOf == 1333129333 unix timestamp'); - assert.equal(moment(1333129333524000).unix(), 1333129333524, '1333129333524000 Date.valueOf == 1333129333524 unix timestamp'); - }); - - test('date', function (assert) { - assert.ok(moment(new Date()).toDate() instanceof Date, 'new Date()'); - }); - - test('date mutation', function (assert) { - var a = new Date(); - assert.ok(moment(a).toDate() !== a, 'the date moment uses should not be the date passed in'); - }); - - test('moment', function (assert) { - assert.ok(moment(moment()).toDate() instanceof Date, 'moment(moment())'); - assert.ok(moment(moment(moment())).toDate() instanceof Date, 'moment(moment(moment()))'); - }); - - test('cloning moment should only copy own properties', function (assert) { - assert.ok(!moment().clone().hasOwnProperty('month'), 'Should not clone prototype methods'); - }); - - test('cloning moment works with weird clones', function (assert) { - var extend = function (a, b) { - var i; - for (i in b) { - a[i] = b[i]; - } - return a; - }, - now = moment(), - nowu = moment.utc(); - - assert.equal(+extend({}, now).clone(), +now, 'cloning extend-ed now is now'); - assert.equal(+extend({}, nowu).clone(), +nowu, 'cloning extend-ed utc now is utc now'); - }); - - test('cloning respects moment.momentProperties', function (assert) { - var m = moment(); - - assert.equal(m.clone()._special, undefined, 'cloning ignores extra properties'); - m._special = 'bacon'; - moment.momentProperties.push('_special'); - assert.equal(m.clone()._special, 'bacon', 'cloning respects momentProperties'); - moment.momentProperties.pop(); - }); - - test('undefined', function (assert) { - assert.ok(moment().toDate() instanceof Date, 'undefined'); - }); - - test('iso with bad input', function (assert) { - assert.ok(!moment('a', moment.ISO_8601).isValid(), 'iso parsing with invalid string'); - assert.ok(!moment('a', moment.ISO_8601, true).isValid(), 'iso parsing with invalid string, strict'); - }); - - test('iso format 24hrs', function (assert) { - assert.equal(moment('2014-01-01T24:00:00.000').format('YYYY-MM-DD[T]HH:mm:ss.SSS'), - '2014-01-02T00:00:00.000', 'iso format with 24:00 localtime'); - assert.equal(moment.utc('2014-01-01T24:00:00.000').format('YYYY-MM-DD[T]HH:mm:ss.SSS'), - '2014-01-02T00:00:00.000', 'iso format with 24:00 utc'); - }); - - test('string without format - json', function (assert) { - assert.equal(moment('Date(1325132654000)').valueOf(), 1325132654000, 'Date(1325132654000)'); - assert.equal(moment('Date(-1325132654000)').valueOf(), -1325132654000, 'Date(-1325132654000)'); - assert.equal(moment('/Date(1325132654000)/').valueOf(), 1325132654000, '/Date(1325132654000)/'); - assert.equal(moment('/Date(1325132654000+0700)/').valueOf(), 1325132654000, '/Date(1325132654000+0700)/'); - assert.equal(moment('/Date(1325132654000-0700)/').valueOf(), 1325132654000, '/Date(1325132654000-0700)/'); - }); - - test('string with format dropped am/pm bug', function (assert) { - moment.locale('en'); - - assert.equal(moment('05/1/2012 12:25:00', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); - assert.equal(moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); - assert.equal(moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); - - assert.ok(moment('05/1/2012 12:25:00', 'MM/DD/YYYY h:m:s a').isValid()); - assert.ok(moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').isValid()); - assert.ok(moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').isValid()); - }); - - test('empty string with formats', function (assert) { - assert.equal(moment('', 'MM').format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); - assert.equal(moment(' ', 'MM').format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); - assert.equal(moment(' ', 'DD').format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); - assert.equal(moment(' ', ['MM', 'DD']).format('YYYY-MM-DD HH:mm:ss'), 'Invalid date'); - - assert.ok(!moment('', 'MM').isValid()); - assert.ok(!moment(' ', 'MM').isValid()); - assert.ok(!moment(' ', 'DD').isValid()); - assert.ok(!moment(' ', ['MM', 'DD']).isValid()); - }); - - test('defaulting to current date', function (assert) { - var now = moment(); - assert.equal(moment('12:13:14', 'hh:mm:ss').format('YYYY-MM-DD hh:mm:ss'), - now.clone().hour(12).minute(13).second(14).format('YYYY-MM-DD hh:mm:ss'), - 'given only time default to current date'); - assert.equal(moment('05', 'DD').format('YYYY-MM-DD'), - now.clone().date(5).format('YYYY-MM-DD'), - 'given day of month default to current month, year'); - assert.equal(moment('05', 'MM').format('YYYY-MM-DD'), - now.clone().month(4).date(1).format('YYYY-MM-DD'), - 'given month default to current year'); - assert.equal(moment('1996', 'YYYY').format('YYYY-MM-DD'), - now.clone().year(1996).month(0).date(1).format('YYYY-MM-DD'), - 'given year do not default'); - }); - - test('matching am/pm', function (assert) { - assert.equal(moment('2012-09-03T03:00PM', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly for PM'); - assert.equal(moment('2012-09-03T03:00P.M.', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly for P.M.'); - assert.equal(moment('2012-09-03T03:00P', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly for P'); - assert.equal(moment('2012-09-03T03:00pm', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly for pm'); - assert.equal(moment('2012-09-03T03:00p.m.', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly for p.m.'); - assert.equal(moment('2012-09-03T03:00p', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly for p'); - - assert.equal(moment('2012-09-03T03:00AM', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00AM', 'am/pm should parse correctly for AM'); - assert.equal(moment('2012-09-03T03:00A.M.', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00AM', 'am/pm should parse correctly for A.M.'); - assert.equal(moment('2012-09-03T03:00A', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00AM', 'am/pm should parse correctly for A'); - assert.equal(moment('2012-09-03T03:00am', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00AM', 'am/pm should parse correctly for am'); - assert.equal(moment('2012-09-03T03:00a.m.', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00AM', 'am/pm should parse correctly for a.m.'); - assert.equal(moment('2012-09-03T03:00a', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00AM', 'am/pm should parse correctly for a'); - - assert.equal(moment('5:00p.m.March 4 2012', 'h:mmAMMMM D YYYY').format('YYYY-MM-DDThh:mmA'), '2012-03-04T05:00PM', 'am/pm should parse correctly before month names'); - }); - - test('string with format', function (assert) { - moment.locale('en'); - var a = [ - ['YYYY-Q', '2014-4'], - ['MM-DD-YYYY', '12-02-1999'], - ['DD-MM-YYYY', '12-02-1999'], - ['DD/MM/YYYY', '12/02/1999'], - ['DD_MM_YYYY', '12_02_1999'], - ['DD:MM:YYYY', '12:02:1999'], - ['D-M-YY', '2-2-99'], - ['YY', '99'], - ['DDD-YYYY', '300-1999'], - ['DD-MM-YYYY h:m:s', '12-02-1999 2:45:10'], - ['DD-MM-YYYY h:m:s a', '12-02-1999 2:45:10 am'], - ['DD-MM-YYYY h:m:s a', '12-02-1999 2:45:10 pm'], - ['h:mm a', '12:00 pm'], - ['h:mm a', '12:30 pm'], - ['h:mm a', '12:00 am'], - ['h:mm a', '12:30 am'], - ['HH:mm', '12:00'], - ['YYYY-MM-DDTHH:mm:ss', '2011-11-11T11:11:11'], - ['MM-DD-YYYY [M]', '12-02-1999 M'], - ['ddd MMM DD HH:mm:ss YYYY', 'Tue Apr 07 22:52:51 2009'], - ['HH:mm:ss', '12:00:00'], - ['HH:mm:ss', '12:30:00'], - ['HH:mm:ss', '00:00:00'], - ['HH:mm:ss S', '00:30:00 1'], - ['HH:mm:ss SS', '00:30:00 12'], - ['HH:mm:ss SSS', '00:30:00 123'], - ['HH:mm:ss S', '00:30:00 7'], - ['HH:mm:ss SS', '00:30:00 78'], - ['HH:mm:ss SSS', '00:30:00 789'], - ['X', '1234567890'], - ['x', '1234567890123'], - ['LT', '12:30 AM'], - ['LTS', '12:30:29 AM'], - ['L', '09/02/1999'], - ['l', '9/2/1999'], - ['LL', 'September 2, 1999'], - ['ll', 'Sep 2, 1999'], - ['LLL', 'September 2, 1999 12:30 AM'], - ['lll', 'Sep 2, 1999 12:30 AM'], - ['LLLL', 'Thursday, September 2, 1999 12:30 AM'], - ['llll', 'Thu, Sep 2, 1999 12:30 AM'] - ], - m, - i; - - for (i = 0; i < a.length; i++) { - m = moment(a[i][1], a[i][0]); - assert.ok(m.isValid()); - assert.equal(m.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('2 digit year with YYYY format', function (assert) { - assert.equal(moment('9/2/99', 'D/M/YYYY').format('DD/MM/YYYY'), '09/02/1999', 'D/M/YYYY ---> 9/2/99'); - assert.equal(moment('9/2/1999', 'D/M/YYYY').format('DD/MM/YYYY'), '09/02/1999', 'D/M/YYYY ---> 9/2/1999'); - assert.equal(moment('9/2/68', 'D/M/YYYY').format('DD/MM/YYYY'), '09/02/2068', 'D/M/YYYY ---> 9/2/68'); - assert.equal(moment('9/2/69', 'D/M/YYYY').format('DD/MM/YYYY'), '09/02/1969', 'D/M/YYYY ---> 9/2/69'); - }); - - test('unix timestamp format', function (assert) { - var formats = ['X', 'X.S', 'X.SS', 'X.SSS'], i, format; - - for (i = 0; i < formats.length; i++) { - format = formats[i]; - assert.equal(moment('1234567890', format).valueOf(), 1234567890 * 1000, format + ' matches timestamp without milliseconds'); - assert.equal(moment('1234567890.1', format).valueOf(), 1234567890 * 1000 + 100, format + ' matches timestamp with deciseconds'); - assert.equal(moment('1234567890.12', format).valueOf(), 1234567890 * 1000 + 120, format + ' matches timestamp with centiseconds'); - assert.equal(moment('1234567890.123', format).valueOf(), 1234567890 * 1000 + 123, format + ' matches timestamp with milliseconds'); - } - }); - - test('unix offset milliseconds', function (assert) { - assert.equal(moment('1234567890123', 'x').valueOf(), 1234567890123, 'x matches unix offset in milliseconds'); - }); - - test('milliseconds format', function (assert) { - assert.equal(moment('1', 'S').get('ms'), 100, 'deciseconds'); - // assert.equal(moment('10', 'S', true).isValid(), false, 'deciseconds with two digits'); - // assert.equal(moment('1', 'SS', true).isValid(), false, 'centiseconds with one digits'); - assert.equal(moment('12', 'SS').get('ms'), 120, 'centiseconds'); - // assert.equal(moment('123', 'SS', true).isValid(), false, 'centiseconds with three digits'); - assert.equal(moment('123', 'SSS').get('ms'), 123, 'milliseconds'); - assert.equal(moment('1234', 'SSSS').get('ms'), 123, 'milliseconds with SSSS'); - assert.equal(moment('123456789101112', 'SSSS').get('ms'), 123, 'milliseconds with SSSS'); - }); - - test('string with format no separators', function (assert) { - moment.locale('en'); - var a = [ - ['MMDDYYYY', '12021999'], - ['DDMMYYYY', '12021999'], - ['YYYYMMDD', '19991202'], - ['DDMMMYYYY', '10Sep2001'] - ], i; - - for (i = 0; i < a.length; i++) { - assert.equal(moment(a[i][1], a[i][0]).format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); - } - }); - - test('string with format (timezone)', function (assert) { - assert.equal(moment('5 -0700', 'H ZZ').toDate().getUTCHours(), 12, 'parse hours \'5 -0700\' ---> \'H ZZ\''); - assert.equal(moment('5 -07:00', 'H Z').toDate().getUTCHours(), 12, 'parse hours \'5 -07:00\' ---> \'H Z\''); - assert.equal(moment('5 -0730', 'H ZZ').toDate().getUTCMinutes(), 30, 'parse hours \'5 -0730\' ---> \'H ZZ\''); - assert.equal(moment('5 -07:30', 'H Z').toDate().getUTCMinutes(), 30, 'parse hours \'5 -07:0\' ---> \'H Z\''); - assert.equal(moment('5 +0100', 'H ZZ').toDate().getUTCHours(), 4, 'parse hours \'5 +0100\' ---> \'H ZZ\''); - assert.equal(moment('5 +01:00', 'H Z').toDate().getUTCHours(), 4, 'parse hours \'5 +01:00\' ---> \'H Z\''); - assert.equal(moment('5 +0130', 'H ZZ').toDate().getUTCMinutes(), 30, 'parse hours \'5 +0130\' ---> \'H ZZ\''); - assert.equal(moment('5 +01:30', 'H Z').toDate().getUTCMinutes(), 30, 'parse hours \'5 +01:30\' ---> \'H Z\''); - }); - - test('string with format (timezone offset)', function (assert) { - var a, b, c, d, e, f; - a = new Date(Date.UTC(2011, 0, 1, 1)); - b = moment('2011 1 1 0 -01:00', 'YYYY MM DD HH Z'); - assert.equal(a.getHours(), b.hours(), 'date created with utc == parsed string with timezone offset'); - assert.equal(+a, +b, 'date created with utc == parsed string with timezone offset'); - c = moment('2011 2 1 10 -05:00', 'YYYY MM DD HH Z'); - d = moment('2011 2 1 8 -07:00', 'YYYY MM DD HH Z'); - assert.equal(c.hours(), d.hours(), '10 am central time == 8 am pacific time'); - e = moment.utc('Fri, 20 Jul 2012 17:15:00', 'ddd, DD MMM YYYY HH:mm:ss'); - f = moment.utc('Fri, 20 Jul 2012 10:15:00 -0700', 'ddd, DD MMM YYYY HH:mm:ss ZZ'); - assert.equal(e.hours(), f.hours(), 'parse timezone offset in utc'); - }); - - test('string with timezone around start of year', function (assert) { - assert.equal(moment('2000-01-01T00:00:00.000+01:00').toISOString(), '1999-12-31T23:00:00.000Z', '+1:00 around 2000'); - assert.equal(moment('2000-01-01T00:00:00.000-01:00').toISOString(), '2000-01-01T01:00:00.000Z', '-1:00 around 2000'); - assert.equal(moment('1970-01-01T00:00:00.000+01:00').toISOString(), '1969-12-31T23:00:00.000Z', '+1:00 around 1970'); - assert.equal(moment('1970-01-01T00:00:00.000-01:00').toISOString(), '1970-01-01T01:00:00.000Z', '-1:00 around 1970'); - assert.equal(moment('1200-01-01T00:00:00.000+01:00').toISOString(), '1199-12-31T23:00:00.000Z', '+1:00 around 1200'); - assert.equal(moment('1200-01-01T00:00:00.000-01:00').toISOString(), '1200-01-01T01:00:00.000Z', '-1:00 around 1200'); - }); - - test('string with array of formats', function (assert) { - assert.equal(moment('11-02-1999', ['MM-DD-YYYY', 'DD-MM-YYYY']).format('MM DD YYYY'), '11 02 1999', 'switching month and day'); - assert.equal(moment('02-11-1999', ['MM/DD/YYYY', 'YYYY MM DD', 'MM-DD-YYYY']).format('MM DD YYYY'), '02 11 1999', 'year last'); - assert.equal(moment('1999-02-11', ['MM/DD/YYYY', 'YYYY MM DD', 'MM-DD-YYYY']).format('MM DD YYYY'), '02 11 1999', 'year first'); - - assert.equal(moment('02-11-1999', ['MM/DD/YYYY', 'YYYY MM DD']).format('MM DD YYYY'), '02 11 1999', 'year last'); - assert.equal(moment('1999-02-11', ['MM/DD/YYYY', 'YYYY MM DD']).format('MM DD YYYY'), '02 11 1999', 'year first'); - assert.equal(moment('02-11-1999', ['YYYY MM DD', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 11 1999', 'year last'); - assert.equal(moment('1999-02-11', ['YYYY MM DD', 'MM/DD/YYYY']).format('MM DD YYYY'), '02 11 1999', 'year first'); - - assert.equal(moment('13-11-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '11 13 1999', 'second must be month'); - assert.equal(moment('11-13-1999', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '11 13 1999', 'first must be month'); - assert.equal(moment('01-02-2000', ['MM/DD/YYYY', 'DD/MM/YYYY']).format('MM DD YYYY'), '01 02 2000', 'either can be a month, month first format'); - assert.equal(moment('02-01-2000', ['DD/MM/YYYY', 'MM/DD/YYYY']).format('MM DD YYYY'), '01 02 2000', 'either can be a month, day first format'); - - assert.equal(moment('11-02-10', ['MM/DD/YY', 'YY MM DD', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'all unparsed substrings have influence on format penalty'); - assert.equal(moment('11-02-10', ['MM-DD-YY HH:mm', 'YY MM DD']).format('MM DD YYYY'), '02 10 2011', 'prefer formats without extra tokens'); - assert.equal(moment('11-02-10 junk', ['MM-DD-YY', 'YY.MM.DD junk']).format('MM DD YYYY'), '02 10 2011', 'prefer formats that dont result in extra characters'); - assert.equal(moment('11-22-10', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'), '10 22 2011', 'prefer valid results'); - - assert.equal(moment('gibberish', ['YY-MM-DD', 'YY-DD-MM']).format('MM DD YYYY'), 'Invalid date', 'doest throw for invalid strings'); - assert.equal(moment('gibberish', []).format('MM DD YYYY'), 'Invalid date', 'doest throw for an empty array'); - - //https://github.com/moment/moment/issues/1143 - assert.equal(moment( - 'System Administrator and Database Assistant (7/1/2011), System Administrator and Database Assistant (7/1/2011), Database Coordinator (7/1/2011), Vice President (7/1/2011), System Administrator and Database Assistant (5/31/2012), Database Coordinator (7/1/2012), System Administrator and Database Assistant (7/1/2013)', - ['MM/DD/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ']) - .format('YYYY-MM-DD'), '2011-07-01', 'Works for long strings'); - - assert.equal(moment('11-02-10', ['MM.DD.YY', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'escape RegExp special characters on comparing'); - - assert.equal(moment('13-10-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year'); - assert.equal(moment('13-10-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year'); - - assert.equal(moment('01', ['MM', 'DD'])._f, 'MM', 'Should use first valid format'); - }); - - test('string with array of formats + ISO', function (assert) { - assert.equal(moment('1994', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).year(), 1994, 'iso: assert parse YYYY'); - assert.equal(moment('17:15', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).hour(), 17, 'iso: assert parse HH:mm (1)'); - assert.equal(moment('17:15', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).minutes(), 15, 'iso: assert parse HH:mm (2)'); - assert.equal(moment('06', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).month(), 6 - 1, 'iso: assert parse MM'); - assert.equal(moment('2012-06-01', [moment.ISO_8601, 'MM', 'HH:mm', 'YYYY']).parsingFlags().iso, true, 'iso: assert parse iso'); - assert.equal(moment('2014-05-05', [moment.ISO_8601, 'YYYY-MM-DD']).parsingFlags().iso, true, 'iso: edge case array precedence iso'); - assert.equal(moment('2014-05-05', ['YYYY-MM-DD', moment.ISO_8601]).parsingFlags().iso, false, 'iso: edge case array precedence not iso'); - }); - - test('string with format - years', function (assert) { - assert.equal(moment('67', 'YY').format('YYYY'), '2067', '67 > 2067'); - assert.equal(moment('68', 'YY').format('YYYY'), '2068', '68 > 2068'); - assert.equal(moment('69', 'YY').format('YYYY'), '1969', '69 > 1969'); - assert.equal(moment('70', 'YY').format('YYYY'), '1970', '70 > 1970'); - }); - - test('implicit cloning', function (assert) { - var momentA = moment([2011, 10, 10]), - momentB = moment(momentA); - momentA.month(5); - assert.equal(momentB.month(), 10, 'Calling moment() on a moment will create a clone'); - assert.equal(momentA.month(), 5, 'Calling moment() on a moment will create a clone'); - }); - - test('explicit cloning', function (assert) { - var momentA = moment([2011, 10, 10]), - momentB = momentA.clone(); - momentA.month(5); - assert.equal(momentB.month(), 10, 'Calling moment() on a moment will create a clone'); - assert.equal(momentA.month(), 5, 'Calling moment() on a moment will create a clone'); - }); - - test('cloning carrying over utc mode', function (assert) { - assert.equal(moment().local().clone()._isUTC, false, 'An explicit cloned local moment should have _isUTC == false'); - assert.equal(moment().utc().clone()._isUTC, true, 'An cloned utc moment should have _isUTC == true'); - assert.equal(moment().clone()._isUTC, false, 'An explicit cloned local moment should have _isUTC == false'); - assert.equal(moment.utc().clone()._isUTC, true, 'An explicit cloned utc moment should have _isUTC == true'); - assert.equal(moment(moment().local())._isUTC, false, 'An implicit cloned local moment should have _isUTC == false'); - assert.equal(moment(moment().utc())._isUTC, true, 'An implicit cloned utc moment should have _isUTC == true'); - assert.equal(moment(moment())._isUTC, false, 'An implicit cloned local moment should have _isUTC == false'); - assert.equal(moment(moment.utc())._isUTC, true, 'An implicit cloned utc moment should have _isUTC == true'); - }); - - test('parsing iso', function (assert) { - var offset = moment([2011, 9, 8]).utcOffset(), - pad = function (input) { - if (input < 10) { - return '0' + input; - } - return '' + input; - }, - hourOffset = (offset > 0 ? Math.floor(offset / 60) : Math.ceil(offset / 60)), - minOffset = offset - (hourOffset * 60), - tz = (offset >= 0) ? - '+' + pad(hourOffset) + ':' + pad(minOffset) : - '-' + pad(-hourOffset) + ':' + pad(-minOffset), - tz2 = tz.replace(':', ''), - tz3 = tz2.slice(0, 3), - //Tz3 removes minutes digit so will break the tests when parsed if they all use the same minutes digit - minutesForTz3 = pad((4 + minOffset) % 60), - minute = pad(4 + minOffset), - - formats = [ - ['2011-10-08', '2011-10-08T00:00:00.000' + tz], - ['2011-10-08T18', '2011-10-08T18:00:00.000' + tz], - ['2011-10-08T18:04', '2011-10-08T18:04:00.000' + tz], - ['2011-10-08T18:04:20', '2011-10-08T18:04:20.000' + tz], - ['2011-10-08T18:04' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011-10-08T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011-10-08T18:04' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011-10-08T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011-10-08T18:04' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011-10-08T18:04:20' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011-10-08T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011-10-08T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011-10-08T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011-10-08 18', '2011-10-08T18:00:00.000' + tz], - ['2011-10-08 18:04', '2011-10-08T18:04:00.000' + tz], - ['2011-10-08 18:04:20', '2011-10-08T18:04:20.000' + tz], - ['2011-10-08 18:04' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011-10-08 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011-10-08 18:04' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011-10-08 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011-10-08 18:04' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011-10-08 18:04:20' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011-10-08 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011-10-08 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011-10-08 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011-W40', '2011-10-03T00:00:00.000' + tz], - ['2011-W40-6', '2011-10-08T00:00:00.000' + tz], - ['2011-W40-6T18', '2011-10-08T18:00:00.000' + tz], - ['2011-W40-6T18:04', '2011-10-08T18:04:00.000' + tz], - ['2011-W40-6T18:04:20', '2011-10-08T18:04:20.000' + tz], - ['2011-W40-6T18:04' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011-W40-6T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011-W40-6T18:04' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011-W40-6T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011-W40-6T18:04' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011-W40-6T18:04:20' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011-W40-6T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011-W40-6T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011-W40-6T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011-W40-6 18', '2011-10-08T18:00:00.000' + tz], - ['2011-W40-6 18:04', '2011-10-08T18:04:00.000' + tz], - ['2011-W40-6 18:04:20', '2011-10-08T18:04:20.000' + tz], - ['2011-W40-6 18:04' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011-W40-6 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011-W40-6 18:04' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011-W40-6 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011-W40-6 18:04' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011-W40-6 18:04:20' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011-W40-6 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011-W40-6 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011-W40-6 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011-281', '2011-10-08T00:00:00.000' + tz], - ['2011-281T18', '2011-10-08T18:00:00.000' + tz], - ['2011-281T18:04', '2011-10-08T18:04:00.000' + tz], - ['2011-281T18:04:20', '2011-10-08T18:04:20.000' + tz], - ['2011-281T18:04' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011-281T18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011-281T18:04' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011-281T18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011-281T18:04' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011-281T18:04:20' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011-281T18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011-281T18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011-281T18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011-281 18', '2011-10-08T18:00:00.000' + tz], - ['2011-281 18:04', '2011-10-08T18:04:00.000' + tz], - ['2011-281 18:04:20', '2011-10-08T18:04:20.000' + tz], - ['2011-281 18:04' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011-281 18:04:20' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011-281 18:04' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011-281 18:04:20' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011-281 18:04' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011-281 18:04:20' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011-281 18:04:20.1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011-281 18:04:20.11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011-281 18:04:20.111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['20111008T18', '2011-10-08T18:00:00.000' + tz], - ['20111008T1804', '2011-10-08T18:04:00.000' + tz], - ['20111008T180420', '2011-10-08T18:04:20.000' + tz], - ['20111008T1804' + tz, '2011-10-08T18:04:00.000' + tz], - ['20111008T180420' + tz, '2011-10-08T18:04:20.000' + tz], - ['20111008T1804' + tz2, '2011-10-08T18:04:00.000' + tz], - ['20111008T180420' + tz2, '2011-10-08T18:04:20.000' + tz], - ['20111008T1804' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['20111008T180420' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['20111008T180420,1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['20111008T180420,11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['20111008T180420,111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['20111008 18', '2011-10-08T18:00:00.000' + tz], - ['20111008 1804', '2011-10-08T18:04:00.000' + tz], - ['20111008 180420', '2011-10-08T18:04:20.000' + tz], - ['20111008 1804' + tz, '2011-10-08T18:04:00.000' + tz], - ['20111008 180420' + tz, '2011-10-08T18:04:20.000' + tz], - ['20111008 1804' + tz2, '2011-10-08T18:04:00.000' + tz], - ['20111008 180420' + tz2, '2011-10-08T18:04:20.000' + tz], - ['20111008 1804' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['20111008 180420' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['20111008 180420,1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['20111008 180420,11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['20111008 180420,111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011W40', '2011-10-03T00:00:00.000' + tz], - ['2011W406', '2011-10-08T00:00:00.000' + tz], - ['2011W406T18', '2011-10-08T18:00:00.000' + tz], - ['2011W406T1804', '2011-10-08T18:04:00.000' + tz], - ['2011W406T180420', '2011-10-08T18:04:20.000' + tz], - ['2011W406 1804' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011W406T1804' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011W406T180420' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011W406T1804' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011W406T180420' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011W406T1804' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011W406T180420' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011W406T180420,1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011W406T180420,11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011W406T180420,111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011W406 18', '2011-10-08T18:00:00.000' + tz], - ['2011W406 1804', '2011-10-08T18:04:00.000' + tz], - ['2011W406 180420', '2011-10-08T18:04:20.000' + tz], - ['2011W406 1804' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011W406 180420' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011W406 180420' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011W406 1804' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011W406 180420' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011W406 180420,1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011W406 180420,11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011W406 180420,111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011281', '2011-10-08T00:00:00.000' + tz], - ['2011281T18', '2011-10-08T18:00:00.000' + tz], - ['2011281T1804', '2011-10-08T18:04:00.000' + tz], - ['2011281T180420', '2011-10-08T18:04:20.000' + tz], - ['2011281T1804' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011281T180420' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011281T1804' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011281T180420' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011281T1804' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011281T180420' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011281T180420,1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011281T180420,11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011281T180420,111' + tz2, '2011-10-08T18:04:20.111' + tz], - ['2011281 18', '2011-10-08T18:00:00.000' + tz], - ['2011281 1804', '2011-10-08T18:04:00.000' + tz], - ['2011281 180420', '2011-10-08T18:04:20.000' + tz], - ['2011281 1804' + tz, '2011-10-08T18:04:00.000' + tz], - ['2011281 180420' + tz, '2011-10-08T18:04:20.000' + tz], - ['2011281 1804' + tz2, '2011-10-08T18:04:00.000' + tz], - ['2011281 180420' + tz2, '2011-10-08T18:04:20.000' + tz], - ['2011281 1804' + tz3, '2011-10-08T18:' + minutesForTz3 + ':00.000' + tz], - ['2011281 180420' + tz3, '2011-10-08T18:' + minutesForTz3 + ':20.000' + tz], - ['2011281 180420,1' + tz2, '2011-10-08T18:04:20.100' + tz], - ['2011281 180420,11' + tz2, '2011-10-08T18:04:20.110' + tz], - ['2011281 180420,111' + tz2, '2011-10-08T18:04:20.111' + tz] - ], i; - for (i = 0; i < formats.length; i++) { - assert.equal(moment(formats[i][0]).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), - formats[i][1], 'moment should be able to parse ISO ' + formats[i][0]); - assert.equal(moment(formats[i][0], moment.ISO_8601).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), - formats[i][1], 'moment should be able to parse specified ISO ' + formats[i][0]); - assert.equal(moment(formats[i][0], moment.ISO_8601, true).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), - formats[i][1], 'moment should be able to parse specified strict ISO ' + formats[i][0]); - } - }); - - test('non iso 8601 strings', function (assert) { - assert.ok(!moment('2015-10T10:15', moment.ISO_8601, true).isValid(), 'incomplete date with time'); - assert.ok(!moment('2015-W10T10:15', moment.ISO_8601, true).isValid(), 'incomplete week date with time'); - assert.ok(!moment('201510', moment.ISO_8601, true).isValid(), 'basic YYYYMM is not allowed'); - assert.ok(!moment('2015W10T1015', moment.ISO_8601, true).isValid(), 'incomplete week date with time (basic)'); - assert.ok(!moment('2015-10-08T1015', moment.ISO_8601, true).isValid(), 'mixing extended and basic format'); - assert.ok(!moment('20151008T10:15', moment.ISO_8601, true).isValid(), 'mixing basic and extended format'); - }); - - test('parsing iso week year/week/weekday', function (assert) { - assert.equal(moment.utc('2007-W01').format(), '2007-01-01T00:00:00Z', '2008 week 1 (1st Jan Mon)'); - assert.equal(moment.utc('2008-W01').format(), '2007-12-31T00:00:00Z', '2008 week 1 (1st Jan Tue)'); - assert.equal(moment.utc('2003-W01').format(), '2002-12-30T00:00:00Z', '2008 week 1 (1st Jan Wed)'); - assert.equal(moment.utc('2009-W01').format(), '2008-12-29T00:00:00Z', '2009 week 1 (1st Jan Thu)'); - assert.equal(moment.utc('2010-W01').format(), '2010-01-04T00:00:00Z', '2010 week 1 (1st Jan Fri)'); - assert.equal(moment.utc('2011-W01').format(), '2011-01-03T00:00:00Z', '2011 week 1 (1st Jan Sat)'); - assert.equal(moment.utc('2012-W01').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)'); - }); - - test('parsing week year/week/weekday (dow 1, doy 4)', function (assert) { - moment.locale('dow:1,doy:4', {week: {dow: 1, doy: 4}}); - - assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2007-01-01T00:00:00Z', '2007 week 1 (1st Jan Mon)'); - assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-31T00:00:00Z', '2008 week 1 (1st Jan Tue)'); - assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-30T00:00:00Z', '2003 week 1 (1st Jan Wed)'); - assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-29T00:00:00Z', '2009 week 1 (1st Jan Thu)'); - assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2010-01-04T00:00:00Z', '2010 week 1 (1st Jan Fri)'); - assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2011-01-03T00:00:00Z', '2011 week 1 (1st Jan Sat)'); - assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2012-01-02T00:00:00Z', '2012 week 1 (1st Jan Sun)'); - - moment.defineLocale('dow:1,doy:4', null); - }); - - test('parsing week year/week/weekday (dow 1, doy 7)', function (assert) { - moment.locale('dow:1,doy:7', {week: {dow: 1, doy: 7}}); - - assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2007-01-01T00:00:00Z', '2007 week 1 (1st Jan Mon)'); - assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-31T00:00:00Z', '2008 week 1 (1st Jan Tue)'); - assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-30T00:00:00Z', '2003 week 1 (1st Jan Wed)'); - assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-29T00:00:00Z', '2009 week 1 (1st Jan Thu)'); - assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-28T00:00:00Z', '2010 week 1 (1st Jan Fri)'); - assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2010-12-27T00:00:00Z', '2011 week 1 (1st Jan Sat)'); - assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2011-12-26T00:00:00Z', '2012 week 1 (1st Jan Sun)'); - moment.defineLocale('dow:1,doy:7', null); - }); - - test('parsing week year/week/weekday (dow 0, doy 6)', function (assert) { - moment.locale('dow:0,doy:6', {week: {dow: 0, doy: 6}}); - - assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2006-12-31T00:00:00Z', '2007 week 1 (1st Jan Mon)'); - assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-30T00:00:00Z', '2008 week 1 (1st Jan Tue)'); - assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-29T00:00:00Z', '2003 week 1 (1st Jan Wed)'); - assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-28T00:00:00Z', '2009 week 1 (1st Jan Thu)'); - assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-27T00:00:00Z', '2010 week 1 (1st Jan Fri)'); - assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2010-12-26T00:00:00Z', '2011 week 1 (1st Jan Sat)'); - assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2012-01-01T00:00:00Z', '2012 week 1 (1st Jan Sun)'); - moment.defineLocale('dow:0,doy:6', null); - }); - - test('parsing week year/week/weekday (dow 6, doy 12)', function (assert) { - moment.locale('dow:6,doy:12', {week: {dow: 6, doy: 12}}); - - assert.equal(moment.utc('2007-01', 'gggg-ww').format(), '2006-12-30T00:00:00Z', '2007 week 1 (1st Jan Mon)'); - assert.equal(moment.utc('2008-01', 'gggg-ww').format(), '2007-12-29T00:00:00Z', '2008 week 1 (1st Jan Tue)'); - assert.equal(moment.utc('2003-01', 'gggg-ww').format(), '2002-12-28T00:00:00Z', '2003 week 1 (1st Jan Wed)'); - assert.equal(moment.utc('2009-01', 'gggg-ww').format(), '2008-12-27T00:00:00Z', '2009 week 1 (1st Jan Thu)'); - assert.equal(moment.utc('2010-01', 'gggg-ww').format(), '2009-12-26T00:00:00Z', '2010 week 1 (1st Jan Fri)'); - assert.equal(moment.utc('2011-01', 'gggg-ww').format(), '2011-01-01T00:00:00Z', '2011 week 1 (1st Jan Sat)'); - assert.equal(moment.utc('2012-01', 'gggg-ww').format(), '2011-12-31T00:00:00Z', '2012 week 1 (1st Jan Sun)'); - moment.defineLocale('dow:6,doy:12', null); - }); - - test('parsing ISO with Z', function (assert) { - var i, mom, formats = [ - ['2011-10-08T18:04', '2011-10-08T18:04:00.000'], - ['2011-10-08T18:04:20', '2011-10-08T18:04:20.000'], - ['2011-10-08T18:04:20.1', '2011-10-08T18:04:20.100'], - ['2011-10-08T18:04:20.11', '2011-10-08T18:04:20.110'], - ['2011-10-08T18:04:20.111', '2011-10-08T18:04:20.111'], - ['2011-W40-6T18', '2011-10-08T18:00:00.000'], - ['2011-W40-6T18:04', '2011-10-08T18:04:00.000'], - ['2011-W40-6T18:04:20', '2011-10-08T18:04:20.000'], - ['2011-W40-6T18:04:20.1', '2011-10-08T18:04:20.100'], - ['2011-W40-6T18:04:20.11', '2011-10-08T18:04:20.110'], - ['2011-W40-6T18:04:20.111', '2011-10-08T18:04:20.111'], - ['2011-281T18', '2011-10-08T18:00:00.000'], - ['2011-281T18:04', '2011-10-08T18:04:00.000'], - ['2011-281T18:04:20', '2011-10-08T18:04:20.000'], - ['2011-281T18:04:20', '2011-10-08T18:04:20.000'], - ['2011-281T18:04:20.1', '2011-10-08T18:04:20.100'], - ['2011-281T18:04:20.11', '2011-10-08T18:04:20.110'], - ['2011-281T18:04:20.111', '2011-10-08T18:04:20.111'] - ]; - - for (i = 0; i < formats.length; i++) { - mom = moment(formats[i][0] + 'Z').utc(); - assert.equal(mom.format('YYYY-MM-DDTHH:mm:ss.SSS'), formats[i][1], 'moment should be able to parse ISO in UTC ' + formats[i][0] + 'Z'); - - mom = moment(formats[i][0] + ' Z').utc(); - assert.equal(mom.format('YYYY-MM-DDTHH:mm:ss.SSS'), formats[i][1], 'moment should be able to parse ISO in UTC ' + formats[i][0] + ' Z'); - } - }); - - test('parsing iso with T', function (assert) { - assert.equal(moment('2011-10-08T18')._f, 'YYYY-MM-DDTHH', 'should include \'T\' in the format'); - assert.equal(moment('2011-10-08T18:20')._f, 'YYYY-MM-DDTHH:mm', 'should include \'T\' in the format'); - assert.equal(moment('2011-10-08T18:20:13')._f, 'YYYY-MM-DDTHH:mm:ss', 'should include \'T\' in the format'); - assert.equal(moment('2011-10-08T18:20:13.321')._f, 'YYYY-MM-DDTHH:mm:ss.SSSS', 'should include \'T\' in the format'); - - assert.equal(moment('2011-10-08 18')._f, 'YYYY-MM-DD HH', 'should not include \'T\' in the format'); - assert.equal(moment('2011-10-08 18:20')._f, 'YYYY-MM-DD HH:mm', 'should not include \'T\' in the format'); - assert.equal(moment('2011-10-08 18:20:13')._f, 'YYYY-MM-DD HH:mm:ss', 'should not include \'T\' in the format'); - assert.equal(moment('2011-10-08 18:20:13.321')._f, 'YYYY-MM-DD HH:mm:ss.SSSS', 'should not include \'T\' in the format'); - }); - - test('parsing iso Z timezone', function (assert) { - var i, - formats = [ - ['2011-10-08T18:04Z', '2011-10-08T18:04:00.000+00:00'], - ['2011-10-08T18:04:20Z', '2011-10-08T18:04:20.000+00:00'], - ['2011-10-08T18:04:20.111Z', '2011-10-08T18:04:20.111+00:00'] - ]; - for (i = 0; i < formats.length; i++) { - assert.equal(moment.utc(formats[i][0]).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), formats[i][1], 'moment should be able to parse ISO ' + formats[i][0]); - } - }); - - test('parsing iso Z timezone into local', function (assert) { - var m = moment('2011-10-08T18:04:20.111Z'); - - assert.equal(m.utc().format('YYYY-MM-DDTHH:mm:ss.SSS'), '2011-10-08T18:04:20.111', 'moment should be able to parse ISO 2011-10-08T18:04:20.111Z'); - }); - - test('parsing iso with more subsecond precision digits', function (assert) { - assert.equal(moment.utc('2013-07-31T22:00:00.0000000Z').format(), '2013-07-31T22:00:00Z', 'more than 3 subsecond digits'); - }); - - test('null or empty', function (assert) { - assert.equal(moment('').isValid(), false, 'moment(\'\') is not valid'); - assert.equal(moment(null).isValid(), false, 'moment(null) is not valid'); - assert.equal(moment(null, 'YYYY-MM-DD').isValid(), false, 'moment(\'\', \'format\') is not valid'); - assert.equal(moment('', 'YYYY-MM-DD').isValid(), false, 'moment(\'\', \'format\') is not valid'); - assert.equal(moment.utc('').isValid(), false, 'moment.utc(\'\') is not valid'); - assert.equal(moment.utc(null).isValid(), false, 'moment.utc(null) is not valid'); - assert.equal(moment.utc(null, 'YYYY-MM-DD').isValid(), false, 'moment.utc(null) is not valid'); - assert.equal(moment.utc('', 'YYYY-MM-DD').isValid(), false, 'moment.utc(\'\', \'YYYY-MM-DD\') is not valid'); - }); - - test('first century', function (assert) { - assert.equal(moment([0, 0, 1]).format('YYYY-MM-DD'), '0000-01-01', 'Year AD 0'); - assert.equal(moment([99, 0, 1]).format('YYYY-MM-DD'), '0099-01-01', 'Year AD 99'); - assert.equal(moment([999, 0, 1]).format('YYYY-MM-DD'), '0999-01-01', 'Year AD 999'); - assert.equal(moment('0 1 1', 'YYYY MM DD').format('YYYY-MM-DD'), '0000-01-01', 'Year AD 0'); - assert.equal(moment('999 1 1', 'YYYY MM DD').format('YYYY-MM-DD'), '0999-01-01', 'Year AD 999'); - assert.equal(moment('0 1 1', 'YYYYY MM DD').format('YYYYY-MM-DD'), '00000-01-01', 'Year AD 0'); - assert.equal(moment('99 1 1', 'YYYYY MM DD').format('YYYYY-MM-DD'), '00099-01-01', 'Year AD 99'); - assert.equal(moment('999 1 1', 'YYYYY MM DD').format('YYYYY-MM-DD'), '00999-01-01', 'Year AD 999'); - }); - - test('six digit years', function (assert) { - assert.equal(moment([-270000, 0, 1]).format('YYYYY-MM-DD'), '-270000-01-01', 'format BC 270,001'); - assert.equal(moment([270000, 0, 1]).format('YYYYY-MM-DD'), '270000-01-01', 'format AD 270,000'); - assert.equal(moment('-270000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(), -270000, 'parse BC 270,001'); - assert.equal(moment('270000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(), 270000, 'parse AD 270,000'); - assert.equal(moment('+270000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(), 270000, 'parse AD +270,000'); - assert.equal(moment.utc('-270000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(), -270000, 'parse utc BC 270,001'); - assert.equal(moment.utc('270000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(), 270000, 'parse utc AD 270,000'); - assert.equal(moment.utc('+270000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(), 270000, 'parse utc AD +270,000'); - }); - - test('negative four digit years', function (assert) { - assert.equal(moment('-1000-01-01', 'YYYYY-MM-DD').toDate().getFullYear(), -1000, 'parse BC 1,001'); - assert.equal(moment.utc('-1000-01-01', 'YYYYY-MM-DD').toDate().getUTCFullYear(), -1000, 'parse utc BC 1,001'); - }); - - test('strict parsing', function (assert) { - assert.equal(moment('2014-', 'YYYY-Q', true).isValid(), false, 'fail missing quarter'); - - assert.equal(moment('2012-05', 'YYYY-MM', true).format('YYYY-MM'), '2012-05', 'parse correct string'); - assert.equal(moment(' 2012-05', 'YYYY-MM', true).isValid(), false, 'fail on extra whitespace'); - assert.equal(moment('foo 2012-05', '[foo] YYYY-MM', true).format('YYYY-MM'), '2012-05', 'handle fixed text'); - assert.equal(moment('2012 05', 'YYYY-MM', true).isValid(), false, 'fail on different separator'); - assert.equal(moment('2012 05', 'YYYY MM DD', true).isValid(), false, 'fail on too many tokens'); - - assert.equal(moment('05 30 2010', ['DD MM YYYY', 'MM DD YYYY'], true).format('MM DD YYYY'), '05 30 2010', 'array with bad date'); - assert.equal(moment('05 30 2010', ['', 'MM DD YYYY'], true).format('MM DD YYYY'), '05 30 2010', 'array with invalid format'); - assert.equal(moment('05 30 2010', [' DD MM YYYY', 'MM DD YYYY'], true).format('MM DD YYYY'), '05 30 2010', 'array with non-matching format'); - - assert.equal(moment('2010.*...', 'YYYY.*', true).isValid(), false, 'invalid format with regex chars'); - assert.equal(moment('2010.*', 'YYYY.*', true).year(), 2010, 'valid format with regex chars'); - assert.equal(moment('.*2010.*', '.*YYYY.*', true).year(), 2010, 'valid format with regex chars on both sides'); - - //strict tokens - assert.equal(moment('-5-05-25', 'YYYY-MM-DD', true).isValid(), false, 'invalid negative year'); - assert.equal(moment('2-05-25', 'YYYY-MM-DD', true).isValid(), false, 'invalid one-digit year'); - assert.equal(moment('20-05-25', 'YYYY-MM-DD', true).isValid(), false, 'invalid two-digit year'); - assert.equal(moment('201-05-25', 'YYYY-MM-DD', true).isValid(), false, 'invalid three-digit year'); - assert.equal(moment('2010-05-25', 'YYYY-MM-DD', true).isValid(), true, 'valid four-digit year'); - assert.equal(moment('22010-05-25', 'YYYY-MM-DD', true).isValid(), false, 'invalid five-digit year'); - - assert.equal(moment('12-05-25', 'YY-MM-DD', true).isValid(), true, 'valid two-digit year'); - assert.equal(moment('2012-05-25', 'YY-MM-DD', true).isValid(), false, 'invalid four-digit year'); - - assert.equal(moment('-5-05-25', 'Y-MM-DD', true).isValid(), true, 'valid negative year'); - assert.equal(moment('2-05-25', 'Y-MM-DD', true).isValid(), true, 'valid one-digit year'); - assert.equal(moment('20-05-25', 'Y-MM-DD', true).isValid(), true, 'valid two-digit year'); - assert.equal(moment('201-05-25', 'Y-MM-DD', true).isValid(), true, 'valid three-digit year'); - - assert.equal(moment('2012-5-25', 'YYYY-M-DD', true).isValid(), true, 'valid one-digit month'); - assert.equal(moment('2012-5-25', 'YYYY-MM-DD', true).isValid(), false, 'invalid one-digit month'); - assert.equal(moment('2012-05-25', 'YYYY-M-DD', true).isValid(), true, 'valid one-digit month'); - assert.equal(moment('2012-05-25', 'YYYY-MM-DD', true).isValid(), true, 'valid one-digit month'); - - assert.equal(moment('2012-05-2', 'YYYY-MM-D', true).isValid(), true, 'valid one-digit day'); - assert.equal(moment('2012-05-2', 'YYYY-MM-DD', true).isValid(), false, 'invalid one-digit day'); - assert.equal(moment('2012-05-02', 'YYYY-MM-D', true).isValid(), true, 'valid two-digit day'); - assert.equal(moment('2012-05-02', 'YYYY-MM-DD', true).isValid(), true, 'valid two-digit day'); - - assert.equal(moment('+002012-05-25', 'YYYYY-MM-DD', true).isValid(), true, 'valid six-digit year'); - assert.equal(moment('+2012-05-25', 'YYYYY-MM-DD', true).isValid(), false, 'invalid four-digit year'); - - //thse are kinda pointless, but they should work as expected - assert.equal(moment('1', 'S', true).isValid(), true, 'valid one-digit milisecond'); - assert.equal(moment('12', 'S', true).isValid(), false, 'invalid two-digit milisecond'); - assert.equal(moment('123', 'S', true).isValid(), false, 'invalid three-digit milisecond'); - - assert.equal(moment('1', 'SS', true).isValid(), false, 'invalid one-digit milisecond'); - assert.equal(moment('12', 'SS', true).isValid(), true, 'valid two-digit milisecond'); - assert.equal(moment('123', 'SS', true).isValid(), false, 'invalid three-digit milisecond'); - - assert.equal(moment('1', 'SSS', true).isValid(), false, 'invalid one-digit milisecond'); - assert.equal(moment('12', 'SSS', true).isValid(), false, 'invalid two-digit milisecond'); - assert.equal(moment('123', 'SSS', true).isValid(), true, 'valid three-digit milisecond'); - - // strict parsing respects month length - assert.ok(moment('1 January 2000', 'D MMMM YYYY', true).isValid(), 'capital long-month + MMMM'); - assert.ok(!moment('1 January 2000', 'D MMM YYYY', true).isValid(), 'capital long-month + MMM'); - assert.ok(!moment('1 Jan 2000', 'D MMMM YYYY', true).isValid(), 'capital short-month + MMMM'); - assert.ok(moment('1 Jan 2000', 'D MMM YYYY', true).isValid(), 'capital short-month + MMM'); - assert.ok(moment('1 january 2000', 'D MMMM YYYY', true).isValid(), 'lower long-month + MMMM'); - assert.ok(!moment('1 january 2000', 'D MMM YYYY', true).isValid(), 'lower long-month + MMM'); - assert.ok(!moment('1 jan 2000', 'D MMMM YYYY', true).isValid(), 'lower short-month + MMMM'); - assert.ok(moment('1 jan 2000', 'D MMM YYYY', true).isValid(), 'lower short-month + MMM'); - }); - - test('parsing into a locale', function (assert) { - moment.defineLocale('parselocale', { - months : 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'), - monthsShort : 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_') - }); - - moment.locale('en'); - - assert.equal(moment('2012 seven', 'YYYY MMM', 'parselocale').month(), 6, 'should be able to parse in a specific locale'); - - moment.locale('parselocale'); - - assert.equal(moment('2012 july', 'YYYY MMM', 'en').month(), 6, 'should be able to parse in a specific locale'); - - moment.defineLocale('parselocale', null); - }); - - function getVerifier(test) { - return function (input, format, expected, description, asymetrical) { - var m = moment(input, format); - test.equal(m.format('YYYY MM DD'), expected, 'compare: ' + description); - - //test round trip - if (!asymetrical) { - test.equal(m.format(format), input, 'round trip: ' + description); - } - }; - } - - test('parsing week and weekday information', function (assert) { - var ver = getVerifier(assert); - - // year - ver('12', 'gg', '2012 01 01', 'week-year two digits'); - ver('2012', 'gggg', '2012 01 01', 'week-year four digits'); - - ver('99', 'gg', '1998 12 27', 'week-year two digits previous year'); - ver('1999', 'gggg', '1998 12 27', 'week-year four digits previous year'); - - ver('99', 'GG', '1999 01 04', 'iso week-year two digits'); - ver('1999', 'GGGG', '1999 01 04', 'iso week-year four digits'); - - ver('13', 'GG', '2012 12 31', 'iso week-year two digits previous year'); - ver('2013', 'GGGG', '2012 12 31', 'iso week-year four digits previous year'); - - // year + week - ver('1999 37', 'gggg w', '1999 09 05', 'week'); - ver('1999 37', 'gggg ww', '1999 09 05', 'week double'); - ver('1999 37', 'GGGG W', '1999 09 13', 'iso week'); - ver('1999 37', 'GGGG WW', '1999 09 13', 'iso week double'); - - ver('1999 37 4', 'GGGG WW E', '1999 09 16', 'iso day'); - ver('1999 37 04', 'GGGG WW E', '1999 09 16', 'iso day wide', true); - - ver('1999 37 4', 'gggg ww e', '1999 09 09', 'day'); - ver('1999 37 04', 'gggg ww e', '1999 09 09', 'day wide', true); - - // year + week + day - ver('1999 37 4', 'gggg ww d', '1999 09 09', 'd'); - ver('1999 37 Th', 'gggg ww dd', '1999 09 09', 'dd'); - ver('1999 37 Thu', 'gggg ww ddd', '1999 09 09', 'ddd'); - ver('1999 37 Thursday', 'gggg ww dddd', '1999 09 09', 'dddd'); - - // lower-order only - assert.equal(moment('22', 'ww').week(), 22, 'week sets the week by itself'); - assert.equal(moment('22', 'ww').weekYear(), moment().weekYear(), 'week keeps this year'); - assert.equal(moment('2012 22', 'YYYY ww').weekYear(), 2012, 'week keeps parsed year'); - - assert.equal(moment('22', 'WW').isoWeek(), 22, 'iso week sets the week by itself'); - assert.equal(moment('2012 22', 'YYYY WW').weekYear(), 2012, 'iso week keeps parsed year'); - assert.equal(moment('22', 'WW').isoWeekYear(), moment().isoWeekYear(), 'iso week keeps this year'); - - // order - ver('6 2013 2', 'e gggg w', '2013 01 12', 'order doesn\'t matter'); - ver('6 2013 2', 'E GGGG W', '2013 01 12', 'iso order doesn\'t matter'); - - //can parse other stuff too - assert.equal(moment('1999-W37-4 3:30', 'GGGG-[W]WW-E HH:mm').format('YYYY MM DD HH:mm'), '1999 09 16 03:30', 'parsing weeks and hours'); - - // In safari, all years before 1300 are shifted back with one day. - // http://stackoverflow.com/questions/20768975/safari-subtracts-1-day-from-dates-before-1300 - if (new Date('1300-01-01').getUTCFullYear() === 1300) { - // Years less than 100 - ver('0098-06', 'GGGG-WW', '0098 02 03', 'small years work', true); - } - }); - - test('parsing localized weekdays', function (assert) { - var ver = getVerifier(assert); - try { - moment.locale('dow:1,doy:4', { - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - week: {dow: 1, doy: 4} - }); - ver('1999 37 4', 'GGGG WW E', '1999 09 16', 'iso ignores locale'); - ver('1999 37 7', 'GGGG WW E', '1999 09 19', 'iso ignores locale'); - - ver('1999 37 0', 'gggg ww e', '1999 09 13', 'localized e uses local doy and dow: 0 = monday'); - ver('1999 37 4', 'gggg ww e', '1999 09 17', 'localized e uses local doy and dow: 4 = friday'); - - ver('1999 37 1', 'gggg ww d', '1999 09 13', 'localized d uses 0-indexed days: 1 = monday'); - ver('1999 37 Lu', 'gggg ww dd', '1999 09 13', 'localized d uses 0-indexed days: Mo'); - ver('1999 37 lun.', 'gggg ww ddd', '1999 09 13', 'localized d uses 0-indexed days: Mon'); - ver('1999 37 lundi', 'gggg ww dddd', '1999 09 13', 'localized d uses 0-indexed days: Monday'); - ver('1999 37 4', 'gggg ww d', '1999 09 16', 'localized d uses 0-indexed days: 4'); - - //sunday goes at the end of the week - ver('1999 37 0', 'gggg ww d', '1999 09 19', 'localized d uses 0-indexed days: 0 = sund'); - ver('1999 37 Di', 'gggg ww dd', '1999 09 19', 'localized d uses 0-indexed days: 0 = sund'); - } - finally { - moment.defineLocale('dow:1,doy:4', null); - moment.locale('en'); - } - }); - - test('parsing with customized two-digit year', function (assert) { - var original = moment.parseTwoDigitYear; - try { - assert.equal(moment('68', 'YY').year(), 2068); - assert.equal(moment('69', 'YY').year(), 1969); - moment.parseTwoDigitYear = function (input) { - return +input + (+input > 30 ? 1900 : 2000); - }; - assert.equal(moment('68', 'YY').year(), 1968); - assert.equal(moment('67', 'YY').year(), 1967); - assert.equal(moment('31', 'YY').year(), 1931); - assert.equal(moment('30', 'YY').year(), 2030); - } - finally { - moment.parseTwoDigitYear = original; - } - }); - - test('array with strings', function (assert) { - assert.equal(moment(['2014', '7', '31']).isValid(), true, 'string array + isValid'); - }); - - test('object with strings', function (assert) { - assert.equal(moment({year: '2014', month: '7', day: '31'}).isValid(), true, 'string object + isValid'); - }); - - test('utc with array of formats', function (assert) { - assert.equal(moment.utc('2014-01-01', ['YYYY-MM-DD', 'YYYY-MM']).format(), '2014-01-01T00:00:00Z', 'moment.utc works with array of formats'); - }); - - test('parsing invalid string weekdays', function (assert) { - assert.equal(false, moment('a', 'dd').isValid(), - 'dd with invalid weekday, non-strict'); - assert.equal(false, moment('a', 'dd', true).isValid(), - 'dd with invalid weekday, strict'); - assert.equal(false, moment('a', 'ddd').isValid(), - 'ddd with invalid weekday, non-strict'); - assert.equal(false, moment('a', 'ddd', true).isValid(), - 'ddd with invalid weekday, strict'); - assert.equal(false, moment('a', 'dddd').isValid(), - 'dddd with invalid weekday, non-strict'); - assert.equal(false, moment('a', 'dddd', true).isValid(), - 'dddd with invalid weekday, strict'); - }); - - test('milliseconds', function (assert) { - assert.equal(moment('1', 'S').millisecond(), 100); - assert.equal(moment('12', 'SS').millisecond(), 120); - assert.equal(moment('123', 'SSS').millisecond(), 123); - assert.equal(moment('1234', 'SSSS').millisecond(), 123); - assert.equal(moment('12345', 'SSSSS').millisecond(), 123); - assert.equal(moment('123456', 'SSSSSS').millisecond(), 123); - assert.equal(moment('1234567', 'SSSSSSS').millisecond(), 123); - assert.equal(moment('12345678', 'SSSSSSSS').millisecond(), 123); - assert.equal(moment('123456789', 'SSSSSSSSS').millisecond(), 123); - }); - - test('hmm', function (assert) { - assert.equal(moment('123', 'hmm', true).format('HH:mm:ss'), '01:23:00', '123 with hmm'); - assert.equal(moment('123a', 'hmmA', true).format('HH:mm:ss'), '01:23:00', '123a with hmmA'); - assert.equal(moment('123p', 'hmmA', true).format('HH:mm:ss'), '13:23:00', '123p with hmmA'); - - assert.equal(moment('1234', 'hmm', true).format('HH:mm:ss'), '12:34:00', '1234 with hmm'); - assert.equal(moment('1234a', 'hmmA', true).format('HH:mm:ss'), '00:34:00', '1234a with hmmA'); - assert.equal(moment('1234p', 'hmmA', true).format('HH:mm:ss'), '12:34:00', '1234p with hmmA'); - - assert.equal(moment('12345', 'hmmss', true).format('HH:mm:ss'), '01:23:45', '12345 with hmmss'); - assert.equal(moment('12345a', 'hmmssA', true).format('HH:mm:ss'), '01:23:45', '12345a with hmmssA'); - assert.equal(moment('12345p', 'hmmssA', true).format('HH:mm:ss'), '13:23:45', '12345p with hmmssA'); - assert.equal(moment('112345', 'hmmss', true).format('HH:mm:ss'), '11:23:45', '112345 with hmmss'); - assert.equal(moment('112345a', 'hmmssA', true).format('HH:mm:ss'), '11:23:45', '112345a with hmmssA'); - assert.equal(moment('112345p', 'hmmssA', true).format('HH:mm:ss'), '23:23:45', '112345p with hmmssA'); - - assert.equal(moment('023', 'Hmm', true).format('HH:mm:ss'), '00:23:00', '023 with Hmm'); - assert.equal(moment('123', 'Hmm', true).format('HH:mm:ss'), '01:23:00', '123 with Hmm'); - assert.equal(moment('1234', 'Hmm', true).format('HH:mm:ss'), '12:34:00', '1234 with Hmm'); - assert.equal(moment('1534', 'Hmm', true).format('HH:mm:ss'), '15:34:00', '1234 with Hmm'); - assert.equal(moment('12345', 'Hmmss', true).format('HH:mm:ss'), '01:23:45', '12345 with Hmmss'); - assert.equal(moment('112345', 'Hmmss', true).format('HH:mm:ss'), '11:23:45', '112345 with Hmmss'); - assert.equal(moment('172345', 'Hmmss', true).format('HH:mm:ss'), '17:23:45', '112345 with Hmmss'); - }); - - test('Y token', function (assert) { - assert.equal(moment('1-1-2010', 'M-D-Y', true).year(), 2010, 'parsing Y'); - }); - - test('parsing flags retain parsed date parts', function (assert) { - var a = moment('10 p', 'hh:mm a'); - assert.equal(a.parsingFlags().parsedDateParts[3], 10, 'parsed 10 as the hour'); - assert.equal(a.parsingFlags().parsedDateParts[0], undefined, 'year was not parsed'); - assert.equal(a.parsingFlags().meridiem, 'p', 'meridiem flag was added'); - var b = moment('10:30', ['MMDDYY', 'HH:mm']); - assert.equal(b.parsingFlags().parsedDateParts[3], 10, 'multiple format parshing matched hour'); - assert.equal(b.parsingFlags().parsedDateParts[0], undefined, 'array is properly copied, no residual data from first token parse'); - }); - - test('parsing only meridiem results in invalid date', function (assert) { - assert.ok(!moment('alkj', 'hh:mm a').isValid(), 'because an a token is used, a meridiem will be parsed but nothing else was so invalid'); - assert.ok(moment('02:30 p more extra stuff', 'hh:mm a').isValid(), 'because other tokens were parsed, date is valid'); - assert.ok(moment('1/1/2016 extra data', ['a', 'M/D/YYYY']).isValid(), 'took second format, does not pick up on meridiem parsed from first format (good copy)'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('creation data'); - - test('valid date', function (assert) { - var dat = moment('1992-10-22'); - var orig = dat.creationData(); - - assert.equal(dat.isValid(), true, '1992-10-22 is valid'); - assert.equal(orig.input, '1992-10-22', 'original input is not correct.'); - assert.equal(orig.format, 'YYYY-MM-DD', 'original format is defined.'); - assert.equal(orig.locale._abbr, 'en', 'default locale is en'); - assert.equal(orig.isUTC, false, 'not a UTC date'); - }); - - test('valid date at fr locale', function (assert) { - var dat = moment('1992-10-22', 'YYYY-MM-DD', 'fr'); - var orig = dat.creationData(); - - assert.equal(orig.locale._abbr, 'fr', 'locale is fr'); - }); - - test('valid date with formats', function (assert) { - var dat = moment('29-06-1995', ['MM-DD-YYYY', 'DD-MM', 'DD-MM-YYYY']); - var orig = dat.creationData(); - - assert.equal(orig.format, 'DD-MM-YYYY', 'DD-MM-YYYY format is defined.'); - }); - - test('strict', function (assert) { - assert.ok(moment('2015-01-02', 'YYYY-MM-DD', true).creationData().strict, 'strict is true'); - assert.ok(!moment('2015-01-02', 'YYYY-MM-DD').creationData().strict, 'strict is true'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('days in month'); - - test('days in month', function (assert) { - each([31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], function (days, i) { - var firstDay = moment([2012, i]), - lastDay = moment([2012, i, days]); - assert.equal(firstDay.daysInMonth(), days, firstDay.format('L') + ' should have ' + days + ' days.'); - assert.equal(lastDay.daysInMonth(), days, lastDay.format('L') + ' should have ' + days + ' days.'); - }); - }); - - test('days in month leap years', function (assert) { - assert.equal(moment([2010, 1]).daysInMonth(), 28, 'Feb 2010 should have 28 days'); - assert.equal(moment([2100, 1]).daysInMonth(), 28, 'Feb 2100 should have 28 days'); - assert.equal(moment([2008, 1]).daysInMonth(), 29, 'Feb 2008 should have 29 days'); - assert.equal(moment([2000, 1]).daysInMonth(), 29, 'Feb 2000 should have 29 days'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - var hookCallback; - - function hooks () { - return hookCallback.apply(null, arguments); - } - - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback (callback) { - hookCallback = callback; - } - - function isUndefined(input) { - return input === void 0; - } - - function warn(msg) { - if (hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - - return extend(function () { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(null, msg); - } - if (firstTime) { - warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } - - var deprecations = {}; - - function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - hooks.suppressDeprecationWarnings = false; - hooks.deprecationHandler = null; - - module('deprecate'); - - test('deprecate', function (assert) { - // NOTE: hooks inside deprecate.js and moment are different, so this is can - // not be test.expectedDeprecations(...) - var fn = function () {}; - var deprecatedFn = deprecate('testing deprecation', fn); - deprecatedFn(); - - expect(0); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - function equal(assert, a, b, message) { - assert.ok(Math.abs(a - b) < 0.00000001, '(' + a + ' === ' + b + ') ' + message); - } - - function dstForYear(year) { - var start = moment([year]), - end = moment([year + 1]), - current = start.clone(), - last; - - while (current < end) { - last = current.clone(); - current.add(24, 'hour'); - if (last.utcOffset() !== current.utcOffset()) { - end = current.clone(); - current = last.clone(); - break; - } - } - - while (current < end) { - last = current.clone(); - current.add(1, 'hour'); - if (last.utcOffset() !== current.utcOffset()) { - return { - moment : last, - diff : -(current.utcOffset() - last.utcOffset()) / 60 - }; - } - } - } - - module('diff'); - - test('diff', function (assert) { - assert.equal(moment(1000).diff(0), 1000, '1 second - 0 = 1000'); - assert.equal(moment(1000).diff(500), 500, '1 second - 0.5 seconds = 500'); - assert.equal(moment(0).diff(1000), -1000, '0 - 1 second = -1000'); - assert.equal(moment(new Date(1000)).diff(1000), 0, '1 second - 1 second = 0'); - var oneHourDate = new Date(2015, 5, 21), - nowDate = new Date(+oneHourDate); - oneHourDate.setHours(oneHourDate.getHours() + 1); - assert.equal(moment(oneHourDate).diff(nowDate), 60 * 60 * 1000, '1 hour from now = 3600000'); - }); - - test('diff key after', function (assert) { - assert.equal(moment([2010]).diff([2011], 'years'), -1, 'year diff'); - assert.equal(moment([2010]).diff([2010, 2], 'months'), -2, 'month diff'); - assert.equal(moment([2010]).diff([2010, 0, 7], 'weeks'), 0, 'week diff'); - assert.equal(moment([2010]).diff([2010, 0, 8], 'weeks'), -1, 'week diff'); - assert.equal(moment([2010]).diff([2010, 0, 21], 'weeks'), -2, 'week diff'); - assert.equal(moment([2010]).diff([2010, 0, 22], 'weeks'), -3, 'week diff'); - assert.equal(moment([2010]).diff([2010, 0, 4], 'days'), -3, 'day diff'); - assert.equal(moment([2010]).diff([2010, 0, 1, 4], 'hours'), -4, 'hour diff'); - assert.equal(moment([2010]).diff([2010, 0, 1, 0, 5], 'minutes'), -5, 'minute diff'); - assert.equal(moment([2010]).diff([2010, 0, 1, 0, 0, 6], 'seconds'), -6, 'second diff'); - }); - - test('diff key before', function (assert) { - assert.equal(moment([2011]).diff([2010], 'years'), 1, 'year diff'); - assert.equal(moment([2010, 2]).diff([2010], 'months'), 2, 'month diff'); - assert.equal(moment([2010, 0, 4]).diff([2010], 'days'), 3, 'day diff'); - assert.equal(moment([2010, 0, 7]).diff([2010], 'weeks'), 0, 'week diff'); - assert.equal(moment([2010, 0, 8]).diff([2010], 'weeks'), 1, 'week diff'); - assert.equal(moment([2010, 0, 21]).diff([2010], 'weeks'), 2, 'week diff'); - assert.equal(moment([2010, 0, 22]).diff([2010], 'weeks'), 3, 'week diff'); - assert.equal(moment([2010, 0, 1, 4]).diff([2010], 'hours'), 4, 'hour diff'); - assert.equal(moment([2010, 0, 1, 0, 5]).diff([2010], 'minutes'), 5, 'minute diff'); - assert.equal(moment([2010, 0, 1, 0, 0, 6]).diff([2010], 'seconds'), 6, 'second diff'); - }); - - test('diff key before singular', function (assert) { - assert.equal(moment([2011]).diff([2010], 'year'), 1, 'year diff singular'); - assert.equal(moment([2010, 2]).diff([2010], 'month'), 2, 'month diff singular'); - assert.equal(moment([2010, 0, 4]).diff([2010], 'day'), 3, 'day diff singular'); - assert.equal(moment([2010, 0, 7]).diff([2010], 'week'), 0, 'week diff singular'); - assert.equal(moment([2010, 0, 8]).diff([2010], 'week'), 1, 'week diff singular'); - assert.equal(moment([2010, 0, 21]).diff([2010], 'week'), 2, 'week diff singular'); - assert.equal(moment([2010, 0, 22]).diff([2010], 'week'), 3, 'week diff singular'); - assert.equal(moment([2010, 0, 1, 4]).diff([2010], 'hour'), 4, 'hour diff singular'); - assert.equal(moment([2010, 0, 1, 0, 5]).diff([2010], 'minute'), 5, 'minute diff singular'); - assert.equal(moment([2010, 0, 1, 0, 0, 6]).diff([2010], 'second'), 6, 'second diff singular'); - }); - - test('diff key before abbreviated', function (assert) { - assert.equal(moment([2011]).diff([2010], 'y'), 1, 'year diff abbreviated'); - assert.equal(moment([2010, 2]).diff([2010], 'M'), 2, 'month diff abbreviated'); - assert.equal(moment([2010, 0, 4]).diff([2010], 'd'), 3, 'day diff abbreviated'); - assert.equal(moment([2010, 0, 7]).diff([2010], 'w'), 0, 'week diff abbreviated'); - assert.equal(moment([2010, 0, 8]).diff([2010], 'w'), 1, 'week diff abbreviated'); - assert.equal(moment([2010, 0, 21]).diff([2010], 'w'), 2, 'week diff abbreviated'); - assert.equal(moment([2010, 0, 22]).diff([2010], 'w'), 3, 'week diff abbreviated'); - assert.equal(moment([2010, 0, 1, 4]).diff([2010], 'h'), 4, 'hour diff abbreviated'); - assert.equal(moment([2010, 0, 1, 0, 5]).diff([2010], 'm'), 5, 'minute diff abbreviated'); - assert.equal(moment([2010, 0, 1, 0, 0, 6]).diff([2010], 's'), 6, 'second diff abbreviated'); - }); - - test('diff month', function (assert) { - assert.equal(moment([2011, 0, 31]).diff([2011, 2, 1], 'months'), -1, 'month diff'); - }); - - test('diff across DST', function (assert) { - var dst = dstForYear(2012), a, b, daysInMonth; - if (!dst) { - assert.equal(42, 42, 'at least one assertion'); - return; - } - - a = dst.moment; - b = a.clone().utc().add(12, 'hours').local(); - daysInMonth = (a.daysInMonth() + b.daysInMonth()) / 2; - assert.equal(b.diff(a, 'milliseconds', true), 12 * 60 * 60 * 1000, - 'ms diff across DST'); - assert.equal(b.diff(a, 'seconds', true), 12 * 60 * 60, - 'second diff across DST'); - assert.equal(b.diff(a, 'minutes', true), 12 * 60, - 'minute diff across DST'); - assert.equal(b.diff(a, 'hours', true), 12, - 'hour diff across DST'); - assert.equal(b.diff(a, 'days', true), (12 - dst.diff) / 24, - 'day diff across DST'); - equal(assert, b.diff(a, 'weeks', true), (12 - dst.diff) / 24 / 7, - 'week diff across DST'); - assert.ok(0.95 / (2 * 31) < b.diff(a, 'months', true), - 'month diff across DST, lower bound'); - assert.ok(b.diff(a, 'month', true) < 1.05 / (2 * 28), - 'month diff across DST, upper bound'); - assert.ok(0.95 / (2 * 31 * 12) < b.diff(a, 'years', true), - 'year diff across DST, lower bound'); - assert.ok(b.diff(a, 'year', true) < 1.05 / (2 * 28 * 12), - 'year diff across DST, upper bound'); - - a = dst.moment; - b = a.clone().utc().add(12 + dst.diff, 'hours').local(); - daysInMonth = (a.daysInMonth() + b.daysInMonth()) / 2; - - assert.equal(b.diff(a, 'milliseconds', true), - (12 + dst.diff) * 60 * 60 * 1000, - 'ms diff across DST'); - assert.equal(b.diff(a, 'seconds', true), (12 + dst.diff) * 60 * 60, - 'second diff across DST'); - assert.equal(b.diff(a, 'minutes', true), (12 + dst.diff) * 60, - 'minute diff across DST'); - assert.equal(b.diff(a, 'hours', true), (12 + dst.diff), - 'hour diff across DST'); - assert.equal(b.diff(a, 'days', true), 12 / 24, 'day diff across DST'); - equal(assert, b.diff(a, 'weeks', true), 12 / 24 / 7, - 'week diff across DST'); - assert.ok(0.95 / (2 * 31) < b.diff(a, 'months', true), - 'month diff across DST, lower bound'); - assert.ok(b.diff(a, 'month', true) < 1.05 / (2 * 28), - 'month diff across DST, upper bound'); - assert.ok(0.95 / (2 * 31 * 12) < b.diff(a, 'years', true), - 'year diff across DST, lower bound'); - assert.ok(b.diff(a, 'year', true) < 1.05 / (2 * 28 * 12), - 'year diff across DST, upper bound'); - }); - - test('diff overflow', function (assert) { - assert.equal(moment([2011]).diff([2010], 'months'), 12, 'month diff'); - assert.equal(moment([2010, 0, 2]).diff([2010], 'hours'), 24, 'hour diff'); - assert.equal(moment([2010, 0, 1, 2]).diff([2010], 'minutes'), 120, 'minute diff'); - assert.equal(moment([2010, 0, 1, 0, 4]).diff([2010], 'seconds'), 240, 'second diff'); - }); - - test('diff between utc and local', function (assert) { - if (moment([2012]).utcOffset() === moment([2011]).utcOffset()) { - // Russia's utc offset on 1st of Jan 2012 vs 2011 is different - assert.equal(moment([2012]).utc().diff([2011], 'years'), 1, 'year diff'); - } - assert.equal(moment([2010, 2, 2]).utc().diff([2010, 0, 2], 'months'), 2, 'month diff'); - assert.equal(moment([2010, 0, 4]).utc().diff([2010], 'days'), 3, 'day diff'); - assert.equal(moment([2010, 0, 22]).utc().diff([2010], 'weeks'), 3, 'week diff'); - assert.equal(moment([2010, 0, 1, 4]).utc().diff([2010], 'hours'), 4, 'hour diff'); - assert.equal(moment([2010, 0, 1, 0, 5]).utc().diff([2010], 'minutes'), 5, 'minute diff'); - assert.equal(moment([2010, 0, 1, 0, 0, 6]).utc().diff([2010], 'seconds'), 6, 'second diff'); - }); - - test('diff floored', function (assert) { - assert.equal(moment([2010, 0, 1, 23]).diff([2010], 'day'), 0, '23 hours = 0 days'); - assert.equal(moment([2010, 0, 1, 23, 59]).diff([2010], 'day'), 0, '23:59 hours = 0 days'); - assert.equal(moment([2010, 0, 1, 24]).diff([2010], 'day'), 1, '24 hours = 1 day'); - assert.equal(moment([2010, 0, 2]).diff([2011, 0, 1], 'year'), 0, 'year rounded down'); - assert.equal(moment([2011, 0, 1]).diff([2010, 0, 2], 'year'), 0, 'year rounded down'); - assert.equal(moment([2010, 0, 2]).diff([2011, 0, 2], 'year'), -1, 'year rounded down'); - assert.equal(moment([2011, 0, 2]).diff([2010, 0, 2], 'year'), 1, 'year rounded down'); - }); - - test('year diffs include dates', function (assert) { - assert.ok(moment([2012, 1, 19]).diff(moment([2002, 1, 20]), 'years', true) < 10, 'year diff should include date of month'); - }); - - test('month diffs', function (assert) { - // due to floating point math errors, these tests just need to be accurate within 0.00000001 - assert.equal(moment([2012, 0, 1]).diff([2012, 1, 1], 'months', true), -1, 'Jan 1 to Feb 1 should be 1 month'); - equal(assert, moment([2012, 0, 1]).diff([2012, 0, 1, 12], 'months', true), -0.5 / 31, 'Jan 1 to Jan 1 noon should be 0.5 / 31 months'); - assert.equal(moment([2012, 0, 15]).diff([2012, 1, 15], 'months', true), -1, 'Jan 15 to Feb 15 should be 1 month'); - assert.equal(moment([2012, 0, 28]).diff([2012, 1, 28], 'months', true), -1, 'Jan 28 to Feb 28 should be 1 month'); - assert.ok(moment([2012, 0, 31]).diff([2012, 1, 29], 'months', true), -1, 'Jan 31 to Feb 29 should be 1 month'); - assert.ok(-1 > moment([2012, 0, 31]).diff([2012, 2, 1], 'months', true), 'Jan 31 to Mar 1 should be more than 1 month'); - assert.ok(-30 / 28 < moment([2012, 0, 31]).diff([2012, 2, 1], 'months', true), 'Jan 31 to Mar 1 should be less than 1 month and 1 day'); - equal(assert, moment([2012, 0, 1]).diff([2012, 0, 31], 'months', true), -(30 / 31), 'Jan 1 to Jan 31 should be 30 / 31 months'); - assert.ok(0 < moment('2014-02-01').diff(moment('2014-01-31'), 'months', true), 'jan-31 to feb-1 diff is positive'); - }); - - test('exact month diffs', function (assert) { - // generate all pairs of months and compute month diff, with fixed day - // of month = 15. - - var m1, m2; - for (m1 = 0; m1 < 12; ++m1) { - for (m2 = m1; m2 < 12; ++m2) { - assert.equal(moment([2013, m2, 15]).diff(moment([2013, m1, 15]), 'months', true), m2 - m1, - 'month diff from 2013-' + m1 + '-15 to 2013-' + m2 + '-15'); - } - } - }); - - test('year diffs', function (assert) { - // due to floating point math errors, these tests just need to be accurate within 0.00000001 - equal(assert, moment([2012, 0, 1]).diff([2013, 0, 1], 'years', true), -1, 'Jan 1 2012 to Jan 1 2013 should be 1 year'); - equal(assert, moment([2012, 1, 28]).diff([2013, 1, 28], 'years', true), -1, 'Feb 28 2012 to Feb 28 2013 should be 1 year'); - equal(assert, moment([2012, 2, 1]).diff([2013, 2, 1], 'years', true), -1, 'Mar 1 2012 to Mar 1 2013 should be 1 year'); - equal(assert, moment([2012, 11, 1]).diff([2013, 11, 1], 'years', true), -1, 'Dec 1 2012 to Dec 1 2013 should be 1 year'); - equal(assert, moment([2012, 11, 31]).diff([2013, 11, 31], 'years', true), -1, 'Dec 31 2012 to Dec 31 2013 should be 1 year'); - equal(assert, moment([2012, 0, 1]).diff([2013, 6, 1], 'years', true), -1.5, 'Jan 1 2012 to Jul 1 2013 should be 1.5 years'); - equal(assert, moment([2012, 0, 31]).diff([2013, 6, 31], 'years', true), -1.5, 'Jan 31 2012 to Jul 31 2013 should be 1.5 years'); - equal(assert, moment([2012, 0, 1]).diff([2013, 0, 1, 12], 'years', true), -1 - (0.5 / 31) / 12, 'Jan 1 2012 to Jan 1 2013 noon should be 1+(0.5 / 31) / 12 years'); - equal(assert, moment([2012, 0, 1]).diff([2013, 6, 1, 12], 'years', true), -1.5 - (0.5 / 31) / 12, 'Jan 1 2012 to Jul 1 2013 noon should be 1.5+(0.5 / 31) / 12 years'); - equal(assert, moment([2012, 1, 29]).diff([2013, 1, 28], 'years', true), -1, 'Feb 29 2012 to Feb 28 2013 should be 1-(1 / 28.5) / 12 years'); - }); - - test('negative zero', function (assert) { - function isNegative (n) { - return (1 / n) < 0; - } - assert.ok(!isNegative(moment([2012, 0, 1]).diff(moment([2012, 0, 1]), 'months')), 'month diff on same date is zero, not -0'); - assert.ok(!isNegative(moment([2012, 0, 1]).diff(moment([2012, 0, 1]), 'years')), 'year diff on same date is zero, not -0'); - assert.ok(!isNegative(moment([2012, 0, 1]).diff(moment([2012, 0, 1]), 'quarters')), 'quarter diff on same date is zero, not -0'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('duration'); - - test('object instantiation', function (assert) { - var d = moment.duration({ - years: 2, - months: 3, - weeks: 2, - days: 1, - hours: 8, - minutes: 9, - seconds: 20, - milliseconds: 12 - }); - - assert.equal(d.years(), 2, 'years'); - assert.equal(d.months(), 3, 'months'); - assert.equal(d.weeks(), 2, 'weeks'); - assert.equal(d.days(), 15, 'days'); // two weeks + 1 day - assert.equal(d.hours(), 8, 'hours'); - assert.equal(d.minutes(), 9, 'minutes'); - assert.equal(d.seconds(), 20, 'seconds'); - assert.equal(d.milliseconds(), 12, 'milliseconds'); - }); - - test('object instantiation with strings', function (assert) { - var d = moment.duration({ - years: '2', - months: '3', - weeks: '2', - days: '1', - hours: '8', - minutes: '9', - seconds: '20', - milliseconds: '12' - }); - - assert.equal(d.years(), 2, 'years'); - assert.equal(d.months(), 3, 'months'); - assert.equal(d.weeks(), 2, 'weeks'); - assert.equal(d.days(), 15, 'days'); // two weeks + 1 day - assert.equal(d.hours(), 8, 'hours'); - assert.equal(d.minutes(), 9, 'minutes'); - assert.equal(d.seconds(), 20, 'seconds'); - assert.equal(d.milliseconds(), 12, 'milliseconds'); - }); - - test('milliseconds instantiation', function (assert) { - assert.equal(moment.duration(72).milliseconds(), 72, 'milliseconds'); - }); - - test('undefined instantiation', function (assert) { - assert.equal(moment.duration(undefined).milliseconds(), 0, 'milliseconds'); - }); - - test('null instantiation', function (assert) { - assert.equal(moment.duration(null).milliseconds(), 0, 'milliseconds'); - }); - - test('instantiation by type', function (assert) { - assert.equal(moment.duration(1, 'years').years(), 1, 'years'); - assert.equal(moment.duration(1, 'y').years(), 1, 'y'); - assert.equal(moment.duration(2, 'months').months(), 2, 'months'); - assert.equal(moment.duration(2, 'M').months(), 2, 'M'); - assert.equal(moment.duration(3, 'weeks').weeks(), 3, 'weeks'); - assert.equal(moment.duration(3, 'w').weeks(), 3, 'weeks'); - assert.equal(moment.duration(4, 'days').days(), 4, 'days'); - assert.equal(moment.duration(4, 'd').days(), 4, 'd'); - assert.equal(moment.duration(5, 'hours').hours(), 5, 'hours'); - assert.equal(moment.duration(5, 'h').hours(), 5, 'h'); - assert.equal(moment.duration(6, 'minutes').minutes(), 6, 'minutes'); - assert.equal(moment.duration(6, 'm').minutes(), 6, 'm'); - assert.equal(moment.duration(7, 'seconds').seconds(), 7, 'seconds'); - assert.equal(moment.duration(7, 's').seconds(), 7, 's'); - assert.equal(moment.duration(8, 'milliseconds').milliseconds(), 8, 'milliseconds'); - assert.equal(moment.duration(8, 'ms').milliseconds(), 8, 'ms'); - }); - - test('shortcuts', function (assert) { - assert.equal(moment.duration({y: 1}).years(), 1, 'years = y'); - assert.equal(moment.duration({M: 2}).months(), 2, 'months = M'); - assert.equal(moment.duration({w: 3}).weeks(), 3, 'weeks = w'); - assert.equal(moment.duration({d: 4}).days(), 4, 'days = d'); - assert.equal(moment.duration({h: 5}).hours(), 5, 'hours = h'); - assert.equal(moment.duration({m: 6}).minutes(), 6, 'minutes = m'); - assert.equal(moment.duration({s: 7}).seconds(), 7, 'seconds = s'); - assert.equal(moment.duration({ms: 8}).milliseconds(), 8, 'milliseconds = ms'); - }); - - test('generic getter', function (assert) { - assert.equal(moment.duration(1, 'years').get('years'), 1, 'years'); - assert.equal(moment.duration(1, 'years').get('year'), 1, 'years = year'); - assert.equal(moment.duration(1, 'years').get('y'), 1, 'years = y'); - assert.equal(moment.duration(2, 'months').get('months'), 2, 'months'); - assert.equal(moment.duration(2, 'months').get('month'), 2, 'months = month'); - assert.equal(moment.duration(2, 'months').get('M'), 2, 'months = M'); - assert.equal(moment.duration(3, 'weeks').get('weeks'), 3, 'weeks'); - assert.equal(moment.duration(3, 'weeks').get('week'), 3, 'weeks = week'); - assert.equal(moment.duration(3, 'weeks').get('w'), 3, 'weeks = w'); - assert.equal(moment.duration(4, 'days').get('days'), 4, 'days'); - assert.equal(moment.duration(4, 'days').get('day'), 4, 'days = day'); - assert.equal(moment.duration(4, 'days').get('d'), 4, 'days = d'); - assert.equal(moment.duration(5, 'hours').get('hours'), 5, 'hours'); - assert.equal(moment.duration(5, 'hours').get('hour'), 5, 'hours = hour'); - assert.equal(moment.duration(5, 'hours').get('h'), 5, 'hours = h'); - assert.equal(moment.duration(6, 'minutes').get('minutes'), 6, 'minutes'); - assert.equal(moment.duration(6, 'minutes').get('minute'), 6, 'minutes = minute'); - assert.equal(moment.duration(6, 'minutes').get('m'), 6, 'minutes = m'); - assert.equal(moment.duration(7, 'seconds').get('seconds'), 7, 'seconds'); - assert.equal(moment.duration(7, 'seconds').get('second'), 7, 'seconds = second'); - assert.equal(moment.duration(7, 'seconds').get('s'), 7, 'seconds = s'); - assert.equal(moment.duration(8, 'milliseconds').get('milliseconds'), 8, 'milliseconds'); - assert.equal(moment.duration(8, 'milliseconds').get('millisecond'), 8, 'milliseconds = millisecond'); - assert.equal(moment.duration(8, 'milliseconds').get('ms'), 8, 'milliseconds = ms'); - }); - - test('instantiation from another duration', function (assert) { - var simple = moment.duration(1234), - lengthy = moment.duration(60 * 60 * 24 * 360 * 1e3), - complicated = moment.duration({ - years: 2, - months: 3, - weeks: 4, - days: 1, - hours: 8, - minutes: 9, - seconds: 20, - milliseconds: 12 - }), - modified = moment.duration(1, 'day').add(moment.duration(1, 'day')); - - assert.deepEqual(moment.duration(simple), simple, 'simple clones are equal'); - assert.deepEqual(moment.duration(lengthy), lengthy, 'lengthy clones are equal'); - assert.deepEqual(moment.duration(complicated), complicated, 'complicated clones are equal'); - assert.deepEqual(moment.duration(modified), modified, 'cloning modified duration works'); - }); - - test('instantiation from 24-hour time zero', function (assert) { - assert.equal(moment.duration('00:00').years(), 0, '0 years'); - assert.equal(moment.duration('00:00').days(), 0, '0 days'); - assert.equal(moment.duration('00:00').hours(), 0, '0 hours'); - assert.equal(moment.duration('00:00').minutes(), 0, '0 minutes'); - assert.equal(moment.duration('00:00').seconds(), 0, '0 seconds'); - assert.equal(moment.duration('00:00').milliseconds(), 0, '0 milliseconds'); - }); - - test('instantiation from 24-hour time <24 hours', function (assert) { - assert.equal(moment.duration('06:45').years(), 0, '0 years'); - assert.equal(moment.duration('06:45').days(), 0, '0 days'); - assert.equal(moment.duration('06:45').hours(), 6, '6 hours'); - assert.equal(moment.duration('06:45').minutes(), 45, '45 minutes'); - assert.equal(moment.duration('06:45').seconds(), 0, '0 seconds'); - assert.equal(moment.duration('06:45').milliseconds(), 0, '0 milliseconds'); - }); - - test('instantiation from 24-hour time >24 hours', function (assert) { - assert.equal(moment.duration('26:45').years(), 0, '0 years'); - assert.equal(moment.duration('26:45').days(), 1, '0 days'); - assert.equal(moment.duration('26:45').hours(), 2, '2 hours'); - assert.equal(moment.duration('26:45').minutes(), 45, '45 minutes'); - assert.equal(moment.duration('26:45').seconds(), 0, '0 seconds'); - assert.equal(moment.duration('26:45').milliseconds(), 0, '0 milliseconds'); - }); - - test('instatiation from serialized C# TimeSpan zero', function (assert) { - assert.equal(moment.duration('00:00:00').years(), 0, '0 years'); - assert.equal(moment.duration('00:00:00').days(), 0, '0 days'); - assert.equal(moment.duration('00:00:00').hours(), 0, '0 hours'); - assert.equal(moment.duration('00:00:00').minutes(), 0, '0 minutes'); - assert.equal(moment.duration('00:00:00').seconds(), 0, '0 seconds'); - assert.equal(moment.duration('00:00:00').milliseconds(), 0, '0 milliseconds'); - }); - - test('instatiation from serialized C# TimeSpan with days', function (assert) { - assert.equal(moment.duration('1.02:03:04.9999999').years(), 0, '0 years'); - assert.equal(moment.duration('1.02:03:04.9999999').days(), 1, '1 day'); - assert.equal(moment.duration('1.02:03:04.9999999').hours(), 2, '2 hours'); - assert.equal(moment.duration('1.02:03:04.9999999').minutes(), 3, '3 minutes'); - assert.equal(moment.duration('1.02:03:04.9999999').seconds(), 4, '4 seconds'); - assert.equal(moment.duration('1.02:03:04.9999999').milliseconds(), 999, '999 milliseconds'); - - assert.equal(moment.duration('1 02:03:04.9999999').years(), 0, '0 years'); - assert.equal(moment.duration('1 02:03:04.9999999').days(), 1, '1 day'); - assert.equal(moment.duration('1 02:03:04.9999999').hours(), 2, '2 hours'); - assert.equal(moment.duration('1 02:03:04.9999999').minutes(), 3, '3 minutes'); - assert.equal(moment.duration('1 02:03:04.9999999').seconds(), 4, '4 seconds'); - assert.equal(moment.duration('1 02:03:04.9999999').milliseconds(), 999, '999 milliseconds'); - }); - - test('instatiation from serialized C# TimeSpan without days', function (assert) { - assert.equal(moment.duration('01:02:03.9999999').years(), 0, '0 years'); - assert.equal(moment.duration('01:02:03.9999999').days(), 0, '0 days'); - assert.equal(moment.duration('01:02:03.9999999').hours(), 1, '1 hour'); - assert.equal(moment.duration('01:02:03.9999999').minutes(), 2, '2 minutes'); - assert.equal(moment.duration('01:02:03.9999999').seconds(), 3, '3 seconds'); - assert.equal(moment.duration('01:02:03.9999999').milliseconds(), 999, '999 milliseconds'); - - assert.equal(moment.duration('23:59:59.9999999').days(), 0, '0 days'); - assert.equal(moment.duration('23:59:59.9999999').hours(), 23, '23 hours'); - - assert.equal(moment.duration('500:59:59.9999999').days(), 20, '500 hours overflows to 20 days'); - assert.equal(moment.duration('500:59:59.9999999').hours(), 20, '500 hours overflows to 20 hours'); - }); - - test('instatiation from serialized C# TimeSpan without days or milliseconds', function (assert) { - assert.equal(moment.duration('01:02:03').years(), 0, '0 years'); - assert.equal(moment.duration('01:02:03').days(), 0, '0 days'); - assert.equal(moment.duration('01:02:03').hours(), 1, '1 hour'); - assert.equal(moment.duration('01:02:03').minutes(), 2, '2 minutes'); - assert.equal(moment.duration('01:02:03').seconds(), 3, '3 seconds'); - assert.equal(moment.duration('01:02:03').milliseconds(), 0, '0 milliseconds'); - }); - - test('instatiation from serialized C# TimeSpan without milliseconds', function (assert) { - assert.equal(moment.duration('1.02:03:04').years(), 0, '0 years'); - assert.equal(moment.duration('1.02:03:04').days(), 1, '1 day'); - assert.equal(moment.duration('1.02:03:04').hours(), 2, '2 hours'); - assert.equal(moment.duration('1.02:03:04').minutes(), 3, '3 minutes'); - assert.equal(moment.duration('1.02:03:04').seconds(), 4, '4 seconds'); - assert.equal(moment.duration('1.02:03:04').milliseconds(), 0, '0 milliseconds'); - }); - - test('instatiation from serialized C# TimeSpan maxValue', function (assert) { - var d = moment.duration('10675199.02:48:05.4775807'); - - assert.equal(d.years(), 29227, '29227 years'); - assert.equal(d.months(), 8, '8 months'); - assert.equal(d.days(), 12, '12 day'); // if you have to change this value -- just do it - - assert.equal(d.hours(), 2, '2 hours'); - assert.equal(d.minutes(), 48, '48 minutes'); - assert.equal(d.seconds(), 5, '5 seconds'); - assert.equal(d.milliseconds(), 477, '477 milliseconds'); - }); - - test('instatiation from serialized C# TimeSpan minValue', function (assert) { - var d = moment.duration('-10675199.02:48:05.4775808'); - - assert.equal(d.years(), -29227, '29653 years'); - assert.equal(d.months(), -8, '8 day'); - assert.equal(d.days(), -12, '12 day'); // if you have to change this value -- just do it - - assert.equal(d.hours(), -2, '2 hours'); - assert.equal(d.minutes(), -48, '48 minutes'); - assert.equal(d.seconds(), -5, '5 seconds'); - assert.equal(d.milliseconds(), -477, '477 milliseconds'); - }); - - test('instantiation from ISO 8601 duration', function (assert) { - assert.equal(moment.duration('P1Y2M3DT4H5M6S').asSeconds(), moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).asSeconds(), 'all fields'); - assert.equal(moment.duration('P3W3D').asSeconds(), moment.duration({w: 3, d: 3}).asSeconds(), 'week and day fields'); - assert.equal(moment.duration('P1M').asSeconds(), moment.duration({M: 1}).asSeconds(), 'single month field'); - assert.equal(moment.duration('PT1M').asSeconds(), moment.duration({m: 1}).asSeconds(), 'single minute field'); - assert.equal(moment.duration('P1MT2H').asSeconds(), moment.duration({M: 1, h: 2}).asSeconds(), 'random fields missing'); - assert.equal(moment.duration('-P60D').asSeconds(), moment.duration({d: -60}).asSeconds(), 'negative days'); - assert.equal(moment.duration('PT0.5S').asSeconds(), moment.duration({s: 0.5}).asSeconds(), 'fractional seconds'); - assert.equal(moment.duration('PT0,5S').asSeconds(), moment.duration({s: 0.5}).asSeconds(), 'fractional seconds (comma)'); - }); - - test('serialization to ISO 8601 duration strings', function (assert) { - assert.equal(moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).toISOString(), 'P1Y2M3DT4H5M6S', 'all fields'); - assert.equal(moment.duration({M: -1}).toISOString(), '-P1M', 'one month ago'); - assert.equal(moment.duration({m: -1}).toISOString(), '-PT1M', 'one minute ago'); - assert.equal(moment.duration({s: -0.5}).toISOString(), '-PT0.5S', 'one half second ago'); - assert.equal(moment.duration({y: -0.5, M: 1}).toISOString(), '-P5M', 'a month after half a year ago'); - assert.equal(moment.duration({}).toISOString(), 'P0D', 'zero duration'); - assert.equal(moment.duration({M: 16, d:40, s: 86465}).toISOString(), 'P1Y4M40DT24H1M5S', 'all fields'); - }); - - test('toString acts as toISOString', function (assert) { - assert.equal(moment.duration({y: 1, M: 2, d: 3, h: 4, m: 5, s: 6}).toString(), 'P1Y2M3DT4H5M6S', 'all fields'); - assert.equal(moment.duration({M: -1}).toString(), '-P1M', 'one month ago'); - assert.equal(moment.duration({m: -1}).toString(), '-PT1M', 'one minute ago'); - assert.equal(moment.duration({s: -0.5}).toString(), '-PT0.5S', 'one half second ago'); - assert.equal(moment.duration({y: -0.5, M: 1}).toString(), '-P5M', 'a month after half a year ago'); - assert.equal(moment.duration({}).toString(), 'P0D', 'zero duration'); - assert.equal(moment.duration({M: 16, d:40, s: 86465}).toString(), 'P1Y4M40DT24H1M5S', 'all fields'); - }); - - test('toIsoString deprecation', function (assert) { - test.expectedDeprecations('toIsoString()'); - - assert.equal(moment.duration({}).toIsoString(), moment.duration({}).toISOString(), 'toIsoString delegates to toISOString'); - }); - - test('`isodate` (python) test cases', function (assert) { - assert.equal(moment.duration('P18Y9M4DT11H9M8S').asSeconds(), moment.duration({y: 18, M: 9, d: 4, h: 11, m: 9, s: 8}).asSeconds(), 'python isodate 1'); - assert.equal(moment.duration('P2W').asSeconds(), moment.duration({w: 2}).asSeconds(), 'python isodate 2'); - assert.equal(moment.duration('P3Y6M4DT12H30M5S').asSeconds(), moment.duration({y: 3, M: 6, d: 4, h: 12, m: 30, s: 5}).asSeconds(), 'python isodate 3'); - assert.equal(moment.duration('P23DT23H').asSeconds(), moment.duration({d: 23, h: 23}).asSeconds(), 'python isodate 4'); - assert.equal(moment.duration('P4Y').asSeconds(), moment.duration({y: 4}).asSeconds(), 'python isodate 5'); - assert.equal(moment.duration('P1M').asSeconds(), moment.duration({M: 1}).asSeconds(), 'python isodate 6'); - assert.equal(moment.duration('PT1M').asSeconds(), moment.duration({m: 1}).asSeconds(), 'python isodate 7'); - assert.equal(moment.duration('P0.5Y').asSeconds(), moment.duration({y: 0.5}).asSeconds(), 'python isodate 8'); - assert.equal(moment.duration('PT36H').asSeconds(), moment.duration({h: 36}).asSeconds(), 'python isodate 9'); - assert.equal(moment.duration('P1DT12H').asSeconds(), moment.duration({d: 1, h: 12}).asSeconds(), 'python isodate 10'); - assert.equal(moment.duration('-P2W').asSeconds(), moment.duration({w: -2}).asSeconds(), 'python isodate 11'); - assert.equal(moment.duration('-P2.2W').asSeconds(), moment.duration({w: -2.2}).asSeconds(), 'python isodate 12'); - assert.equal(moment.duration('P1DT2H3M4S').asSeconds(), moment.duration({d: 1, h: 2, m: 3, s: 4}).asSeconds(), 'python isodate 13'); - assert.equal(moment.duration('P1DT2H3M').asSeconds(), moment.duration({d: 1, h: 2, m: 3}).asSeconds(), 'python isodate 14'); - assert.equal(moment.duration('P1DT2H').asSeconds(), moment.duration({d: 1, h: 2}).asSeconds(), 'python isodate 15'); - assert.equal(moment.duration('PT2H').asSeconds(), moment.duration({h: 2}).asSeconds(), 'python isodate 16'); - assert.equal(moment.duration('PT2.3H').asSeconds(), moment.duration({h: 2.3}).asSeconds(), 'python isodate 17'); - assert.equal(moment.duration('PT2H3M4S').asSeconds(), moment.duration({h: 2, m: 3, s: 4}).asSeconds(), 'python isodate 18'); - assert.equal(moment.duration('PT3M4S').asSeconds(), moment.duration({m: 3, s: 4}).asSeconds(), 'python isodate 19'); - assert.equal(moment.duration('PT22S').asSeconds(), moment.duration({s: 22}).asSeconds(), 'python isodate 20'); - assert.equal(moment.duration('PT22.22S').asSeconds(), moment.duration({s: 22.22}).asSeconds(), 'python isodate 21'); - assert.equal(moment.duration('-P2Y').asSeconds(), moment.duration({y: -2}).asSeconds(), 'python isodate 22'); - assert.equal(moment.duration('-P3Y6M4DT12H30M5S').asSeconds(), moment.duration({y: -3, M: -6, d: -4, h: -12, m: -30, s: -5}).asSeconds(), 'python isodate 23'); - assert.equal(moment.duration('-P1DT2H3M4S').asSeconds(), moment.duration({d: -1, h: -2, m: -3, s: -4}).asSeconds(), 'python isodate 24'); - assert.equal(moment.duration('PT-6H3M').asSeconds(), moment.duration({h: -6, m: 3}).asSeconds(), 'python isodate 25'); - assert.equal(moment.duration('-PT-6H3M').asSeconds(), moment.duration({h: 6, m: -3}).asSeconds(), 'python isodate 26'); - assert.equal(moment.duration('-P-3Y-6M-4DT-12H-30M-5S').asSeconds(), moment.duration({y: 3, M: 6, d: 4, h: 12, m: 30, s: 5}).asSeconds(), 'python isodate 27'); - assert.equal(moment.duration('P-3Y-6M-4DT-12H-30M-5S').asSeconds(), moment.duration({y: -3, M: -6, d: -4, h: -12, m: -30, s: -5}).asSeconds(), 'python isodate 28'); - assert.equal(moment.duration('-P-2W').asSeconds(), moment.duration({w: 2}).asSeconds(), 'python isodate 29'); - assert.equal(moment.duration('P-2W').asSeconds(), moment.duration({w: -2}).asSeconds(), 'python isodate 30'); - }); - - test('ISO 8601 misuse cases', function (assert) { - assert.equal(moment.duration('P').asSeconds(), 0, 'lonely P'); - assert.equal(moment.duration('PT').asSeconds(), 0, 'just P and T'); - assert.equal(moment.duration('P1H').asSeconds(), 0, 'missing T'); - assert.equal(moment.duration('P1D1Y').asSeconds(), 0, 'out of order'); - assert.equal(moment.duration('PT.5S').asSeconds(), 0.5, 'accept no leading zero for decimal'); - assert.equal(moment.duration('PT1,S').asSeconds(), 1, 'accept trailing decimal separator'); - assert.equal(moment.duration('PT1M0,,5S').asSeconds(), 60, 'extra decimal separators are ignored as 0'); - }); - - test('humanize', function (assert) { - moment.locale('en'); - assert.equal(moment.duration({seconds: 44}).humanize(), 'a few seconds', '44 seconds = a few seconds'); - assert.equal(moment.duration({seconds: 45}).humanize(), 'a minute', '45 seconds = a minute'); - assert.equal(moment.duration({seconds: 89}).humanize(), 'a minute', '89 seconds = a minute'); - assert.equal(moment.duration({seconds: 90}).humanize(), '2 minutes', '90 seconds = 2 minutes'); - assert.equal(moment.duration({minutes: 44}).humanize(), '44 minutes', '44 minutes = 44 minutes'); - assert.equal(moment.duration({minutes: 45}).humanize(), 'an hour', '45 minutes = an hour'); - assert.equal(moment.duration({minutes: 89}).humanize(), 'an hour', '89 minutes = an hour'); - assert.equal(moment.duration({minutes: 90}).humanize(), '2 hours', '90 minutes = 2 hours'); - assert.equal(moment.duration({hours: 5}).humanize(), '5 hours', '5 hours = 5 hours'); - assert.equal(moment.duration({hours: 21}).humanize(), '21 hours', '21 hours = 21 hours'); - assert.equal(moment.duration({hours: 22}).humanize(), 'a day', '22 hours = a day'); - assert.equal(moment.duration({hours: 35}).humanize(), 'a day', '35 hours = a day'); - assert.equal(moment.duration({hours: 36}).humanize(), '2 days', '36 hours = 2 days'); - assert.equal(moment.duration({days: 1}).humanize(), 'a day', '1 day = a day'); - assert.equal(moment.duration({days: 5}).humanize(), '5 days', '5 days = 5 days'); - assert.equal(moment.duration({weeks: 1}).humanize(), '7 days', '1 week = 7 days'); - assert.equal(moment.duration({days: 25}).humanize(), '25 days', '25 days = 25 days'); - assert.equal(moment.duration({days: 26}).humanize(), 'a month', '26 days = a month'); - assert.equal(moment.duration({days: 30}).humanize(), 'a month', '30 days = a month'); - assert.equal(moment.duration({days: 45}).humanize(), 'a month', '45 days = a month'); - assert.equal(moment.duration({days: 46}).humanize(), '2 months', '46 days = 2 months'); - assert.equal(moment.duration({days: 74}).humanize(), '2 months', '74 days = 2 months'); - assert.equal(moment.duration({days: 77}).humanize(), '3 months', '77 days = 3 months'); - assert.equal(moment.duration({months: 1}).humanize(), 'a month', '1 month = a month'); - assert.equal(moment.duration({months: 5}).humanize(), '5 months', '5 months = 5 months'); - assert.equal(moment.duration({days: 344}).humanize(), 'a year', '344 days = a year'); - assert.equal(moment.duration({days: 345}).humanize(), 'a year', '345 days = a year'); - assert.equal(moment.duration({days: 547}).humanize(), 'a year', '547 days = a year'); - assert.equal(moment.duration({days: 548}).humanize(), '2 years', '548 days = 2 years'); - assert.equal(moment.duration({years: 1}).humanize(), 'a year', '1 year = a year'); - assert.equal(moment.duration({years: 5}).humanize(), '5 years', '5 years = 5 years'); - assert.equal(moment.duration(7200000).humanize(), '2 hours', '7200000 = 2 minutes'); - }); - - test('humanize duration with suffix', function (assert) { - moment.locale('en'); - assert.equal(moment.duration({seconds: 44}).humanize(true), 'in a few seconds', '44 seconds = a few seconds'); - assert.equal(moment.duration({seconds: -44}).humanize(true), 'a few seconds ago', '44 seconds = a few seconds'); - }); - - test('bubble value up', function (assert) { - assert.equal(moment.duration({milliseconds: 61001}).milliseconds(), 1, '61001 milliseconds has 1 millisecond left over'); - assert.equal(moment.duration({milliseconds: 61001}).seconds(), 1, '61001 milliseconds has 1 second left over'); - assert.equal(moment.duration({milliseconds: 61001}).minutes(), 1, '61001 milliseconds has 1 minute left over'); - - assert.equal(moment.duration({minutes: 350}).minutes(), 50, '350 minutes has 50 minutes left over'); - assert.equal(moment.duration({minutes: 350}).hours(), 5, '350 minutes has 5 hours left over'); - }); - - test('clipping', function (assert) { - assert.equal(moment.duration({months: 11}).months(), 11, '11 months is 11 months'); - assert.equal(moment.duration({months: 11}).years(), 0, '11 months makes no year'); - assert.equal(moment.duration({months: 12}).months(), 0, '12 months is 0 months left over'); - assert.equal(moment.duration({months: 12}).years(), 1, '12 months makes 1 year'); - assert.equal(moment.duration({months: 13}).months(), 1, '13 months is 1 month left over'); - assert.equal(moment.duration({months: 13}).years(), 1, '13 months makes 1 year'); - - assert.equal(moment.duration({days: 30}).days(), 30, '30 days is 30 days'); - assert.equal(moment.duration({days: 30}).months(), 0, '30 days makes no month'); - assert.equal(moment.duration({days: 31}).days(), 0, '31 days is 0 days left over'); - assert.equal(moment.duration({days: 31}).months(), 1, '31 days is a month'); - assert.equal(moment.duration({days: 32}).days(), 1, '32 days is 1 day left over'); - assert.equal(moment.duration({days: 32}).months(), 1, '32 days is a month'); - - assert.equal(moment.duration({hours: 23}).hours(), 23, '23 hours is 23 hours'); - assert.equal(moment.duration({hours: 23}).days(), 0, '23 hours makes no day'); - assert.equal(moment.duration({hours: 24}).hours(), 0, '24 hours is 0 hours left over'); - assert.equal(moment.duration({hours: 24}).days(), 1, '24 hours makes 1 day'); - assert.equal(moment.duration({hours: 25}).hours(), 1, '25 hours is 1 hour left over'); - assert.equal(moment.duration({hours: 25}).days(), 1, '25 hours makes 1 day'); - }); - - test('bubbling consistency', function (assert) { - var days = 0, months = 0, newDays, newMonths, totalDays, d; - for (totalDays = 1; totalDays <= 500; ++totalDays) { - d = moment.duration(totalDays, 'days'); - newDays = d.days(); - newMonths = d.months() + d.years() * 12; - assert.ok( - (months === newMonths && days + 1 === newDays) || - (months + 1 === newMonths && newDays === 0), - 'consistent total days ' + totalDays + - ' was ' + months + ' ' + days + - ' now ' + newMonths + ' ' + newDays); - days = newDays; - months = newMonths; - } - }); - - test('effective equivalency', function (assert) { - assert.deepEqual(moment.duration({seconds: 1})._data, moment.duration({milliseconds: 1000})._data, '1 second is the same as 1000 milliseconds'); - assert.deepEqual(moment.duration({seconds: 60})._data, moment.duration({minutes: 1})._data, '1 minute is the same as 60 seconds'); - assert.deepEqual(moment.duration({minutes: 60})._data, moment.duration({hours: 1})._data, '1 hour is the same as 60 minutes'); - assert.deepEqual(moment.duration({hours: 24})._data, moment.duration({days: 1})._data, '1 day is the same as 24 hours'); - assert.deepEqual(moment.duration({days: 7})._data, moment.duration({weeks: 1})._data, '1 week is the same as 7 days'); - assert.deepEqual(moment.duration({days: 31})._data, moment.duration({months: 1})._data, '1 month is the same as 30 days'); - assert.deepEqual(moment.duration({months: 12})._data, moment.duration({years: 1})._data, '1 years is the same as 12 months'); - }); - - test('asGetters', function (assert) { - // 400 years have exactly 146097 days - - // years - assert.equal(moment.duration(1, 'year').asYears(), 1, '1 year as years'); - assert.equal(moment.duration(1, 'year').asMonths(), 12, '1 year as months'); - assert.equal(moment.duration(400, 'year').asMonths(), 4800, '400 years as months'); - assert.equal(moment.duration(1, 'year').asWeeks().toFixed(3), 52.143, '1 year as weeks'); - assert.equal(moment.duration(1, 'year').asDays(), 365, '1 year as days'); - assert.equal(moment.duration(2, 'year').asDays(), 730, '2 years as days'); - assert.equal(moment.duration(3, 'year').asDays(), 1096, '3 years as days'); - assert.equal(moment.duration(4, 'year').asDays(), 1461, '4 years as days'); - assert.equal(moment.duration(400, 'year').asDays(), 146097, '400 years as days'); - assert.equal(moment.duration(1, 'year').asHours(), 8760, '1 year as hours'); - assert.equal(moment.duration(1, 'year').asMinutes(), 525600, '1 year as minutes'); - assert.equal(moment.duration(1, 'year').asSeconds(), 31536000, '1 year as seconds'); - assert.equal(moment.duration(1, 'year').asMilliseconds(), 31536000000, '1 year as milliseconds'); - - // months - assert.equal(moment.duration(1, 'month').asYears().toFixed(4), 0.0833, '1 month as years'); - assert.equal(moment.duration(1, 'month').asMonths(), 1, '1 month as months'); - assert.equal(moment.duration(1, 'month').asWeeks().toFixed(3), 4.286, '1 month as weeks'); - assert.equal(moment.duration(1, 'month').asDays(), 30, '1 month as days'); - assert.equal(moment.duration(2, 'month').asDays(), 61, '2 months as days'); - assert.equal(moment.duration(3, 'month').asDays(), 91, '3 months as days'); - assert.equal(moment.duration(4, 'month').asDays(), 122, '4 months as days'); - assert.equal(moment.duration(5, 'month').asDays(), 152, '5 months as days'); - assert.equal(moment.duration(6, 'month').asDays(), 183, '6 months as days'); - assert.equal(moment.duration(7, 'month').asDays(), 213, '7 months as days'); - assert.equal(moment.duration(8, 'month').asDays(), 243, '8 months as days'); - assert.equal(moment.duration(9, 'month').asDays(), 274, '9 months as days'); - assert.equal(moment.duration(10, 'month').asDays(), 304, '10 months as days'); - assert.equal(moment.duration(11, 'month').asDays(), 335, '11 months as days'); - assert.equal(moment.duration(12, 'month').asDays(), 365, '12 months as days'); - assert.equal(moment.duration(24, 'month').asDays(), 730, '24 months as days'); - assert.equal(moment.duration(36, 'month').asDays(), 1096, '36 months as days'); - assert.equal(moment.duration(48, 'month').asDays(), 1461, '48 months as days'); - assert.equal(moment.duration(4800, 'month').asDays(), 146097, '4800 months as days'); - assert.equal(moment.duration(1, 'month').asHours(), 720, '1 month as hours'); - assert.equal(moment.duration(1, 'month').asMinutes(), 43200, '1 month as minutes'); - assert.equal(moment.duration(1, 'month').asSeconds(), 2592000, '1 month as seconds'); - assert.equal(moment.duration(1, 'month').asMilliseconds(), 2592000000, '1 month as milliseconds'); - - // weeks - assert.equal(moment.duration(1, 'week').asYears().toFixed(4), 0.0192, '1 week as years'); - assert.equal(moment.duration(1, 'week').asMonths().toFixed(3), 0.230, '1 week as months'); - assert.equal(moment.duration(1, 'week').asWeeks(), 1, '1 week as weeks'); - assert.equal(moment.duration(1, 'week').asDays(), 7, '1 week as days'); - assert.equal(moment.duration(1, 'week').asHours(), 168, '1 week as hours'); - assert.equal(moment.duration(1, 'week').asMinutes(), 10080, '1 week as minutes'); - assert.equal(moment.duration(1, 'week').asSeconds(), 604800, '1 week as seconds'); - assert.equal(moment.duration(1, 'week').asMilliseconds(), 604800000, '1 week as milliseconds'); - - // days - assert.equal(moment.duration(1, 'day').asYears().toFixed(4), 0.0027, '1 day as years'); - assert.equal(moment.duration(1, 'day').asMonths().toFixed(3), 0.033, '1 day as months'); - assert.equal(moment.duration(1, 'day').asWeeks().toFixed(3), 0.143, '1 day as weeks'); - assert.equal(moment.duration(1, 'day').asDays(), 1, '1 day as days'); - assert.equal(moment.duration(1, 'day').asHours(), 24, '1 day as hours'); - assert.equal(moment.duration(1, 'day').asMinutes(), 1440, '1 day as minutes'); - assert.equal(moment.duration(1, 'day').asSeconds(), 86400, '1 day as seconds'); - assert.equal(moment.duration(1, 'day').asMilliseconds(), 86400000, '1 day as milliseconds'); - - // hours - assert.equal(moment.duration(1, 'hour').asYears().toFixed(6), 0.000114, '1 hour as years'); - assert.equal(moment.duration(1, 'hour').asMonths().toFixed(5), 0.00137, '1 hour as months'); - assert.equal(moment.duration(1, 'hour').asWeeks().toFixed(5), 0.00595, '1 hour as weeks'); - assert.equal(moment.duration(1, 'hour').asDays().toFixed(4), 0.0417, '1 hour as days'); - assert.equal(moment.duration(1, 'hour').asHours(), 1, '1 hour as hours'); - assert.equal(moment.duration(1, 'hour').asMinutes(), 60, '1 hour as minutes'); - assert.equal(moment.duration(1, 'hour').asSeconds(), 3600, '1 hour as seconds'); - assert.equal(moment.duration(1, 'hour').asMilliseconds(), 3600000, '1 hour as milliseconds'); - - // minutes - assert.equal(moment.duration(1, 'minute').asYears().toFixed(8), 0.00000190, '1 minute as years'); - assert.equal(moment.duration(1, 'minute').asMonths().toFixed(7), 0.0000228, '1 minute as months'); - assert.equal(moment.duration(1, 'minute').asWeeks().toFixed(7), 0.0000992, '1 minute as weeks'); - assert.equal(moment.duration(1, 'minute').asDays().toFixed(6), 0.000694, '1 minute as days'); - assert.equal(moment.duration(1, 'minute').asHours().toFixed(4), 0.0167, '1 minute as hours'); - assert.equal(moment.duration(1, 'minute').asMinutes(), 1, '1 minute as minutes'); - assert.equal(moment.duration(1, 'minute').asSeconds(), 60, '1 minute as seconds'); - assert.equal(moment.duration(1, 'minute').asMilliseconds(), 60000, '1 minute as milliseconds'); - - // seconds - assert.equal(moment.duration(1, 'second').asYears().toFixed(10), 0.0000000317, '1 second as years'); - assert.equal(moment.duration(1, 'second').asMonths().toFixed(9), 0.000000380, '1 second as months'); - assert.equal(moment.duration(1, 'second').asWeeks().toFixed(8), 0.00000165, '1 second as weeks'); - assert.equal(moment.duration(1, 'second').asDays().toFixed(7), 0.0000116, '1 second as days'); - assert.equal(moment.duration(1, 'second').asHours().toFixed(6), 0.000278, '1 second as hours'); - assert.equal(moment.duration(1, 'second').asMinutes().toFixed(4), 0.0167, '1 second as minutes'); - assert.equal(moment.duration(1, 'second').asSeconds(), 1, '1 second as seconds'); - assert.equal(moment.duration(1, 'second').asMilliseconds(), 1000, '1 second as milliseconds'); - - // milliseconds - assert.equal(moment.duration(1, 'millisecond').asYears().toFixed(13), 0.0000000000317, '1 millisecond as years'); - assert.equal(moment.duration(1, 'millisecond').asMonths().toFixed(12), 0.000000000380, '1 millisecond as months'); - assert.equal(moment.duration(1, 'millisecond').asWeeks().toFixed(11), 0.00000000165, '1 millisecond as weeks'); - assert.equal(moment.duration(1, 'millisecond').asDays().toFixed(10), 0.0000000116, '1 millisecond as days'); - assert.equal(moment.duration(1, 'millisecond').asHours().toFixed(9), 0.000000278, '1 millisecond as hours'); - assert.equal(moment.duration(1, 'millisecond').asMinutes().toFixed(7), 0.0000167, '1 millisecond as minutes'); - assert.equal(moment.duration(1, 'millisecond').asSeconds(), 0.001, '1 millisecond as seconds'); - assert.equal(moment.duration(1, 'millisecond').asMilliseconds(), 1, '1 millisecond as milliseconds'); - }); - - test('as getters for small units', function (assert) { - var dS = moment.duration(1, 'milliseconds'), - ds = moment.duration(3, 'seconds'), - dm = moment.duration(13, 'minutes'); - - // Tests for issue #1867. - // Floating point errors for small duration units were introduced in version 2.8.0. - assert.equal(dS.as('milliseconds'), 1, 'as("milliseconds")'); - assert.equal(dS.asMilliseconds(), 1, 'asMilliseconds()'); - assert.equal(ds.as('seconds'), 3, 'as("seconds")'); - assert.equal(ds.asSeconds(), 3, 'asSeconds()'); - assert.equal(dm.as('minutes'), 13, 'as("minutes")'); - assert.equal(dm.asMinutes(), 13, 'asMinutes()'); - }); - - test('minutes getter for floating point hours', function (assert) { - // Tests for issue #2978. - // For certain floating point hours, .minutes() getter produced incorrect values due to the rounding errors - assert.equal(moment.duration(2.3, 'h').minutes(), 18, 'minutes()'); - assert.equal(moment.duration(4.1, 'h').minutes(), 6, 'minutes()'); - }); - - test('isDuration', function (assert) { - assert.ok(moment.isDuration(moment.duration(12345678)), 'correctly says true'); - assert.ok(!moment.isDuration(moment()), 'moment object is not a duration'); - assert.ok(!moment.isDuration({milliseconds: 1}), 'plain object is not a duration'); - }); - - test('add', function (assert) { - var d = moment.duration({months: 4, weeks: 3, days: 2}); - // for some reason, d._data._months does not get updated; use d._months instead. - assert.equal(d.add(1, 'month')._months, 5, 'Add months'); - assert.equal(d.add(5, 'days')._days, 28, 'Add days'); - assert.equal(d.add(10000)._milliseconds, 10000, 'Add milliseconds'); - assert.equal(d.add({h: 23, m: 59})._milliseconds, 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 10000, 'Add hour:minute'); - }); - - test('add and bubble', function (assert) { - var d; - - assert.equal(moment.duration(1, 'second').add(1000, 'milliseconds').seconds(), 2, 'Adding milliseconds should bubble up to seconds'); - assert.equal(moment.duration(1, 'minute').add(60, 'second').minutes(), 2, 'Adding seconds should bubble up to minutes'); - assert.equal(moment.duration(1, 'hour').add(60, 'minutes').hours(), 2, 'Adding minutes should bubble up to hours'); - assert.equal(moment.duration(1, 'day').add(24, 'hours').days(), 2, 'Adding hours should bubble up to days'); - - d = moment.duration(-1, 'day').add(1, 'hour'); - assert.equal(d.hours(), -23, '-1 day + 1 hour == -23 hour (component)'); - assert.equal(d.asHours(), -23, '-1 day + 1 hour == -23 hours'); - - d = moment.duration(-1, 'year').add(1, 'day'); - assert.equal(d.days(), -30, '- 1 year + 1 day == -30 days (component)'); - assert.equal(d.months(), -11, '- 1 year + 1 day == -11 months (component)'); - assert.equal(d.years(), 0, '- 1 year + 1 day == 0 years (component)'); - assert.equal(d.asDays(), -364, '- 1 year + 1 day == -364 days'); - - d = moment.duration(-1, 'year').add(1, 'hour'); - assert.equal(d.hours(), -23, '- 1 year + 1 hour == -23 hours (component)'); - assert.equal(d.days(), -30, '- 1 year + 1 hour == -30 days (component)'); - assert.equal(d.months(), -11, '- 1 year + 1 hour == -11 months (component)'); - assert.equal(d.years(), 0, '- 1 year + 1 hour == 0 years (component)'); - }); - - test('subtract and bubble', function (assert) { - var d; - - assert.equal(moment.duration(2, 'second').subtract(1000, 'milliseconds').seconds(), 1, 'Subtracting milliseconds should bubble up to seconds'); - assert.equal(moment.duration(2, 'minute').subtract(60, 'second').minutes(), 1, 'Subtracting seconds should bubble up to minutes'); - assert.equal(moment.duration(2, 'hour').subtract(60, 'minutes').hours(), 1, 'Subtracting minutes should bubble up to hours'); - assert.equal(moment.duration(2, 'day').subtract(24, 'hours').days(), 1, 'Subtracting hours should bubble up to days'); - - d = moment.duration(1, 'day').subtract(1, 'hour'); - assert.equal(d.hours(), 23, '1 day - 1 hour == 23 hour (component)'); - assert.equal(d.asHours(), 23, '1 day - 1 hour == 23 hours'); - - d = moment.duration(1, 'year').subtract(1, 'day'); - assert.equal(d.days(), 30, '1 year - 1 day == 30 days (component)'); - assert.equal(d.months(), 11, '1 year - 1 day == 11 months (component)'); - assert.equal(d.years(), 0, '1 year - 1 day == 0 years (component)'); - assert.equal(d.asDays(), 364, '1 year - 1 day == 364 days'); - - d = moment.duration(1, 'year').subtract(1, 'hour'); - assert.equal(d.hours(), 23, '1 year - 1 hour == 23 hours (component)'); - assert.equal(d.days(), 30, '1 year - 1 hour == 30 days (component)'); - assert.equal(d.months(), 11, '1 year - 1 hour == 11 months (component)'); - assert.equal(d.years(), 0, '1 year - 1 hour == 0 years (component)'); - }); - - test('subtract', function (assert) { - var d = moment.duration({months: 2, weeks: 2, days: 0, hours: 5}); - // for some reason, d._data._months does not get updated; use d._months instead. - assert.equal(d.subtract(1, 'months')._months, 1, 'Subtract months'); - assert.equal(d.subtract(14, 'days')._days, 0, 'Subtract days'); - assert.equal(d.subtract(10000)._milliseconds, 5 * 60 * 60 * 1000 - 10000, 'Subtract milliseconds'); - assert.equal(d.subtract({h: 1, m: 59})._milliseconds, 3 * 60 * 60 * 1000 + 1 * 60 * 1000 - 10000, 'Subtract hour:minute'); - }); - - test('JSON.stringify duration', function (assert) { - var d = moment.duration(1024, 'h'); - - assert.equal(JSON.stringify(d), '"' + d.toISOString() + '"', 'JSON.stringify on duration should return ISO string'); - }); - - test('duration plugins', function (assert) { - var durationObject = moment.duration(); - moment.duration.fn.foo = function (arg) { - assert.equal(this, durationObject); - assert.equal(arg, 5); - }; - durationObject.foo(5); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('duration from moments'); - - test('pure year diff', function (assert) { - var m1 = moment('2012-01-01T00:00:00.000Z'), - m2 = moment('2013-01-01T00:00:00.000Z'); - - assert.equal(moment.duration({from: m1, to: m2}).as('years'), 1, 'year moment difference'); - assert.equal(moment.duration({from: m2, to: m1}).as('years'), -1, 'negative year moment difference'); - }); - - test('month and day diff', function (assert) { - var m1 = moment('2012-01-15T00:00:00.000Z'), - m2 = moment('2012-02-17T00:00:00.000Z'), - d = moment.duration({from: m1, to: m2}); - - assert.equal(d.get('days'), 2); - assert.equal(d.get('months'), 1); - }); - - test('day diff, separate months', function (assert) { - var m1 = moment('2012-01-15T00:00:00.000Z'), - m2 = moment('2012-02-13T00:00:00.000Z'), - d = moment.duration({from: m1, to: m2}); - - assert.equal(d.as('days'), 29); - }); - - test('hour diff', function (assert) { - var m1 = moment('2012-01-15T17:00:00.000Z'), - m2 = moment('2012-01-16T03:00:00.000Z'), - d = moment.duration({from: m1, to: m2}); - - assert.equal(d.as('hours'), 10); - }); - - test('minute diff', function (assert) { - var m1 = moment('2012-01-15T17:45:00.000Z'), - m2 = moment('2012-01-16T03:15:00.000Z'), - d = moment.duration({from: m1, to: m2}); - - assert.equal(d.as('hours'), 9.5); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('format'); - - test('format YY', function (assert) { - var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125)); - assert.equal(b.format('YY'), '09', 'YY ---> 09'); - }); - - test('format escape brackets', function (assert) { - moment.locale('en'); - - var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125)); - assert.equal(b.format('[day]'), 'day', 'Single bracket'); - assert.equal(b.format('[day] YY [YY]'), 'day 09 YY', 'Double bracket'); - assert.equal(b.format('[YY'), '[09', 'Un-ended bracket'); - assert.equal(b.format('[[YY]]'), '[YY]', 'Double nested brackets'); - assert.equal(b.format('[[]'), '[', 'Escape open bracket'); - assert.equal(b.format('[Last]'), 'Last', 'localized tokens'); - assert.equal(b.format('[L] L'), 'L 02/14/2009', 'localized tokens with escaped localized tokens'); - assert.equal(b.format('[L LL LLL LLLL aLa]'), 'L LL LLL LLLL aLa', 'localized tokens with escaped localized tokens'); - assert.equal(b.format('[LLL] LLL'), 'LLL February 14, 2009 3:25 PM', 'localized tokens with escaped localized tokens (recursion)'); - assert.equal(b.format('YYYY[\n]DD[\n]'), '2009\n14\n', 'Newlines'); - }); - - test('handle negative years', function (assert) { - moment.locale('en'); - assert.equal(moment.utc().year(-1).format('YY'), '-01', 'YY with negative year'); - assert.equal(moment.utc().year(-1).format('YYYY'), '-0001', 'YYYY with negative year'); - assert.equal(moment.utc().year(-12).format('YY'), '-12', 'YY with negative year'); - assert.equal(moment.utc().year(-12).format('YYYY'), '-0012', 'YYYY with negative year'); - assert.equal(moment.utc().year(-123).format('YY'), '-23', 'YY with negative year'); - assert.equal(moment.utc().year(-123).format('YYYY'), '-0123', 'YYYY with negative year'); - assert.equal(moment.utc().year(-1234).format('YY'), '-34', 'YY with negative year'); - assert.equal(moment.utc().year(-1234).format('YYYY'), '-1234', 'YYYY with negative year'); - assert.equal(moment.utc().year(-12345).format('YY'), '-45', 'YY with negative year'); - assert.equal(moment.utc().year(-12345).format('YYYY'), '-12345', 'YYYY with negative year'); - }); - - test('format milliseconds', function (assert) { - var b = moment(new Date(2009, 1, 14, 15, 25, 50, 123)); - assert.equal(b.format('S'), '1', 'Deciseconds'); - assert.equal(b.format('SS'), '12', 'Centiseconds'); - assert.equal(b.format('SSS'), '123', 'Milliseconds'); - b.milliseconds(789); - assert.equal(b.format('S'), '7', 'Deciseconds'); - assert.equal(b.format('SS'), '78', 'Centiseconds'); - assert.equal(b.format('SSS'), '789', 'Milliseconds'); - }); - - test('format timezone', function (assert) { - var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)); - assert.ok(b.format('Z').match(/^[\+\-]\d\d:\d\d$/), b.format('Z') + ' should be something like \'+07:30\''); - assert.ok(b.format('ZZ').match(/^[\+\-]\d{4}$/), b.format('ZZ') + ' should be something like \'+0700\''); - }); - - test('format multiple with utc offset', function (assert) { - var b = moment('2012-10-08 -1200', ['YYYY-MM-DD HH:mm ZZ', 'YYYY-MM-DD ZZ', 'YYYY-MM-DD']); - assert.equal(b.format('YYYY-MM'), '2012-10', 'Parsing multiple formats should not crash with different sized formats'); - }); - - test('isDST', function (assert) { - var janOffset = new Date(2011, 0, 1).getTimezoneOffset(), - julOffset = new Date(2011, 6, 1).getTimezoneOffset(), - janIsDst = janOffset < julOffset, - julIsDst = julOffset < janOffset, - jan1 = moment([2011]), - jul1 = moment([2011, 6]); - - if (janIsDst && julIsDst) { - assert.ok(0, 'January and July cannot both be in DST'); - assert.ok(0, 'January and July cannot both be in DST'); - } else if (janIsDst) { - assert.ok(jan1.isDST(), 'January 1 is DST'); - assert.ok(!jul1.isDST(), 'July 1 is not DST'); - } else if (julIsDst) { - assert.ok(!jan1.isDST(), 'January 1 is not DST'); - assert.ok(jul1.isDST(), 'July 1 is DST'); - } else { - assert.ok(!jan1.isDST(), 'January 1 is not DST'); - assert.ok(!jul1.isDST(), 'July 1 is not DST'); - } - }); - - test('unix timestamp', function (assert) { - var m = moment('1234567890.123', 'X'); - assert.equal(m.format('X'), '1234567890', 'unix timestamp without milliseconds'); - assert.equal(m.format('X.S'), '1234567890.1', 'unix timestamp with deciseconds'); - assert.equal(m.format('X.SS'), '1234567890.12', 'unix timestamp with centiseconds'); - assert.equal(m.format('X.SSS'), '1234567890.123', 'unix timestamp with milliseconds'); - - m = moment(1234567890.123, 'X'); - assert.equal(m.format('X'), '1234567890', 'unix timestamp as integer'); - }); - - test('unix offset milliseconds', function (assert) { - var m = moment('1234567890123', 'x'); - assert.equal(m.format('x'), '1234567890123', 'unix offset in milliseconds'); - - m = moment(1234567890123, 'x'); - assert.equal(m.format('x'), '1234567890123', 'unix offset in milliseconds as integer'); - }); - - test('utcOffset sanity checks', function (assert) { - assert.equal(moment().utcOffset() % 15, 0, - 'utc offset should be a multiple of 15 (was ' + moment().utcOffset() + ')'); - - assert.equal(moment().utcOffset(), -(new Date()).getTimezoneOffset(), - 'utcOffset should return the opposite of getTimezoneOffset'); - }); - - test('default format', function (assert) { - var isoRegex = /\d{4}.\d\d.\d\dT\d\d.\d\d.\d\d[\+\-]\d\d:\d\d/; - assert.ok(isoRegex.exec(moment().format()), 'default format (' + moment().format() + ') should match ISO'); - }); - - test('default UTC format', function (assert) { - var isoRegex = /\d{4}.\d\d.\d\dT\d\d.\d\d.\d\dZ/; - assert.ok(isoRegex.exec(moment.utc().format()), 'default UTC format (' + moment.utc().format() + ') should match ISO'); - }); - - test('toJSON', function (assert) { - var supportsJson = typeof JSON !== 'undefined' && JSON.stringify && JSON.stringify.call, - date = moment('2012-10-09T21:30:40.678+0100'); - - assert.equal(date.toJSON(), '2012-10-09T20:30:40.678Z', 'should output ISO8601 on moment.fn.toJSON'); - - if (supportsJson) { - assert.equal(JSON.stringify({ - date : date - }), '{"date":"2012-10-09T20:30:40.678Z"}', 'should output ISO8601 on JSON.stringify'); - } - }); - - test('toISOString', function (assert) { - var date = moment.utc('2012-10-09T20:30:40.678'); - - assert.equal(date.toISOString(), '2012-10-09T20:30:40.678Z', 'should output ISO8601 on moment.fn.toISOString'); - - // big years - date = moment.utc('+020123-10-09T20:30:40.678'); - assert.equal(date.toISOString(), '+020123-10-09T20:30:40.678Z', 'ISO8601 format on big positive year'); - // negative years - date = moment.utc('-000001-10-09T20:30:40.678'); - assert.equal(date.toISOString(), '-000001-10-09T20:30:40.678Z', 'ISO8601 format on negative year'); - // big negative years - date = moment.utc('-020123-10-09T20:30:40.678'); - assert.equal(date.toISOString(), '-020123-10-09T20:30:40.678Z', 'ISO8601 format on big negative year'); - }); - - test('long years', function (assert) { - assert.equal(moment.utc().year(2).format('YYYYYY'), '+000002', 'small year with YYYYYY'); - assert.equal(moment.utc().year(2012).format('YYYYYY'), '+002012', 'regular year with YYYYYY'); - assert.equal(moment.utc().year(20123).format('YYYYYY'), '+020123', 'big year with YYYYYY'); - - assert.equal(moment.utc().year(-1).format('YYYYYY'), '-000001', 'small negative year with YYYYYY'); - assert.equal(moment.utc().year(-2012).format('YYYYYY'), '-002012', 'negative year with YYYYYY'); - assert.equal(moment.utc().year(-20123).format('YYYYYY'), '-020123', 'big negative year with YYYYYY'); - }); - - test('iso week formats', function (assert) { - // http://en.wikipedia.org/wiki/ISO_week_date - var cases = { - '2005-01-02': '2004-53', - '2005-12-31': '2005-52', - '2007-01-01': '2007-01', - '2007-12-30': '2007-52', - '2007-12-31': '2008-01', - '2008-01-01': '2008-01', - '2008-12-28': '2008-52', - '2008-12-29': '2009-01', - '2008-12-30': '2009-01', - '2008-12-31': '2009-01', - '2009-01-01': '2009-01', - '2009-12-31': '2009-53', - '2010-01-01': '2009-53', - '2010-01-02': '2009-53', - '2010-01-03': '2009-53', - '404-12-31': '0404-53', - '405-12-31': '0405-52' - }, i, isoWeek, formatted2, formatted1; - - for (i in cases) { - isoWeek = cases[i].split('-').pop(); - formatted2 = moment(i, 'YYYY-MM-DD').format('WW'); - assert.equal(isoWeek, formatted2, i + ': WW should be ' + isoWeek + ', but ' + formatted2); - isoWeek = isoWeek.replace(/^0+/, ''); - formatted1 = moment(i, 'YYYY-MM-DD').format('W'); - assert.equal(isoWeek, formatted1, i + ': W should be ' + isoWeek + ', but ' + formatted1); - } - }); - - test('iso week year formats', function (assert) { - // http://en.wikipedia.org/wiki/ISO_week_date - var cases = { - '2005-01-02': '2004-53', - '2005-12-31': '2005-52', - '2007-01-01': '2007-01', - '2007-12-30': '2007-52', - '2007-12-31': '2008-01', - '2008-01-01': '2008-01', - '2008-12-28': '2008-52', - '2008-12-29': '2009-01', - '2008-12-30': '2009-01', - '2008-12-31': '2009-01', - '2009-01-01': '2009-01', - '2009-12-31': '2009-53', - '2010-01-01': '2009-53', - '2010-01-02': '2009-53', - '2010-01-03': '2009-53', - '404-12-31': '0404-53', - '405-12-31': '0405-52' - }, i, isoWeekYear, formatted5, formatted4, formatted2; - - for (i in cases) { - isoWeekYear = cases[i].split('-')[0]; - formatted5 = moment(i, 'YYYY-MM-DD').format('GGGGG'); - assert.equal('0' + isoWeekYear, formatted5, i + ': GGGGG should be ' + isoWeekYear + ', but ' + formatted5); - formatted4 = moment(i, 'YYYY-MM-DD').format('GGGG'); - assert.equal(isoWeekYear, formatted4, i + ': GGGG should be ' + isoWeekYear + ', but ' + formatted4); - formatted2 = moment(i, 'YYYY-MM-DD').format('GG'); - assert.equal(isoWeekYear.slice(2, 4), formatted2, i + ': GG should be ' + isoWeekYear + ', but ' + formatted2); - } - }); - - test('week year formats', function (assert) { - // http://en.wikipedia.org/wiki/ISO_week_date - var cases = { - '2005-01-02': '2004-53', - '2005-12-31': '2005-52', - '2007-01-01': '2007-01', - '2007-12-30': '2007-52', - '2007-12-31': '2008-01', - '2008-01-01': '2008-01', - '2008-12-28': '2008-52', - '2008-12-29': '2009-01', - '2008-12-30': '2009-01', - '2008-12-31': '2009-01', - '2009-01-01': '2009-01', - '2009-12-31': '2009-53', - '2010-01-01': '2009-53', - '2010-01-02': '2009-53', - '2010-01-03': '2009-53', - '404-12-31': '0404-53', - '405-12-31': '0405-52' - }, i, isoWeekYear, formatted5, formatted4, formatted2; - - moment.defineLocale('dow:1,doy:4', {week: {dow: 1, doy: 4}}); - - for (i in cases) { - isoWeekYear = cases[i].split('-')[0]; - formatted5 = moment(i, 'YYYY-MM-DD').format('ggggg'); - assert.equal('0' + isoWeekYear, formatted5, i + ': ggggg should be ' + isoWeekYear + ', but ' + formatted5); - formatted4 = moment(i, 'YYYY-MM-DD').format('gggg'); - assert.equal(isoWeekYear, formatted4, i + ': gggg should be ' + isoWeekYear + ', but ' + formatted4); - formatted2 = moment(i, 'YYYY-MM-DD').format('gg'); - assert.equal(isoWeekYear.slice(2, 4), formatted2, i + ': gg should be ' + isoWeekYear + ', but ' + formatted2); - } - moment.defineLocale('dow:1,doy:4', null); - }); - - test('iso weekday formats', function (assert) { - assert.equal(moment([1985, 1, 4]).format('E'), '1', 'Feb 4 1985 is Monday -- 1st day'); - assert.equal(moment([2029, 8, 18]).format('E'), '2', 'Sep 18 2029 is Tuesday -- 2nd day'); - assert.equal(moment([2013, 3, 24]).format('E'), '3', 'Apr 24 2013 is Wednesday -- 3rd day'); - assert.equal(moment([2015, 2, 5]).format('E'), '4', 'Mar 5 2015 is Thursday -- 4th day'); - assert.equal(moment([1970, 0, 2]).format('E'), '5', 'Jan 2 1970 is Friday -- 5th day'); - assert.equal(moment([2001, 4, 12]).format('E'), '6', 'May 12 2001 is Saturday -- 6th day'); - assert.equal(moment([2000, 0, 2]).format('E'), '7', 'Jan 2 2000 is Sunday -- 7th day'); - }); - - test('weekday formats', function (assert) { - moment.defineLocale('dow: 3,doy: 5', {week: {dow: 3, doy: 5}}); - assert.equal(moment([1985, 1, 6]).format('e'), '0', 'Feb 6 1985 is Wednesday -- 0th day'); - assert.equal(moment([2029, 8, 20]).format('e'), '1', 'Sep 20 2029 is Thursday -- 1st day'); - assert.equal(moment([2013, 3, 26]).format('e'), '2', 'Apr 26 2013 is Friday -- 2nd day'); - assert.equal(moment([2015, 2, 7]).format('e'), '3', 'Mar 7 2015 is Saturday -- 3nd day'); - assert.equal(moment([1970, 0, 4]).format('e'), '4', 'Jan 4 1970 is Sunday -- 4th day'); - assert.equal(moment([2001, 4, 14]).format('e'), '5', 'May 14 2001 is Monday -- 5th day'); - assert.equal(moment([2000, 0, 4]).format('e'), '6', 'Jan 4 2000 is Tuesday -- 6th day'); - moment.defineLocale('dow: 3,doy: 5', null); - }); - - test('toString is just human readable format', function (assert) { - var b = moment(new Date(2009, 1, 5, 15, 25, 50, 125)); - assert.equal(b.toString(), b.format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ')); - }); - - test('toJSON skips postformat', function (assert) { - moment.defineLocale('postformat', { - postformat: function (s) { - s.replace(/./g, 'X'); - } - }); - assert.equal(moment.utc([2000, 0, 1]).toJSON(), '2000-01-01T00:00:00.000Z', 'toJSON doesn\'t postformat'); - moment.defineLocale('postformat', null); - }); - - test('calendar day timezone', function (assert) { - moment.locale('en'); - var zones = [60, -60, 90, -90, 360, -360, 720, -720], - b = moment().utc().startOf('day').subtract({m : 1}), - c = moment().local().startOf('day').subtract({m : 1}), - d = moment().local().startOf('day').subtract({d : 2}), - i, z, a; - - for (i = 0; i < zones.length; ++i) { - z = zones[i]; - a = moment().utcOffset(z).startOf('day').subtract({m: 1}); - assert.equal(moment(a).utcOffset(z).calendar(), 'Yesterday at 11:59 PM', - 'Yesterday at 11:59 PM, not Today, or the wrong time, tz = ' + z); - } - - assert.equal(moment(b).utc().calendar(), 'Yesterday at 11:59 PM', 'Yesterday at 11:59 PM, not Today, or the wrong time'); - assert.equal(moment(c).local().calendar(), 'Yesterday at 11:59 PM', 'Yesterday at 11:59 PM, not Today, or the wrong time'); - assert.equal(moment(c).local().calendar(d), 'Tomorrow at 11:59 PM', 'Tomorrow at 11:59 PM, not Yesterday, or the wrong time'); - }); - - test('calendar with custom formats', function (assert) { - assert.equal(moment().calendar(null, {sameDay: '[Today]'}), 'Today', 'Today'); - assert.equal(moment().add(1, 'days').calendar(null, {nextDay: '[Tomorrow]'}), 'Tomorrow', 'Tomorrow'); - assert.equal(moment([1985, 1, 4]).calendar(null, {sameElse: 'YYYY-MM-DD'}), '1985-02-04', 'Else'); - }); - - test('invalid', function (assert) { - assert.equal(moment.invalid().format(), 'Invalid date'); - assert.equal(moment.invalid().format('YYYY-MM-DD'), 'Invalid date'); - }); - - test('quarter formats', function (assert) { - assert.equal(moment([1985, 1, 4]).format('Q'), '1', 'Feb 4 1985 is Q1'); - assert.equal(moment([2029, 8, 18]).format('Q'), '3', 'Sep 18 2029 is Q3'); - assert.equal(moment([2013, 3, 24]).format('Q'), '2', 'Apr 24 2013 is Q2'); - assert.equal(moment([2015, 2, 5]).format('Q'), '1', 'Mar 5 2015 is Q1'); - assert.equal(moment([1970, 0, 2]).format('Q'), '1', 'Jan 2 1970 is Q1'); - assert.equal(moment([2001, 11, 12]).format('Q'), '4', 'Dec 12 2001 is Q4'); - assert.equal(moment([2000, 0, 2]).format('[Q]Q-YYYY'), 'Q1-2000', 'Jan 2 2000 is Q1'); - }); - - test('quarter ordinal formats', function (assert) { - assert.equal(moment([1985, 1, 4]).format('Qo'), '1st', 'Feb 4 1985 is 1st quarter'); - assert.equal(moment([2029, 8, 18]).format('Qo'), '3rd', 'Sep 18 2029 is 3rd quarter'); - assert.equal(moment([2013, 3, 24]).format('Qo'), '2nd', 'Apr 24 2013 is 2nd quarter'); - assert.equal(moment([2015, 2, 5]).format('Qo'), '1st', 'Mar 5 2015 is 1st quarter'); - assert.equal(moment([1970, 0, 2]).format('Qo'), '1st', 'Jan 2 1970 is 1st quarter'); - assert.equal(moment([2001, 11, 12]).format('Qo'), '4th', 'Dec 12 2001 is 4th quarter'); - assert.equal(moment([2000, 0, 2]).format('Qo [quarter] YYYY'), '1st quarter 2000', 'Jan 2 2000 is 1st quarter'); - }); - - // test('full expanded format is returned from abbreviated formats', function (assert) { - // function objectKeys(obj) { - // if (Object.keys) { - // return Object.keys(obj); - // } else { - // // IE8 - // var res = [], i; - // for (i in obj) { - // if (obj.hasOwnProperty(i)) { - // res.push(i); - // } - // } - // return res; - // } - // } - - // var locales = - // 'ar-sa ar-tn ar az be bg bn bo br bs ca cs cv cy da de-at de dv el ' + - // 'en-au en-ca en-gb en-ie en-nz eo es et eu fa fi fo fr-ca fr-ch fr fy ' + - // 'gd gl he hi hr hu hy-am id is it ja jv ka kk km ko lb lo lt lv me mk ml ' + - // 'mr ms-my ms my nb ne nl nn pl pt-br pt ro ru se si sk sl sq sr-cyrl ' + - // 'sr sv sw ta te th tl-ph tlh tr tzl tzm-latn tzm uk uz vi zh-cn zh-tw'; - - // each(locales.split(' '), function (locale) { - // var data, tokens; - // data = moment().locale(locale).localeData()._longDateFormat; - // tokens = objectKeys(data); - // each(tokens, function (token) { - // // Check each format string to make sure it does not contain any - // // tokens that need to be expanded. - // each(tokens, function (i) { - // // strip escaped sequences - // var format = data[i].replace(/(\[[^\]]*\])/g, ''); - // assert.equal(false, !!~format.indexOf(token), 'locale ' + locale + ' contains ' + token + ' in ' + i); - // }); - // }); - // }); - // }); - - test('milliseconds', function (assert) { - var m = moment('123', 'SSS'); - - assert.equal(m.format('S'), '1'); - assert.equal(m.format('SS'), '12'); - assert.equal(m.format('SSS'), '123'); - assert.equal(m.format('SSSS'), '1230'); - assert.equal(m.format('SSSSS'), '12300'); - assert.equal(m.format('SSSSSS'), '123000'); - assert.equal(m.format('SSSSSSS'), '1230000'); - assert.equal(m.format('SSSSSSSS'), '12300000'); - assert.equal(m.format('SSSSSSSSS'), '123000000'); - }); - - test('hmm and hmmss', function (assert) { - assert.equal(moment('12:34:56', 'HH:mm:ss').format('hmm'), '1234'); - assert.equal(moment('01:34:56', 'HH:mm:ss').format('hmm'), '134'); - assert.equal(moment('13:34:56', 'HH:mm:ss').format('hmm'), '134'); - - assert.equal(moment('12:34:56', 'HH:mm:ss').format('hmmss'), '123456'); - assert.equal(moment('01:34:56', 'HH:mm:ss').format('hmmss'), '13456'); - assert.equal(moment('13:34:56', 'HH:mm:ss').format('hmmss'), '13456'); - }); - - test('Hmm and Hmmss', function (assert) { - assert.equal(moment('12:34:56', 'HH:mm:ss').format('Hmm'), '1234'); - assert.equal(moment('01:34:56', 'HH:mm:ss').format('Hmm'), '134'); - assert.equal(moment('13:34:56', 'HH:mm:ss').format('Hmm'), '1334'); - - assert.equal(moment('12:34:56', 'HH:mm:ss').format('Hmmss'), '123456'); - assert.equal(moment('01:34:56', 'HH:mm:ss').format('Hmmss'), '13456'); - assert.equal(moment('08:34:56', 'HH:mm:ss').format('Hmmss'), '83456'); - assert.equal(moment('18:34:56', 'HH:mm:ss').format('Hmmss'), '183456'); - }); - - test('k and kk', function (assert) { - assert.equal(moment('01:23:45', 'HH:mm:ss').format('k'), '1'); - assert.equal(moment('12:34:56', 'HH:mm:ss').format('k'), '12'); - assert.equal(moment('01:23:45', 'HH:mm:ss').format('kk'), '01'); - assert.equal(moment('12:34:56', 'HH:mm:ss').format('kk'), '12'); - assert.equal(moment('00:34:56', 'HH:mm:ss').format('kk'), '24'); - assert.equal(moment('00:00:00', 'HH:mm:ss').format('kk'), '24'); - }); - - test('Y token', function (assert) { - assert.equal(moment('2010-01-01', 'YYYY-MM-DD', true).format('Y'), '2010', 'format 2010 with Y'); - assert.equal(moment('-123-01-01', 'Y-MM-DD', true).format('Y'), '-123', 'format -123 with Y'); - assert.equal(moment('12345-01-01', 'Y-MM-DD', true).format('Y'), '+12345', 'format 12345 with Y'); - assert.equal(moment('0-01-01', 'Y-MM-DD', true).format('Y'), '0', 'format 0 with Y'); - assert.equal(moment('1-01-01', 'Y-MM-DD', true).format('Y'), '1', 'format 1 with Y'); - assert.equal(moment('9999-01-01', 'Y-MM-DD', true).format('Y'), '9999', 'format 9999 with Y'); - assert.equal(moment('10000-01-01', 'Y-MM-DD', true).format('Y'), '+10000', 'format 10000 with Y'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('from_to'); - - test('from', function (assert) { - var start = moment(); - moment.locale('en'); - assert.equal(start.from(start.clone().add(5, 'seconds')), 'a few seconds ago', '5 seconds = a few seconds ago'); - assert.equal(start.from(start.clone().add(1, 'minute')), 'a minute ago', '1 minute = a minute ago'); - assert.equal(start.from(start.clone().add(5, 'minutes')), '5 minutes ago', '5 minutes = 5 minutes ago'); - - assert.equal(start.from(start.clone().subtract(5, 'seconds')), 'in a few seconds', '5 seconds = in a few seconds'); - assert.equal(start.from(start.clone().subtract(1, 'minute')), 'in a minute', '1 minute = in a minute'); - assert.equal(start.from(start.clone().subtract(5, 'minutes')), 'in 5 minutes', '5 minutes = in 5 minutes'); - }); - - test('from with absolute duration', function (assert) { - var start = moment(); - moment.locale('en'); - assert.equal(start.from(start.clone().add(5, 'seconds'), true), 'a few seconds', '5 seconds = a few seconds'); - assert.equal(start.from(start.clone().add(1, 'minute'), true), 'a minute', '1 minute = a minute'); - assert.equal(start.from(start.clone().add(5, 'minutes'), true), '5 minutes', '5 minutes = 5 minutes'); - - assert.equal(start.from(start.clone().subtract(5, 'seconds'), true), 'a few seconds', '5 seconds = a few seconds'); - assert.equal(start.from(start.clone().subtract(1, 'minute'), true), 'a minute', '1 minute = a minute'); - assert.equal(start.from(start.clone().subtract(5, 'minutes'), true), '5 minutes', '5 minutes = 5 minutes'); - }); - - test('to', function (assert) { - var start = moment(); - moment.locale('en'); - assert.equal(start.to(start.clone().subtract(5, 'seconds')), 'a few seconds ago', '5 seconds = a few seconds ago'); - assert.equal(start.to(start.clone().subtract(1, 'minute')), 'a minute ago', '1 minute = a minute ago'); - assert.equal(start.to(start.clone().subtract(5, 'minutes')), '5 minutes ago', '5 minutes = 5 minutes ago'); - - assert.equal(start.to(start.clone().add(5, 'seconds')), 'in a few seconds', '5 seconds = in a few seconds'); - assert.equal(start.to(start.clone().add(1, 'minute')), 'in a minute', '1 minute = in a minute'); - assert.equal(start.to(start.clone().add(5, 'minutes')), 'in 5 minutes', '5 minutes = in 5 minutes'); - }); - - test('to with absolute duration', function (assert) { - var start = moment(); - moment.locale('en'); - assert.equal(start.to(start.clone().add(5, 'seconds'), true), 'a few seconds', '5 seconds = a few seconds'); - assert.equal(start.to(start.clone().add(1, 'minute'), true), 'a minute', '1 minute = a minute'); - assert.equal(start.to(start.clone().add(5, 'minutes'), true), '5 minutes', '5 minutes = 5 minutes'); - - assert.equal(start.to(start.clone().subtract(5, 'seconds'), true), 'a few seconds', '5 seconds = a few seconds'); - assert.equal(start.to(start.clone().subtract(1, 'minute'), true), 'a minute', '1 minute = a minute'); - assert.equal(start.to(start.clone().subtract(5, 'minutes'), true), '5 minutes', '5 minutes = 5 minutes'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('getters and setters'); - - test('getters', function (assert) { - var a = moment([2011, 9, 12, 6, 7, 8, 9]); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hours(), 6, 'hour'); - assert.equal(a.minutes(), 7, 'minute'); - assert.equal(a.seconds(), 8, 'second'); - assert.equal(a.milliseconds(), 9, 'milliseconds'); - }); - - test('getters programmatic', function (assert) { - var a = moment([2011, 9, 12, 6, 7, 8, 9]); - assert.equal(a.get('year'), 2011, 'year'); - assert.equal(a.get('month'), 9, 'month'); - assert.equal(a.get('date'), 12, 'date'); - assert.equal(a.get('day'), 3, 'day'); - assert.equal(a.get('hour'), 6, 'hour'); - assert.equal(a.get('minute'), 7, 'minute'); - assert.equal(a.get('second'), 8, 'second'); - assert.equal(a.get('milliseconds'), 9, 'milliseconds'); - - //actual getters tested elsewhere - assert.equal(a.get('weekday'), a.weekday(), 'weekday'); - assert.equal(a.get('isoWeekday'), a.isoWeekday(), 'isoWeekday'); - assert.equal(a.get('week'), a.week(), 'week'); - assert.equal(a.get('isoWeek'), a.isoWeek(), 'isoWeek'); - assert.equal(a.get('dayOfYear'), a.dayOfYear(), 'dayOfYear'); - }); - - test('setters plural', function (assert) { - var a = moment(); - test.expectedDeprecations('years accessor', 'months accessor', 'dates accessor'); - - a.years(2011); - a.months(9); - a.dates(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(9); - assert.equal(a.years(), 2011, 'years'); - assert.equal(a.months(), 9, 'months'); - assert.equal(a.dates(), 12, 'dates'); - assert.equal(a.days(), 3, 'days'); - assert.equal(a.hours(), 6, 'hours'); - assert.equal(a.minutes(), 7, 'minutes'); - assert.equal(a.seconds(), 8, 'seconds'); - assert.equal(a.milliseconds(), 9, 'milliseconds'); - }); - - test('setters singular', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hour(6); - a.minute(7); - a.second(8); - a.millisecond(9); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hour(), 6, 'hour'); - assert.equal(a.minute(), 7, 'minute'); - assert.equal(a.second(), 8, 'second'); - assert.equal(a.millisecond(), 9, 'milliseconds'); - }); - - test('setters', function (assert) { - var a = moment(); - a.year(2011); - a.month(9); - a.date(12); - a.hours(6); - a.minutes(7); - a.seconds(8); - a.milliseconds(9); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hours(), 6, 'hour'); - assert.equal(a.minutes(), 7, 'minute'); - assert.equal(a.seconds(), 8, 'second'); - assert.equal(a.milliseconds(), 9, 'milliseconds'); - - // Test month() behavior. See https://github.com/timrwood/moment/pull/822 - a = moment('20130531', 'YYYYMMDD'); - a.month(3); - assert.equal(a.month(), 3, 'month edge case'); - }); - - test('setter programmatic', function (assert) { - var a = moment(); - a.set('year', 2011); - a.set('month', 9); - a.set('date', 12); - a.set('hours', 6); - a.set('minutes', 7); - a.set('seconds', 8); - a.set('milliseconds', 9); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hours(), 6, 'hour'); - assert.equal(a.minutes(), 7, 'minute'); - assert.equal(a.seconds(), 8, 'second'); - assert.equal(a.milliseconds(), 9, 'milliseconds'); - - // Test month() behavior. See https://github.com/timrwood/moment/pull/822 - a = moment('20130531', 'YYYYMMDD'); - a.month(3); - assert.equal(a.month(), 3, 'month edge case'); - }); - - test('setters programatic with weeks', function (assert) { - var a = moment(); - a.set('weekYear', 2001); - a.set('week', 49); - a.set('day', 4); - - assert.equal(a.weekYear(), 2001, 'weekYear'); - assert.equal(a.week(), 49, 'week'); - assert.equal(a.day(), 4, 'day'); - - a.set('weekday', 1); - assert.equal(a.weekday(), 1, 'weekday'); - }); - - test('setters programatic with weeks ISO', function (assert) { - var a = moment(); - a.set('isoWeekYear', 2001); - a.set('isoWeek', 49); - a.set('isoWeekday', 4); - - assert.equal(a.isoWeekYear(), 2001, 'isoWeekYear'); - assert.equal(a.isoWeek(), 49, 'isoWeek'); - assert.equal(a.isoWeekday(), 4, 'isoWeekday'); - }); - - test('setters strings', function (assert) { - var a = moment([2012]).locale('en'); - assert.equal(a.clone().day(0).day('Wednesday').day(), 3, 'day full name'); - assert.equal(a.clone().day(0).day('Wed').day(), 3, 'day short name'); - assert.equal(a.clone().day(0).day('We').day(), 3, 'day minimal name'); - assert.equal(a.clone().day(0).day('invalid').day(), 0, 'invalid day name'); - assert.equal(a.clone().month(0).month('April').month(), 3, 'month full name'); - assert.equal(a.clone().month(0).month('Apr').month(), 3, 'month short name'); - assert.equal(a.clone().month(0).month('invalid').month(), 0, 'invalid month name'); - }); - - test('setters - falsey values', function (assert) { - var a = moment(); - // ensure minutes wasn't coincidentally 0 already - a.minutes(1); - a.minutes(0); - assert.equal(a.minutes(), 0, 'falsey value'); - }); - - test('chaining setters', function (assert) { - var a = moment(); - a.year(2011) - .month(9) - .date(12) - .hours(6) - .minutes(7) - .seconds(8); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hours(), 6, 'hour'); - assert.equal(a.minutes(), 7, 'minute'); - assert.equal(a.seconds(), 8, 'second'); - }); - - test('setter with multiple unit values', function (assert) { - var a = moment(); - a.set({ - year: 2011, - month: 9, - date: 12, - hours: 6, - minutes: 7, - seconds: 8, - milliseconds: 9 - }); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hours(), 6, 'hour'); - assert.equal(a.minutes(), 7, 'minute'); - assert.equal(a.seconds(), 8, 'second'); - assert.equal(a.milliseconds(), 9, 'milliseconds'); - }); - - test('day setter', function (assert) { - var a = moment([2011, 0, 15]); - assert.equal(moment(a).day(0).date(), 9, 'set from saturday to sunday'); - assert.equal(moment(a).day(6).date(), 15, 'set from saturday to saturday'); - assert.equal(moment(a).day(3).date(), 12, 'set from saturday to wednesday'); - - a = moment([2011, 0, 9]); - assert.equal(moment(a).day(0).date(), 9, 'set from sunday to sunday'); - assert.equal(moment(a).day(6).date(), 15, 'set from sunday to saturday'); - assert.equal(moment(a).day(3).date(), 12, 'set from sunday to wednesday'); - - a = moment([2011, 0, 12]); - assert.equal(moment(a).day(0).date(), 9, 'set from wednesday to sunday'); - assert.equal(moment(a).day(6).date(), 15, 'set from wednesday to saturday'); - assert.equal(moment(a).day(3).date(), 12, 'set from wednesday to wednesday'); - - assert.equal(moment(a).day(-7).date(), 2, 'set from wednesday to last sunday'); - assert.equal(moment(a).day(-1).date(), 8, 'set from wednesday to last saturday'); - assert.equal(moment(a).day(-4).date(), 5, 'set from wednesday to last wednesday'); - - assert.equal(moment(a).day(7).date(), 16, 'set from wednesday to next sunday'); - assert.equal(moment(a).day(13).date(), 22, 'set from wednesday to next saturday'); - assert.equal(moment(a).day(10).date(), 19, 'set from wednesday to next wednesday'); - - assert.equal(moment(a).day(14).date(), 23, 'set from wednesday to second next sunday'); - assert.equal(moment(a).day(20).date(), 29, 'set from wednesday to second next saturday'); - assert.equal(moment(a).day(17).date(), 26, 'set from wednesday to second next wednesday'); - }); - - test('string setters', function (assert) { - var a = moment(); - a.year('2011'); - a.month('9'); - a.date('12'); - a.hours('6'); - a.minutes('7'); - a.seconds('8'); - a.milliseconds('9'); - assert.equal(a.year(), 2011, 'year'); - assert.equal(a.month(), 9, 'month'); - assert.equal(a.date(), 12, 'date'); - assert.equal(a.day(), 3, 'day'); - assert.equal(a.hours(), 6, 'hour'); - assert.equal(a.minutes(), 7, 'minute'); - assert.equal(a.seconds(), 8, 'second'); - assert.equal(a.milliseconds(), 9, 'milliseconds'); - }); - - test('setters across DST +1', function (assert) { - var oldUpdateOffset = moment.updateOffset, - // Based on a real story somewhere in America/Los_Angeles - dstAt = moment('2014-03-09T02:00:00-08:00').parseZone(), - m; - - moment.updateOffset = function (mom, keepTime) { - if (mom.isBefore(dstAt)) { - mom.utcOffset(-8, keepTime); - } else { - mom.utcOffset(-7, keepTime); - } - }; - - m = moment('2014-03-15T00:00:00-07:00').parseZone(); - m.year(2013); - assert.equal(m.format(), '2013-03-15T00:00:00-08:00', 'year across +1'); - - m = moment('2014-03-15T00:00:00-07:00').parseZone(); - m.month(0); - assert.equal(m.format(), '2014-01-15T00:00:00-08:00', 'month across +1'); - - m = moment('2014-03-15T00:00:00-07:00').parseZone(); - m.date(1); - assert.equal(m.format(), '2014-03-01T00:00:00-08:00', 'date across +1'); - - m = moment('2014-03-09T03:05:00-07:00').parseZone(); - m.hour(0); - assert.equal(m.format(), '2014-03-09T00:05:00-08:00', 'hour across +1'); - - moment.updateOffset = oldUpdateOffset; - }); - - test('setters across DST -1', function (assert) { - var oldUpdateOffset = moment.updateOffset, - // Based on a real story somewhere in America/Los_Angeles - dstAt = moment('2014-11-02T02:00:00-07:00').parseZone(), - m; - - moment.updateOffset = function (mom, keepTime) { - if (mom.isBefore(dstAt)) { - mom.utcOffset(-7, keepTime); - } else { - mom.utcOffset(-8, keepTime); - } - }; - - m = moment('2014-11-15T00:00:00-08:00').parseZone(); - m.year(2013); - assert.equal(m.format(), '2013-11-15T00:00:00-07:00', 'year across -1'); - - m = moment('2014-11-15T00:00:00-08:00').parseZone(); - m.month(0); - assert.equal(m.format(), '2014-01-15T00:00:00-07:00', 'month across -1'); - - m = moment('2014-11-15T00:00:00-08:00').parseZone(); - m.date(1); - assert.equal(m.format(), '2014-11-01T00:00:00-07:00', 'date across -1'); - - m = moment('2014-11-02T03:30:00-08:00').parseZone(); - m.hour(0); - assert.equal(m.format(), '2014-11-02T00:30:00-07:00', 'hour across -1'); - - moment.updateOffset = oldUpdateOffset; - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('instanceof'); - - test('instanceof', function (assert) { - var mm = moment([2010, 0, 1]); - - var extend = function (a, b) { - var i; - for (i in b) { - a[i] = b[i]; - } - return a; - }; - - assert.equal(moment() instanceof moment, true, 'simple moment object'); - assert.equal(extend({}, moment()) instanceof moment, false, 'extended moment object'); - assert.equal(moment(null) instanceof moment, true, 'invalid moment object'); - - assert.equal(new Date() instanceof moment, false, 'date object is not moment object'); - assert.equal(Object instanceof moment, false, 'Object is not moment object'); - assert.equal('foo' instanceof moment, false, 'string is not moment object'); - assert.equal(1 instanceof moment, false, 'number is not moment object'); - assert.equal(NaN instanceof moment, false, 'NaN is not moment object'); - assert.equal(null instanceof moment, false, 'null is not moment object'); - assert.equal(undefined instanceof moment, false, 'undefined is not moment object'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('invalid'); - - test('invalid', function (assert) { - var m = moment.invalid(); - assert.equal(m.isValid(), false); - assert.equal(m.parsingFlags().userInvalidated, true); - assert.ok(isNaN(m.valueOf())); - }); - - test('invalid with existing flag', function (assert) { - var m = moment.invalid({invalidMonth : 'whatchamacallit'}); - assert.equal(m.isValid(), false); - assert.equal(m.parsingFlags().userInvalidated, false); - assert.equal(m.parsingFlags().invalidMonth, 'whatchamacallit'); - assert.ok(isNaN(m.valueOf())); - }); - - test('invalid with custom flag', function (assert) { - var m = moment.invalid({tooBusyWith : 'reiculating splines'}); - assert.equal(m.isValid(), false); - assert.equal(m.parsingFlags().userInvalidated, false); - assert.equal(m.parsingFlags().tooBusyWith, 'reiculating splines'); - assert.ok(isNaN(m.valueOf())); - }); - - test('invalid operations', function (assert) { - var invalids = [ - moment.invalid(), - moment('xyz', 'l'), - moment('2015-01-35', 'YYYY-MM-DD'), - moment('2015-01-25 a', 'YYYY-MM-DD', true) - ], - i, - invalid, - valid = moment(); - - test.expectedDeprecations('moment().min', 'moment().max'); - - for (i = 0; i < invalids.length; ++i) { - invalid = invalids[i]; - - assert.ok(!invalid.clone().add(5, 'hours').isValid(), 'invalid.add is invalid'); - assert.equal(invalid.calendar(), 'Invalid date', 'invalid.calendar is \'Invalid date\''); - assert.ok(!invalid.clone().isValid(), 'invalid.clone is invalid'); - assert.ok(isNaN(invalid.diff(valid)), 'invalid.diff(valid) is NaN'); - assert.ok(isNaN(valid.diff(invalid)), 'valid.diff(invalid) is NaN'); - assert.ok(isNaN(invalid.diff(invalid)), 'invalid.diff(invalid) is NaN'); - assert.ok(!invalid.clone().endOf('month').isValid(), 'invalid.endOf is invalid'); - assert.equal(invalid.format(), 'Invalid date', 'invalid.format is \'Invalid date\''); - assert.equal(invalid.from(), 'Invalid date'); - assert.equal(invalid.from(valid), 'Invalid date'); - assert.equal(valid.from(invalid), 'Invalid date'); - assert.equal(invalid.fromNow(), 'Invalid date'); - assert.equal(invalid.to(), 'Invalid date'); - assert.equal(invalid.to(valid), 'Invalid date'); - assert.equal(valid.to(invalid), 'Invalid date'); - assert.equal(invalid.toNow(), 'Invalid date'); - assert.ok(isNaN(invalid.get('year')), 'invalid.get is NaN'); - // TODO invalidAt - assert.ok(!invalid.isAfter(valid)); - assert.ok(!valid.isAfter(invalid)); - assert.ok(!invalid.isAfter(invalid)); - assert.ok(!invalid.isBefore(valid)); - assert.ok(!valid.isBefore(invalid)); - assert.ok(!invalid.isBefore(invalid)); - assert.ok(!invalid.isBetween(valid, valid)); - assert.ok(!valid.isBetween(invalid, valid)); - assert.ok(!valid.isBetween(valid, invalid)); - assert.ok(!invalid.isSame(invalid)); - assert.ok(!invalid.isSame(valid)); - assert.ok(!valid.isSame(invalid)); - assert.ok(!invalid.isValid()); - assert.equal(invalid.locale(), 'en'); - assert.equal(invalid.localeData()._abbr, 'en'); - assert.ok(!invalid.clone().max(valid).isValid()); - assert.ok(!valid.clone().max(invalid).isValid()); - assert.ok(!invalid.clone().max(invalid).isValid()); - assert.ok(!invalid.clone().min(valid).isValid()); - assert.ok(!valid.clone().min(invalid).isValid()); - assert.ok(!invalid.clone().min(invalid).isValid()); - assert.ok(!moment.min(invalid, valid).isValid()); - assert.ok(!moment.min(valid, invalid).isValid()); - assert.ok(!moment.max(invalid, valid).isValid()); - assert.ok(!moment.max(valid, invalid).isValid()); - assert.ok(!invalid.clone().set('year', 2005).isValid()); - assert.ok(!invalid.clone().startOf('month').isValid()); - - assert.ok(!invalid.clone().subtract(5, 'days').isValid()); - assert.deepEqual(invalid.toArray(), [NaN, NaN, NaN, NaN, NaN, NaN, NaN]); - assert.deepEqual(invalid.toObject(), { - years: NaN, - months: NaN, - date: NaN, - hours: NaN, - minutes: NaN, - seconds: NaN, - milliseconds: NaN - }); - assert.ok(moment.isDate(invalid.toDate())); - assert.ok(isNaN(invalid.toDate().valueOf())); - assert.equal(invalid.toJSON(), null); - assert.equal(invalid.toString(), 'Invalid date'); - assert.ok(isNaN(invalid.unix())); - assert.ok(isNaN(invalid.valueOf())); - - assert.ok(isNaN(invalid.year())); - assert.ok(isNaN(invalid.weekYear())); - assert.ok(isNaN(invalid.isoWeekYear())); - assert.ok(isNaN(invalid.quarter())); - assert.ok(isNaN(invalid.quarters())); - assert.ok(isNaN(invalid.month())); - assert.ok(isNaN(invalid.daysInMonth())); - assert.ok(isNaN(invalid.week())); - assert.ok(isNaN(invalid.weeks())); - assert.ok(isNaN(invalid.isoWeek())); - assert.ok(isNaN(invalid.isoWeeks())); - assert.ok(isNaN(invalid.weeksInYear())); - assert.ok(isNaN(invalid.isoWeeksInYear())); - assert.ok(isNaN(invalid.date())); - assert.ok(isNaN(invalid.day())); - assert.ok(isNaN(invalid.days())); - assert.ok(isNaN(invalid.weekday())); - assert.ok(isNaN(invalid.isoWeekday())); - assert.ok(isNaN(invalid.dayOfYear())); - assert.ok(isNaN(invalid.hour())); - assert.ok(isNaN(invalid.hours())); - assert.ok(isNaN(invalid.minute())); - assert.ok(isNaN(invalid.minutes())); - assert.ok(isNaN(invalid.second())); - assert.ok(isNaN(invalid.seconds())); - assert.ok(isNaN(invalid.millisecond())); - assert.ok(isNaN(invalid.milliseconds())); - assert.ok(isNaN(invalid.utcOffset())); - - assert.ok(!invalid.clone().year(2001).isValid()); - assert.ok(!invalid.clone().weekYear(2001).isValid()); - assert.ok(!invalid.clone().isoWeekYear(2001).isValid()); - assert.ok(!invalid.clone().quarter(1).isValid()); - assert.ok(!invalid.clone().quarters(1).isValid()); - assert.ok(!invalid.clone().month(1).isValid()); - assert.ok(!invalid.clone().week(1).isValid()); - assert.ok(!invalid.clone().weeks(1).isValid()); - assert.ok(!invalid.clone().isoWeek(1).isValid()); - assert.ok(!invalid.clone().isoWeeks(1).isValid()); - assert.ok(!invalid.clone().date(1).isValid()); - assert.ok(!invalid.clone().day(1).isValid()); - assert.ok(!invalid.clone().days(1).isValid()); - assert.ok(!invalid.clone().weekday(1).isValid()); - assert.ok(!invalid.clone().isoWeekday(1).isValid()); - assert.ok(!invalid.clone().dayOfYear(1).isValid()); - assert.ok(!invalid.clone().hour(1).isValid()); - assert.ok(!invalid.clone().hours(1).isValid()); - assert.ok(!invalid.clone().minute(1).isValid()); - assert.ok(!invalid.clone().minutes(1).isValid()); - assert.ok(!invalid.clone().second(1).isValid()); - assert.ok(!invalid.clone().seconds(1).isValid()); - assert.ok(!invalid.clone().millisecond(1).isValid()); - assert.ok(!invalid.clone().milliseconds(1).isValid()); - assert.ok(!invalid.clone().utcOffset(1).isValid()); - - assert.ok(!invalid.clone().utc().isValid()); - assert.ok(!invalid.clone().local().isValid()); - assert.ok(!invalid.clone().parseZone('05:30').isValid()); - assert.ok(!invalid.hasAlignedHourOffset()); - assert.ok(!invalid.isDST()); - assert.ok(!invalid.isDSTShifted()); - assert.ok(!invalid.isLocal()); - assert.ok(!invalid.isUtcOffset()); - assert.ok(!invalid.isUtc()); - assert.ok(!invalid.isUTC()); - - assert.ok(!invalid.isLeapYear()); - - assert.equal(moment.duration({from: invalid, to: valid}).asMilliseconds(), 0); - assert.equal(moment.duration({from: valid, to: invalid}).asMilliseconds(), 0); - assert.equal(moment.duration({from: invalid, to: invalid}).asMilliseconds(), 0); - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is after'); - - test('is after without units', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2012, 3, 2, 3, 5, 5, 10))), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 3, 5, 10))), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 4, 2, 3, 4, 5, 10))), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 2, 3, 4, 5, 10))), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 5, 10))), false, 'day is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 3, 4, 5, 10))), true, 'day is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 5, 10))), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 5, 10))), true, 'hour is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 5, 10))), false, 'minute is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 5, 10))), true, 'minute is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 10))), false, 'second is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 11))), true, 'second is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'millisecond match'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 11))), false, 'millisecond is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 9))), true, 'millisecond is earlier'); - assert.equal(m.isAfter(m), false, 'moments are not after themselves'); - assert.equal(+m, +mCopy, 'isAfter second should not change moment'); - }); - - test('is after year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year match'); - assert.equal(m.isAfter(moment(new Date(2010, 5, 6, 7, 8, 9, 10)), 'years'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2013, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 0, 1, 0, 0, 0, 0)), 'year'), false, 'exact start of year'); - assert.equal(m.isAfter(moment(new Date(2011, 11, 31, 23, 59, 59, 999)), 'year'), false, 'exact end of year'); - assert.equal(m.isAfter(moment(new Date(2012, 0, 1, 0, 0, 0, 0)), 'year'), false, 'start of next year'); - assert.equal(m.isAfter(moment(new Date(2010, 11, 31, 23, 59, 59, 999)), 'year'), true, 'end of previous year'); - assert.equal(m.isAfter(moment(new Date(1980, 11, 31, 23, 59, 59, 999)), 'year'), true, 'end of year far before'); - assert.equal(m.isAfter(m, 'year'), false, 'same moments are not after the same year'); - assert.equal(+m, +mCopy, 'isAfter year should not change moment'); - }); - - test('is after month', function (assert) { - var m = moment(new Date(2011, 2, 3, 4, 5, 6, 7)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'month'), false, 'month match'); - assert.equal(m.isAfter(moment(new Date(2010, 2, 6, 7, 8, 9, 10)), 'months'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2012, 2, 6, 7, 8, 9, 10)), 'month'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 2, 6, 7, 8, 9, 10)), 'month'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'month'), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 1, 6, 7, 8, 9, 10)), 'month'), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 1, 0, 0, 0, 0)), 'month'), false, 'exact start of month'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 31, 23, 59, 59, 999)), 'month'), false, 'exact end of month'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 0, 0, 0, 0)), 'month'), false, 'start of next month'); - assert.equal(m.isAfter(moment(new Date(2011, 1, 27, 23, 59, 59, 999)), 'month'), true, 'end of previous month'); - assert.equal(m.isAfter(moment(new Date(2010, 12, 31, 23, 59, 59, 999)), 'month'), true, 'later month but earlier year'); - assert.equal(m.isAfter(m, 'month'), false, 'same moments are not after the same month'); - assert.equal(+m, +mCopy, 'isAfter month should not change moment'); - }); - - test('is after day', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 7, 8, 9, 10)), 'day'), false, 'day match'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 7, 8, 9, 10)), 'days'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2012, 3, 2, 7, 8, 9, 10)), 'day'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 7, 8, 9, 10)), 'day'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 4, 2, 7, 8, 9, 10)), 'day'), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 2, 7, 8, 9, 10)), 'day'), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 7, 8, 9, 10)), 'day'), false, 'day is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 7, 8, 9, 10)), 'day'), true, 'day is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 0, 0, 0, 0)), 'day'), false, 'exact start of day'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 23, 59, 59, 999)), 'day'), false, 'exact end of day'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 0, 0, 0, 0)), 'day'), false, 'start of next day'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 23, 59, 59, 999)), 'day'), true, 'end of previous day'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 10, 0, 0, 0, 0)), 'day'), true, 'later day but earlier year'); - assert.equal(m.isAfter(m, 'day'), false, 'same moments are not after the same day'); - assert.equal(+m, +mCopy, 'isAfter day should not change moment'); - }); - - test('is after hour', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 8, 9, 10)), 'hour'), false, 'hour match'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 8, 9, 10)), 'hours'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2012, 3, 2, 3, 8, 9, 10)), 'hour'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 8, 9, 10)), 'hour'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 4, 2, 3, 8, 9, 10)), 'hour'), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hour'), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 8, 9, 10)), 'hour'), false, 'day is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 3, 8, 9, 10)), 'hour'), true, 'day is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 8, 9, 10)), 'hour'), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 8, 9, 10)), 'hour'), false, 'hour is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 0, 0, 0)), 'hour'), false, 'exact start of hour'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 59, 59, 999)), 'hour'), false, 'exact end of hour'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 0, 0, 0)), 'hour'), false, 'start of next hour'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 59, 59, 999)), 'hour'), true, 'end of previous hour'); - assert.equal(m.isAfter(m, 'hour'), false, 'same moments are not after the same hour'); - assert.equal(+m, +mCopy, 'isAfter hour should not change moment'); - }); - - test('is after minute', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 9, 10)), 'minute'), false, 'minute match'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 4, 9, 10)), 'minutes'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2012, 3, 2, 3, 4, 9, 10)), 'minute'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 4, 9, 10)), 'minute'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 4, 2, 3, 4, 9, 10)), 'minute'), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 2, 3, 4, 9, 10)), 'minute'), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), false, 'day is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), true, 'day is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earler'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), false, 'minute is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), true, 'minute is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 59, 999)), 'minute'), false, 'exact end of minute'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 0, 0)), 'minute'), false, 'start of next minute'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 59, 999)), 'minute'), true, 'end of previous minute'); - assert.equal(m.isAfter(m, 'minute'), false, 'same moments are not after the same minute'); - assert.equal(+m, +mCopy, 'isAfter minute should not change moment'); - }); - - test('is after second', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'second'), false, 'second match'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'seconds'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'second'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'second'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'second'), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'second'), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'second'), false, 'day is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'second'), true, 'day is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'second'), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'second'), true, 'hour is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'second'), false, 'minute is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'second'), true, 'minute is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'second'), false, 'second is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'second'), true, 'second is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 0)), 'second'), false, 'exact start of second'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 999)), 'second'), false, 'exact end of second'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 0)), 'second'), false, 'start of next second'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 999)), 'second'), true, 'end of previous second'); - assert.equal(m.isAfter(m, 'second'), false, 'same moments are not after the same second'); - assert.equal(+m, +mCopy, 'isAfter second should not change moment'); - }); - - test('is after millisecond', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'millisecond match'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'plural should work'); - assert.equal(m.isAfter(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'year is later'); - assert.equal(m.isAfter(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'year is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'millisecond'), false, 'month is later'); - assert.equal(m.isAfter(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'millisecond'), true, 'month is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'millisecond'), false, 'day is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'millisecond'), true, 'day is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'millisecond'), false, 'hour is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'millisecond'), true, 'hour is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'millisecond'), false, 'minute is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'millisecond'), true, 'minute is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'millisecond'), false, 'second is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'millisecond'), true, 'second is earlier'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 11)), 'millisecond'), false, 'millisecond is later'); - assert.equal(m.isAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 9)), 'millisecond'), true, 'millisecond is earlier'); - assert.equal(m.isAfter(m, 'millisecond'), false, 'same moments are not after the same millisecond'); - assert.equal(+m, +mCopy, 'isAfter millisecond should not change moment'); - }); - - test('is after invalid', function (assert) { - var m = moment(), invalid = moment.invalid(); - assert.equal(m.isAfter(invalid), false, 'valid moment is not after invalid moment'); - assert.equal(invalid.isAfter(m), false, 'invalid moment is not after valid moment'); - assert.equal(m.isAfter(invalid, 'year'), false, 'invalid moment year'); - assert.equal(m.isAfter(invalid, 'month'), false, 'invalid moment month'); - assert.equal(m.isAfter(invalid, 'day'), false, 'invalid moment day'); - assert.equal(m.isAfter(invalid, 'hour'), false, 'invalid moment hour'); - assert.equal(m.isAfter(invalid, 'minute'), false, 'invalid moment minute'); - assert.equal(m.isAfter(invalid, 'second'), false, 'invalid moment second'); - assert.equal(m.isAfter(invalid, 'milliseconds'), false, 'invalid moment milliseconds'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } - - test('isArray recognizes Array objects', function (assert) { - assert.ok(isArray([1,2,3]), 'array args'); - assert.ok(isArray([]), 'empty array'); - assert.ok(isArray(new Array(1,2,3)), 'array constructor'); - }); - - test('isArray rejects non-Array objects', function (assert) { - assert.ok(!isArray(), 'nothing'); - assert.ok(!isArray(undefined), 'undefined'); - assert.ok(!isArray(null), 'null'); - assert.ok(!isArray(123), 'number'); - assert.ok(!isArray('[1,2,3]'), 'string'); - assert.ok(!isArray(new Date()), 'date'); - assert.ok(!isArray({a:1,b:2}), 'object'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is before'); - - test('is after without units', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 5, 5, 10))), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 3, 3, 5, 10))), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 4, 2, 3, 4, 5, 10))), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 2, 3, 4, 5, 10))), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 5, 10))), true, 'day is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 3, 4, 5, 10))), false, 'day is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 5, 10))), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 5, 10))), false, 'hour is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 5, 10))), true, 'minute is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 5, 10))), false, 'minute is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 10))), true, 'second is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 11))), false, 'second is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'millisecond match'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 11))), true, 'millisecond is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 9))), false, 'millisecond is earlier'); - assert.equal(m.isBefore(m), false, 'moments are not before themselves'); - assert.equal(+m, +mCopy, 'isBefore second should not change moment'); - }); - - test('is before year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year match'); - assert.equal(m.isBefore(moment(new Date(2012, 5, 6, 7, 8, 9, 10)), 'years'), true, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2013, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 0, 1, 0, 0, 0, 0)), 'year'), false, 'exact start of year'); - assert.equal(m.isBefore(moment(new Date(2011, 11, 31, 23, 59, 59, 999)), 'year'), false, 'exact end of year'); - assert.equal(m.isBefore(moment(new Date(2012, 0, 1, 0, 0, 0, 0)), 'year'), true, 'start of next year'); - assert.equal(m.isBefore(moment(new Date(2010, 11, 31, 23, 59, 59, 999)), 'year'), false, 'end of previous year'); - assert.equal(m.isBefore(moment(new Date(1980, 11, 31, 23, 59, 59, 999)), 'year'), false, 'end of year far before'); - assert.equal(m.isBefore(m, 'year'), false, 'same moments are not before the same year'); - assert.equal(+m, +mCopy, 'isBefore year should not change moment'); - }); - - test('is before month', function (assert) { - var m = moment(new Date(2011, 2, 3, 4, 5, 6, 7)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'month'), false, 'month match'); - assert.equal(m.isBefore(moment(new Date(2012, 2, 6, 7, 8, 9, 10)), 'months'), true, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2012, 2, 6, 7, 8, 9, 10)), 'month'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 2, 6, 7, 8, 9, 10)), 'month'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'month'), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 1, 6, 7, 8, 9, 10)), 'month'), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 1, 0, 0, 0, 0)), 'month'), false, 'exact start of month'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 31, 23, 59, 59, 999)), 'month'), false, 'exact end of month'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 0, 0, 0, 0)), 'month'), true, 'start of next month'); - assert.equal(m.isBefore(moment(new Date(2011, 1, 27, 23, 59, 59, 999)), 'month'), false, 'end of previous month'); - assert.equal(m.isBefore(moment(new Date(2010, 12, 31, 23, 59, 59, 999)), 'month'), false, 'later month but earlier year'); - assert.equal(m.isBefore(m, 'month'), false, 'same moments are not before the same month'); - assert.equal(+m, +mCopy, 'isBefore month should not change moment'); - }); - - test('is before day', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 7, 8, 9, 10)), 'day'), false, 'day match'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 7, 8, 9, 10)), 'days'), true, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 7, 8, 9, 10)), 'day'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 7, 8, 9, 10)), 'day'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 4, 2, 7, 8, 9, 10)), 'day'), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 2, 7, 8, 9, 10)), 'day'), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 7, 8, 9, 10)), 'day'), true, 'day is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 7, 8, 9, 10)), 'day'), false, 'day is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 0, 0, 0, 0)), 'day'), false, 'exact start of day'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 23, 59, 59, 999)), 'day'), false, 'exact end of day'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 0, 0, 0, 0)), 'day'), true, 'start of next day'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 23, 59, 59, 999)), 'day'), false, 'end of previous day'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 10, 0, 0, 0, 0)), 'day'), false, 'later day but earlier year'); - assert.equal(m.isBefore(m, 'day'), false, 'same moments are not before the same day'); - assert.equal(+m, +mCopy, 'isBefore day should not change moment'); - }); - - test('is before hour', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 8, 9, 10)), 'hour'), false, 'hour match'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 8, 9, 10)), 'hours'), true, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 8, 9, 10)), 'hour'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 3, 8, 9, 10)), 'hour'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 4, 2, 3, 8, 9, 10)), 'hour'), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hour'), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 8, 9, 10)), 'hour'), true, 'day is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 3, 8, 9, 10)), 'hour'), false, 'day is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 8, 9, 10)), 'hour'), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 8, 9, 10)), 'hour'), false, 'hour is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 0, 0, 0)), 'hour'), false, 'exact start of hour'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 59, 59, 999)), 'hour'), false, 'exact end of hour'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 0, 0, 0)), 'hour'), true, 'start of next hour'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 59, 59, 999)), 'hour'), false, 'end of previous hour'); - assert.equal(m.isBefore(m, 'hour'), false, 'same moments are not before the same hour'); - assert.equal(+m, +mCopy, 'isBefore hour should not change moment'); - }); - - test('is before minute', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 9, 10)), 'minute'), false, 'minute match'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 4, 9, 10)), 'minutes'), true, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 4, 9, 10)), 'minute'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 3, 4, 9, 10)), 'minute'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 4, 2, 3, 4, 9, 10)), 'minute'), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 2, 3, 4, 9, 10)), 'minute'), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 9, 10)), 'minute'), true, 'day is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 3, 4, 9, 10)), 'minute'), false, 'day is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 9, 10)), 'minute'), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earler'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 9, 10)), 'minute'), true, 'minute is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 9, 10)), 'minute'), false, 'minute is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 0, 0)), 'minute'), false, 'exact start of minute'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 59, 999)), 'minute'), false, 'exact end of minute'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 0, 0)), 'minute'), true, 'start of next minute'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 59, 999)), 'minute'), false, 'end of previous minute'); - assert.equal(m.isBefore(m, 'minute'), false, 'same moments are not before the same minute'); - assert.equal(+m, +mCopy, 'isBefore minute should not change moment'); - }); - - test('is before second', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'second'), false, 'second match'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'seconds'), true, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'second'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'second'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'second'), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'second'), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'second'), true, 'day is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'second'), false, 'day is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'second'), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'second'), false, 'hour is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'second'), true, 'minute is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'second'), false, 'minute is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'second'), true, 'second is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'second'), false, 'second is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 0)), 'second'), false, 'exact start of second'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 999)), 'second'), false, 'exact end of second'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 0)), 'second'), true, 'start of next second'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 999)), 'second'), false, 'end of previous second'); - assert.equal(m.isBefore(m, 'second'), false, 'same moments are not before the same second'); - assert.equal(+m, +mCopy, 'isBefore second should not change moment'); - }); - - test('is before millisecond', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'millisecond match'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds'), false, 'plural should work'); - assert.equal(m.isBefore(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'year is later'); - assert.equal(m.isBefore(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'year is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'millisecond'), true, 'month is later'); - assert.equal(m.isBefore(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'millisecond'), false, 'month is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'millisecond'), true, 'day is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'millisecond'), false, 'day is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'millisecond'), true, 'hour is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'millisecond'), false, 'hour is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'millisecond'), true, 'minute is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'millisecond'), false, 'minute is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'millisecond'), true, 'second is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'millisecond'), false, 'second is earlier'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 11)), 'millisecond'), true, 'millisecond is later'); - assert.equal(m.isBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 9)), 'millisecond'), false, 'millisecond is earlier'); - assert.equal(m.isBefore(m, 'millisecond'), false, 'same moments are not before the same millisecond'); - assert.equal(+m, +mCopy, 'isBefore millisecond should not change moment'); - }); - - test('is before invalid', function (assert) { - var m = moment(), invalid = moment.invalid(); - assert.equal(m.isBefore(invalid), false, 'valid moment is not before invalid moment'); - assert.equal(invalid.isBefore(m), false, 'invalid moment is not before valid moment'); - assert.equal(m.isBefore(invalid, 'year'), false, 'invalid moment year'); - assert.equal(m.isBefore(invalid, 'month'), false, 'invalid moment month'); - assert.equal(m.isBefore(invalid, 'day'), false, 'invalid moment day'); - assert.equal(m.isBefore(invalid, 'hour'), false, 'invalid moment hour'); - assert.equal(m.isBefore(invalid, 'minute'), false, 'invalid moment minute'); - assert.equal(m.isBefore(invalid, 'second'), false, 'invalid moment second'); - assert.equal(m.isBefore(invalid, 'milliseconds'), false, 'invalid moment milliseconds'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is between'); - - test('is between without units', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'year is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2013, 3, 2, 3, 4, 5, 10))), false, 'year is earlier'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10))), true, 'year is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'month is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 5, 2, 3, 4, 5, 10))), false, 'month is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 2, 2, 3, 4, 5, 10)), - moment(new Date(2011, 4, 2, 3, 4, 5, 10))), true, 'month is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 1, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'day is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 4, 3, 4, 5, 10))), false, 'day is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 1, 3, 4, 5, 10)), - moment(new Date(2011, 3, 3, 3, 4, 5, 10))), true, 'day is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 1, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'hour is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 5, 4, 5, 10))), false, 'hour is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 2, 4, 5, 10)), - moment(new Date(2011, 3, 2, 4, 4, 5, 10))), true, 'hour is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 6, 5, 10))), false, 'minute is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 2, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'minute is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 3, 5, 10)), - moment(new Date(2011, 3, 2, 3, 5, 5, 10))), true, 'minute is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 7, 10))), false, 'second is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 3, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'second is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 4, 10)), - moment(new Date(2011, 3, 2, 3, 4, 6, 10))), true, 'second is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 12))), false, 'millisecond is later'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 8)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10))), false, 'millisecond is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 9)), - moment(new Date(2011, 3, 2, 3, 4, 5, 11))), true, 'millisecond is between'); - assert.equal(m.isBetween(m, m), false, 'moments are not between themselves'); - assert.equal(+m, +mCopy, 'isBetween second should not change moment'); - }); - - test('is between without units inclusivity', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, start is equal to moment'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, end is equal to moment'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '()'), true, 'start and end are excluded, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '()'), false, 'start and end are excluded, should fail on same start/end date.'); - - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '(]'), false, 'start is excluded and end is included should fail on same start date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '(]'), true, 'start is excluded and end is included should succeed on end date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '(]'), true, 'start is excluded and end is included, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '(]'), false, 'start is excluded and end is included, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '(]'), false, 'start is excluded and end is included, should fail on same start/end date.'); - - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[)'), true, 'start is included and end is excluded should succeed on same start date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[)'), false, 'start is included and end is excluded should fail on same end date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[)'), true, 'start is included and end is excluded, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '[)'), false, 'start is included and end is excluded, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[)'), false, 'start is included and end is excluded, should fail on same end and start date'); - - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive should succeed on same start date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive should succeed on same end date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), null, '[]'), false, 'start and end inclusive, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), null, '[]'), true, 'start and end inclusive, should handle same end and start date'); - }); - - test('is between milliseconds inclusivity', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'options, no inclusive'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, start is equal to moment'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, end is equal to moment'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), true, 'start and end are excluded, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '()'), false, 'start and end are excluded, should fail on same start/end date.'); - - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), false, 'start is excluded and end is included should fail on same start date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), true, 'start is excluded and end is included should succeed on end date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), true, 'start is excluded and end is included, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), false, 'start is excluded and end is included, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '(]'), false, 'start is excluded and end is included, should fail on same start/end date.'); - - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), true, 'start is included and end is excluded should succeed on same start date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), false, 'start is included and end is excluded should fail on same end date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), true, 'start is included and end is excluded, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), false, 'start is included and end is excluded, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[)'), false, 'start is included and end is excluded, should fail on same end and start date'); - - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive should succeed on same start date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive should succeed on same end date'); - assert.equal(m.isBetween( - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), - moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive, is between'); - assert.equal(m.isBetween( - moment(new Date(2009, 3, 2, 3, 4, 5, 10)), - moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), false, 'start and end inclusive, is not between'); - assert.equal(m.isBetween( - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), - moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds', '[]'), true, 'start and end inclusive, should handle same end and start date'); - }); - - test('is between year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 5, 6, 7, 8, 9, 10)), - moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year match'); - assert.equal(m.isBetween( - moment(new Date(2010, 5, 6, 7, 8, 9, 10)), - moment(new Date(2012, 5, 6, 7, 8, 9, 10)), 'years'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2010, 5, 6, 7, 8, 9, 10)), - moment(new Date(2012, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 5, 6, 7, 8, 9, 10)), - moment(new Date(2013, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year is earlier'); - assert.equal(m.isBetween( - moment(new Date(2010, 5, 6, 7, 8, 9, 10)), - moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year is later'); - assert.equal(m.isBetween(m, 'year'), false, 'same moments are not between the same year'); - assert.equal(+m, +mCopy, 'isBetween year should not change moment'); - }); - - test('is between month', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 6, 7, 8, 9, 10)), - moment(new Date(2011, 1, 6, 7, 8, 9, 10)), 'month'), false, 'month match'); - assert.equal(m.isBetween( - moment(new Date(2011, 0, 6, 7, 8, 9, 10)), - moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'months'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2011, 0, 31, 23, 59, 59, 999)), - moment(new Date(2011, 2, 1, 0, 0, 0, 0)), 'month'), true, 'month is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 6, 7, 8, 9, 10)), - moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'month'), false, 'month is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 11, 6, 7, 8, 9, 10)), - moment(new Date(2011, 1, 6, 7, 8, 9, 10)), 'month'), false, 'month is later'); - assert.equal(m.isBetween(m, 'month'), false, 'same moments are not between the same month'); - assert.equal(+m, +mCopy, 'isBetween month should not change moment'); - }); - - test('is between day', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'day'), false, 'day match'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 1, 7, 8, 9, 10)), - moment(new Date(2011, 1, 3, 7, 8, 9, 10)), 'days'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 1, 7, 8, 9, 10)), - moment(new Date(2011, 1, 3, 7, 8, 9, 10)), 'day'), true, 'day is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), - moment(new Date(2011, 1, 4, 7, 8, 9, 10)), 'day'), false, 'day is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 1, 7, 8, 9, 10)), - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'day'), false, 'day is later'); - assert.equal(m.isBetween(m, 'day'), false, 'same moments are not between the same day'); - assert.equal(+m, +mCopy, 'isBetween day should not change moment'); - }); - - test('is between hour', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 5, 9, 10)), - moment(new Date(2011, 1, 2, 3, 9, 9, 10)), 'hour'), false, 'hour match'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 1, 59, 59, 999)), - moment(new Date(2011, 1, 2, 4, 0, 0, 0)), 'hours'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 2, 59, 59, 999)), - moment(new Date(2011, 1, 2, 4, 0, 0, 0)), 'hour'), true, 'hour is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'hour'), false, 'hour is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), - moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'hour'), false, 'hour is later'); - assert.equal(m.isBetween(m, 'hour'), false, 'same moments are not between the same hour'); - assert.equal(+m, +mCopy, 'isBetween hour should not change moment'); - }); - - test('is between minute', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 9, 10)), - moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minute'), false, 'minute match'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 3, 9, 10)), - moment(new Date(2011, 1, 2, 3, 5, 9, 10)), 'minutes'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 3, 59, 999)), - moment(new Date(2011, 1, 2, 3, 5, 0, 0)), 'minute'), true, 'minute is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 5, 0, 0)), - moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'minute'), false, 'minute is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 2, 9, 10)), - moment(new Date(2011, 1, 2, 3, 3, 59, 999)), 'minute'), false, 'minute is later'); - assert.equal(m.isBetween(m, 'minute'), false, 'same moments are not between the same minute'); - assert.equal(+m, +mCopy, 'isBetween minute should not change moment'); - }); - - test('is between second', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 10)), - moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'second'), false, 'second match'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 4, 10)), - moment(new Date(2011, 1, 2, 3, 4, 6, 10)), 'seconds'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 4, 999)), - moment(new Date(2011, 1, 2, 3, 4, 6, 0)), 'second'), true, 'second is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 6, 0)), - moment(new Date(2011, 1, 2, 3, 4, 7, 10)), 'second'), false, 'second is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 3, 10)), - moment(new Date(2011, 1, 2, 3, 4, 4, 999)), 'second'), false, 'second is later'); - assert.equal(m.isBetween(m, 'second'), false, 'same moments are not between the same second'); - assert.equal(+m, +mCopy, 'isBetween second should not change moment'); - }); - - test('is between millisecond', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 6)), - moment(new Date(2011, 1, 2, 3, 4, 5, 6)), 'millisecond'), false, 'millisecond match'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 5)), - moment(new Date(2011, 1, 2, 3, 4, 5, 7)), 'milliseconds'), true, 'plural should work'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 5)), - moment(new Date(2011, 1, 2, 3, 4, 5, 7)), 'millisecond'), true, 'millisecond is between'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 7)), - moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'millisecond'), false, 'millisecond is earlier'); - assert.equal(m.isBetween( - moment(new Date(2011, 1, 2, 3, 4, 5, 4)), - moment(new Date(2011, 1, 2, 3, 4, 5, 6)), 'millisecond'), false, 'millisecond is later'); - assert.equal(m.isBetween(m, 'millisecond'), false, 'same moments are not between the same millisecond'); - assert.equal(+m, +mCopy, 'isBetween millisecond should not change moment'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is date'); - - test('isDate recognizes Date objects', function (assert) { - assert.ok(moment.isDate(new Date()), 'no args (now)'); - assert.ok(moment.isDate(new Date([2014, 2, 15])), 'array args'); - assert.ok(moment.isDate(new Date('2014-03-15')), 'string args'); - assert.ok(moment.isDate(new Date('does NOT look like a date')), 'invalid date'); - }); - - test('isDate rejects non-Date objects', function (assert) { - assert.ok(!moment.isDate(), 'nothing'); - assert.ok(!moment.isDate(undefined), 'undefined'); - assert.ok(!moment.isDate(null), 'string args'); - assert.ok(!moment.isDate(42), 'number'); - assert.ok(!moment.isDate('2014-03-15'), 'string'); - assert.ok(!moment.isDate([2014, 2, 15]), 'array'); - assert.ok(!moment.isDate({year: 2014, month: 2, day: 15}), 'object'); - assert.ok(!moment.isDate({toString: function () { - return '[object Date]'; - }}), 'lying object'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is moment'); - - test('is moment object', function (assert) { - var MyObj = function () {}, - extend = function (a, b) { - var i; - for (i in b) { - a[i] = b[i]; - } - return a; - }; - MyObj.prototype.toDate = function () { - return new Date(); - }; - - assert.ok(moment.isMoment(moment()), 'simple moment object'); - assert.ok(moment.isMoment(moment(null)), 'invalid moment object'); - assert.ok(moment.isMoment(extend({}, moment())), 'externally cloned moments are moments'); - assert.ok(moment.isMoment(extend({}, moment.utc())), 'externally cloned utc moments are moments'); - - assert.ok(!moment.isMoment(new MyObj()), 'myObj is not moment object'); - assert.ok(!moment.isMoment(moment), 'moment function is not moment object'); - assert.ok(!moment.isMoment(new Date()), 'date object is not moment object'); - assert.ok(!moment.isMoment(Object), 'Object is not moment object'); - assert.ok(!moment.isMoment('foo'), 'string is not moment object'); - assert.ok(!moment.isMoment(1), 'number is not moment object'); - assert.ok(!moment.isMoment(NaN), 'NaN is not moment object'); - assert.ok(!moment.isMoment(null), 'null is not moment object'); - assert.ok(!moment.isMoment(undefined), 'undefined is not moment object'); - }); - - test('is moment with hacked hasOwnProperty', function (assert) { - var obj = {}; - // HACK to suppress jshint warning about bad property name - obj['hasOwnMoney'.replace('Money', 'Property')] = function () { - return true; - }; - - assert.ok(!moment.isMoment(obj), 'isMoment works even if passed object has a wrong hasOwnProperty implementation (ie8)'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is same'); - - test('is same without units', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2012, 3, 2, 3, 5, 5, 10))), false, 'year is later'); - assert.equal(m.isSame(moment(new Date(2010, 3, 2, 3, 3, 5, 10))), false, 'year is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 4, 2, 3, 4, 5, 10))), false, 'month is later'); - assert.equal(m.isSame(moment(new Date(2011, 2, 2, 3, 4, 5, 10))), false, 'month is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 3, 3, 4, 5, 10))), false, 'day is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 1, 3, 4, 5, 10))), false, 'day is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 4, 4, 5, 10))), false, 'hour is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 2, 4, 5, 10))), false, 'hour is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 5, 5, 10))), false, 'minute is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 3, 5, 10))), false, 'minute is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 6, 10))), false, 'second is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 4, 11))), false, 'second is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 5, 10))), true, 'millisecond match'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 5, 11))), false, 'millisecond is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 5, 9))), false, 'millisecond is earlier'); - assert.equal(m.isSame(m), true, 'moments are the same as themselves'); - assert.equal(+m, +mCopy, 'isSame second should not change moment'); - }); - - test('is same year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year match'); - assert.equal(m.isSame(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'years'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 0, 1, 0, 0, 0, 0)), 'year'), true, 'exact start of year'); - assert.equal(m.isSame(moment(new Date(2011, 11, 31, 23, 59, 59, 999)), 'year'), true, 'exact end of year'); - assert.equal(m.isSame(moment(new Date(2012, 0, 1, 0, 0, 0, 0)), 'year'), false, 'start of next year'); - assert.equal(m.isSame(moment(new Date(2010, 11, 31, 23, 59, 59, 999)), 'year'), false, 'end of previous year'); - assert.equal(m.isSame(m, 'year'), true, 'same moments are in the same year'); - assert.equal(+m, +mCopy, 'isSame year should not change moment'); - }); - - test('is same month', function (assert) { - var m = moment(new Date(2011, 2, 3, 4, 5, 6, 7)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'month'), true, 'month match'); - assert.equal(m.isSame(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'months'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 2, 6, 7, 8, 9, 10)), 'month'), false, 'year mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'month'), false, 'month mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 2, 1, 0, 0, 0, 0)), 'month'), true, 'exact start of month'); - assert.equal(m.isSame(moment(new Date(2011, 2, 31, 23, 59, 59, 999)), 'month'), true, 'exact end of month'); - assert.equal(m.isSame(moment(new Date(2011, 3, 1, 0, 0, 0, 0)), 'month'), false, 'start of next month'); - assert.equal(m.isSame(moment(new Date(2011, 1, 27, 23, 59, 59, 999)), 'month'), false, 'end of previous month'); - assert.equal(m.isSame(m, 'month'), true, 'same moments are in the same month'); - assert.equal(+m, +mCopy, 'isSame month should not change moment'); - }); - - test('is same day', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'day'), true, 'day match'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'days'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 1, 2, 7, 8, 9, 10)), 'day'), false, 'year mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 2, 2, 7, 8, 9, 10)), 'day'), false, 'month mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 3, 7, 8, 9, 10)), 'day'), false, 'day mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 0, 0, 0, 0)), 'day'), true, 'exact start of day'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 23, 59, 59, 999)), 'day'), true, 'exact end of day'); - assert.equal(m.isSame(moment(new Date(2011, 1, 3, 0, 0, 0, 0)), 'day'), false, 'start of next day'); - assert.equal(m.isSame(moment(new Date(2011, 1, 1, 23, 59, 59, 999)), 'day'), false, 'end of previous day'); - assert.equal(m.isSame(m, 'day'), true, 'same moments are in the same day'); - assert.equal(+m, +mCopy, 'isSame day should not change moment'); - }); - - test('is same hour', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hour'), true, 'hour match'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hours'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 1, 2, 3, 8, 9, 10)), 'hour'), false, 'year mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 2, 2, 3, 8, 9, 10)), 'hour'), false, 'month mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 3, 3, 8, 9, 10)), 'hour'), false, 'day mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 4, 8, 9, 10)), 'hour'), false, 'hour mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 0, 0, 0)), 'hour'), true, 'exact start of hour'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 59, 59, 999)), 'hour'), true, 'exact end of hour'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 4, 0, 0, 0)), 'hour'), false, 'start of next hour'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 2, 59, 59, 999)), 'hour'), false, 'end of previous hour'); - assert.equal(m.isSame(m, 'hour'), true, 'same moments are in the same hour'); - assert.equal(+m, +mCopy, 'isSame hour should not change moment'); - }); - - test('is same minute', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minute'), true, 'minute match'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minutes'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 1, 2, 3, 4, 9, 10)), 'minute'), false, 'year mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 2, 2, 3, 4, 9, 10)), 'minute'), false, 'month mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 3, 3, 4, 9, 10)), 'minute'), false, 'day mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 4, 4, 9, 10)), 'minute'), false, 'hour mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 5, 9, 10)), 'minute'), false, 'minute mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 0, 0)), 'minute'), true, 'exact start of minute'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 59, 999)), 'minute'), true, 'exact end of minute'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 5, 0, 0)), 'minute'), false, 'start of next minute'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 3, 59, 999)), 'minute'), false, 'end of previous minute'); - assert.equal(m.isSame(m, 'minute'), true, 'same moments are in the same minute'); - assert.equal(+m, +mCopy, 'isSame minute should not change moment'); - }); - - test('is same second', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'second'), true, 'second match'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'seconds'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 1, 2, 3, 4, 5, 10)), 'second'), false, 'year mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'second'), false, 'month mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 3, 3, 4, 5, 10)), 'second'), false, 'day mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 4, 4, 5, 10)), 'second'), false, 'hour mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 5, 5, 10)), 'second'), false, 'minute mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 6, 10)), 'second'), false, 'second mismatch'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 5, 0)), 'second'), true, 'exact start of second'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 5, 999)), 'second'), true, 'exact end of second'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 6, 0)), 'second'), false, 'start of next second'); - assert.equal(m.isSame(moment(new Date(2011, 1, 2, 3, 4, 4, 999)), 'second'), false, 'end of previous second'); - assert.equal(m.isSame(m, 'second'), true, 'same moments are in the same second'); - assert.equal(+m, +mCopy, 'isSame second should not change moment'); - }); - - test('is same millisecond', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'millisecond match'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'plural should work'); - assert.equal(m.isSame(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'year is later'); - assert.equal(m.isSame(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'year is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'millisecond'), false, 'month is later'); - assert.equal(m.isSame(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'millisecond'), false, 'month is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'millisecond'), false, 'day is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'millisecond'), false, 'day is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'millisecond'), false, 'hour is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'millisecond'), false, 'hour is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'millisecond'), false, 'minute is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'millisecond'), false, 'minute is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'millisecond'), false, 'second is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'millisecond'), false, 'second is earlier'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 6, 11)), 'millisecond'), false, 'millisecond is later'); - assert.equal(m.isSame(moment(new Date(2011, 3, 2, 3, 4, 4, 9)), 'millisecond'), false, 'millisecond is earlier'); - assert.equal(m.isSame(m, 'millisecond'), true, 'same moments are in the same millisecond'); - assert.equal(+m, +mCopy, 'isSame millisecond should not change moment'); - }); - - test('is same with utc offset moments', function (assert) { - assert.ok(moment.parseZone('2013-02-01T-05:00').isSame(moment('2013-02-01'), 'year'), 'zoned vs local moment'); - assert.ok(moment('2013-02-01').isSame(moment('2013-02-01').utcOffset('-05:00'), 'year'), 'local vs zoned moment'); - assert.ok(moment.parseZone('2013-02-01T-05:00').isSame(moment.parseZone('2013-02-01T-06:30'), 'year'), - 'zoned vs (differently) zoned moment'); - }); - - test('is same with invalid moments', function (assert) { - assert.equal(moment.invalid().isSame(moment.invalid()), false, 'invalid moments are not considered equal'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is same or after'); - - test('is same or after without units', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 3, 2, 3, 5, 5, 10))), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 3, 2, 3, 3, 5, 10))), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 4, 2, 3, 4, 5, 10))), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 2, 3, 4, 5, 10))), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 3, 3, 4, 5, 10))), false, 'day is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 1, 3, 4, 5, 10))), true, 'day is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 4, 4, 5, 10))), false, 'hour is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 2, 4, 5, 10))), true, 'hour is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 5, 5, 10))), false, 'minute is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 3, 5, 10))), true, 'minute is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 10))), false, 'second is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 11))), true, 'second is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 10))), true, 'millisecond match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 11))), false, 'millisecond is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 9))), true, 'millisecond is earlier'); - assert.equal(m.isSameOrAfter(m), true, 'moments are the same as themselves'); - assert.equal(+m, +mCopy, 'isSameOrAfter second should not change moment'); - }); - - test('is same or after year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'years'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 0, 1, 0, 0, 0, 0)), 'year'), true, 'exact start of year'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 11, 31, 23, 59, 59, 999)), 'year'), true, 'exact end of year'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 0, 1, 0, 0, 0, 0)), 'year'), false, 'start of next year'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 11, 31, 23, 59, 59, 999)), 'year'), true, 'end of previous year'); - assert.equal(m.isSameOrAfter(m, 'year'), true, 'same moments are in the same year'); - assert.equal(+m, +mCopy, 'isSameOrAfter year should not change moment'); - }); - - test('is same or after month', function (assert) { - var m = moment(new Date(2011, 2, 3, 4, 5, 6, 7)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'month'), true, 'month match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'months'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 2, 6, 7, 8, 9, 10)), 'month'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 2, 6, 7, 8, 9, 10)), 'month'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'month'), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 6, 7, 8, 9, 10)), 'month'), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 1, 0, 0, 0, 0)), 'month'), true, 'exact start of month'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 31, 23, 59, 59, 999)), 'month'), true, 'exact end of month'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 1, 0, 0, 0, 0)), 'month'), false, 'start of next month'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 27, 23, 59, 59, 999)), 'month'), true, 'end of previous month'); - assert.equal(m.isSameOrAfter(m, 'month'), true, 'same moments are in the same month'); - assert.equal(+m, +mCopy, 'isSameOrAfter month should not change moment'); - }); - - test('is same or after day', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'day'), true, 'day match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'days'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 1, 2, 7, 8, 9, 10)), 'day'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 1, 2, 7, 8, 9, 10)), 'day'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 2, 7, 8, 9, 10)), 'day'), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 12, 2, 7, 8, 9, 10)), 'day'), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 3, 7, 8, 9, 10)), 'day'), false, 'day is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 1, 7, 8, 9, 10)), 'day'), true, 'day is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 0, 0, 0, 0)), 'day'), true, 'exact start of day'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 23, 59, 59, 999)), 'day'), true, 'exact end of day'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 3, 0, 0, 0, 0)), 'day'), false, 'start of next day'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 1, 23, 59, 59, 999)), 'day'), true, 'end of previous day'); - assert.equal(m.isSameOrAfter(m, 'day'), true, 'same moments are in the same day'); - assert.equal(+m, +mCopy, 'isSameOrAfter day should not change moment'); - }); - - test('is same or after hour', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hour'), true, 'hour match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hours'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 1, 2, 3, 8, 9, 10)), 'hour'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 1, 2, 3, 8, 9, 10)), 'hour'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 2, 3, 8, 9, 10)), 'hour'), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 12, 2, 3, 8, 9, 10)), 'hour'), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 3, 3, 8, 9, 10)), 'hour'), false, 'day is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 1, 3, 8, 9, 10)), 'hour'), true, 'day is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 4, 8, 9, 10)), 'hour'), false, 'hour is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 2, 8, 9, 10)), 'hour'), true, 'hour is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 0, 0, 0)), 'hour'), true, 'exact start of hour'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 59, 59, 999)), 'hour'), true, 'exact end of hour'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 4, 0, 0, 0)), 'hour'), false, 'start of next hour'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 2, 59, 59, 999)), 'hour'), true, 'end of previous hour'); - assert.equal(m.isSameOrAfter(m, 'hour'), true, 'same moments are in the same hour'); - assert.equal(+m, +mCopy, 'isSameOrAfter hour should not change moment'); - }); - - test('is same or after minute', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minute'), true, 'minute match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minutes'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 1, 2, 3, 4, 9, 10)), 'minute'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 1, 2, 3, 4, 9, 10)), 'minute'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 2, 3, 4, 9, 10)), 'minute'), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 12, 2, 3, 4, 9, 10)), 'minute'), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 3, 3, 4, 9, 10)), 'minute'), false, 'day is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 1, 3, 4, 9, 10)), 'minute'), true, 'day is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 4, 4, 9, 10)), 'minute'), false, 'hour is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 2, 4, 9, 10)), 'minute'), true, 'hour is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 5, 9, 10)), 'minute'), false, 'minute is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 3, 9, 10)), 'minute'), true, 'minute is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 0, 0)), 'minute'), true, 'exact start of minute'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 59, 999)), 'minute'), true, 'exact end of minute'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 5, 0, 0)), 'minute'), false, 'start of next minute'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 3, 59, 999)), 'minute'), true, 'end of previous minute'); - assert.equal(m.isSameOrAfter(m, 'minute'), true, 'same moments are in the same minute'); - assert.equal(+m, +mCopy, 'isSameOrAfter minute should not change moment'); - }); - - test('is same or after second', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'second'), true, 'second match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'seconds'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 1, 2, 3, 4, 5, 10)), 'second'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 1, 2, 3, 4, 5, 10)), 'second'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'second'), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 12, 2, 3, 4, 5, 10)), 'second'), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 3, 3, 4, 5, 10)), 'second'), false, 'day is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 1, 3, 4, 5, 10)), 'second'), true, 'day is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 4, 4, 5, 10)), 'second'), false, 'hour is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 2, 4, 5, 10)), 'second'), true, 'hour is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 5, 5, 10)), 'second'), false, 'minute is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 3, 5, 10)), 'second'), true, 'minute is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 6, 10)), 'second'), false, 'second is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 4, 10)), 'second'), true, 'second is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 5, 0)), 'second'), true, 'exact start of second'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 5, 999)), 'second'), true, 'exact end of second'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 6, 0)), 'second'), false, 'start of next second'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 1, 2, 3, 4, 4, 999)), 'second'), true, 'end of previous second'); - assert.equal(m.isSameOrAfter(m, 'second'), true, 'same moments are in the same second'); - assert.equal(+m, +mCopy, 'isSameOrAfter second should not change moment'); - }); - - test('is same or after millisecond', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'millisecond match'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'plural should work'); - assert.equal(m.isSameOrAfter(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'year is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'year is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'millisecond'), false, 'month is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'millisecond'), true, 'month is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'millisecond'), false, 'day is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'millisecond'), true, 'day is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'millisecond'), false, 'hour is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'millisecond'), true, 'hour is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'millisecond'), false, 'minute is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'millisecond'), true, 'minute is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'millisecond'), false, 'second is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'millisecond'), true, 'second is earlier'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 6, 11)), 'millisecond'), false, 'millisecond is later'); - assert.equal(m.isSameOrAfter(moment(new Date(2011, 3, 2, 3, 4, 4, 9)), 'millisecond'), true, 'millisecond is earlier'); - assert.equal(m.isSameOrAfter(m, 'millisecond'), true, 'same moments are in the same millisecond'); - assert.equal(+m, +mCopy, 'isSameOrAfter millisecond should not change moment'); - }); - - test('is same or after with utc offset moments', function (assert) { - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrAfter(moment('2013-02-01'), 'year'), 'zoned vs local moment'); - assert.ok(moment('2013-02-01').isSameOrAfter(moment('2013-02-01').utcOffset('-05:00'), 'year'), 'local vs zoned moment'); - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrAfter(moment.parseZone('2013-02-01T-06:30'), 'year'), - 'zoned vs (differently) zoned moment'); - }); - - test('is same or after with invalid moments', function (assert) { - var m = moment(), invalid = moment.invalid(); - assert.equal(invalid.isSameOrAfter(invalid), false, 'invalid moments are not considered equal'); - assert.equal(m.isSameOrAfter(invalid), false, 'valid moment is not after invalid moment'); - assert.equal(invalid.isSameOrAfter(m), false, 'invalid moment is not after valid moment'); - assert.equal(m.isSameOrAfter(invalid, 'year'), false, 'invalid moment year'); - assert.equal(m.isSameOrAfter(invalid, 'month'), false, 'invalid moment month'); - assert.equal(m.isSameOrAfter(invalid, 'day'), false, 'invalid moment day'); - assert.equal(m.isSameOrAfter(invalid, 'hour'), false, 'invalid moment hour'); - assert.equal(m.isSameOrAfter(invalid, 'minute'), false, 'invalid moment minute'); - assert.equal(m.isSameOrAfter(invalid, 'second'), false, 'invalid moment second'); - assert.equal(m.isSameOrAfter(invalid, 'milliseconds'), false, 'invalid moment milliseconds'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is same or before'); - - test('is same or before without units', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 3, 2, 3, 5, 5, 10))), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 3, 2, 3, 3, 5, 10))), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 4, 2, 3, 4, 5, 10))), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 2, 3, 4, 5, 10))), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 3, 3, 4, 5, 10))), true, 'day is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 1, 3, 4, 5, 10))), false, 'day is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 4, 4, 5, 10))), true, 'hour is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 2, 4, 5, 10))), false, 'hour is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 5, 5, 10))), true, 'minute is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 3, 5, 10))), false, 'minute is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 10))), true, 'second is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 11))), false, 'second is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 10))), true, 'millisecond match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 11))), true, 'millisecond is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 9))), false, 'millisecond is earlier'); - assert.equal(m.isSameOrBefore(m), true, 'moments are the same as themselves'); - assert.equal(+m, +mCopy, 'isSameOrBefore second should not change moment'); - }); - - test('is same or before year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'years'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 5, 6, 7, 8, 9, 10)), 'year'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 5, 6, 7, 8, 9, 10)), 'year'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 0, 1, 0, 0, 0, 0)), 'year'), true, 'exact start of year'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 11, 31, 23, 59, 59, 999)), 'year'), true, 'exact end of year'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 0, 1, 0, 0, 0, 0)), 'year'), true, 'start of next year'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 11, 31, 23, 59, 59, 999)), 'year'), false, 'end of previous year'); - assert.equal(m.isSameOrBefore(m, 'year'), true, 'same moments are in the same year'); - assert.equal(+m, +mCopy, 'isSameOrBefore year should not change moment'); - }); - - test('is same or before month', function (assert) { - var m = moment(new Date(2011, 2, 3, 4, 5, 6, 7)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'month'), true, 'month match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 6, 7, 8, 9, 10)), 'months'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 2, 6, 7, 8, 9, 10)), 'month'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 2, 6, 7, 8, 9, 10)), 'month'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 5, 6, 7, 8, 9, 10)), 'month'), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 6, 7, 8, 9, 10)), 'month'), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 1, 0, 0, 0, 0)), 'month'), true, 'exact start of month'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 31, 23, 59, 59, 999)), 'month'), true, 'exact end of month'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 1, 0, 0, 0, 0)), 'month'), true, 'start of next month'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 27, 23, 59, 59, 999)), 'month'), false, 'end of previous month'); - assert.equal(m.isSameOrBefore(m, 'month'), true, 'same moments are in the same month'); - assert.equal(+m, +mCopy, 'isSameOrBefore month should not change moment'); - }); - - test('is same or before day', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'day'), true, 'day match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 7, 8, 9, 10)), 'days'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 1, 2, 7, 8, 9, 10)), 'day'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 1, 2, 7, 8, 9, 10)), 'day'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 2, 7, 8, 9, 10)), 'day'), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 12, 2, 7, 8, 9, 10)), 'day'), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 3, 7, 8, 9, 10)), 'day'), true, 'day is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 1, 7, 8, 9, 10)), 'day'), false, 'day is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 0, 0, 0, 0)), 'day'), true, 'exact start of day'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 23, 59, 59, 999)), 'day'), true, 'exact end of day'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 3, 0, 0, 0, 0)), 'day'), true, 'start of next day'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 1, 23, 59, 59, 999)), 'day'), false, 'end of previous day'); - assert.equal(m.isSameOrBefore(m, 'day'), true, 'same moments are in the same day'); - assert.equal(+m, +mCopy, 'isSameOrBefore day should not change moment'); - }); - - test('is same or before hour', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hour'), true, 'hour match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 8, 9, 10)), 'hours'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 1, 2, 3, 8, 9, 10)), 'hour'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 1, 2, 3, 8, 9, 10)), 'hour'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 2, 3, 8, 9, 10)), 'hour'), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 12, 2, 3, 8, 9, 10)), 'hour'), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 3, 3, 8, 9, 10)), 'hour'), true, 'day is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 1, 3, 8, 9, 10)), 'hour'), false, 'day is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 4, 8, 9, 10)), 'hour'), true, 'hour is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 2, 8, 9, 10)), 'hour'), false, 'hour is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 0, 0, 0)), 'hour'), true, 'exact start of hour'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 59, 59, 999)), 'hour'), true, 'exact end of hour'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 4, 0, 0, 0)), 'hour'), true, 'start of next hour'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 2, 59, 59, 999)), 'hour'), false, 'end of previous hour'); - assert.equal(m.isSameOrBefore(m, 'hour'), true, 'same moments are in the same hour'); - assert.equal(+m, +mCopy, 'isSameOrBefore hour should not change moment'); - }); - - test('is same or before minute', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minute'), true, 'minute match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 9, 10)), 'minutes'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 1, 2, 3, 4, 9, 10)), 'minute'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 1, 2, 3, 4, 9, 10)), 'minute'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 2, 3, 4, 9, 10)), 'minute'), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 12, 2, 3, 4, 9, 10)), 'minute'), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 3, 3, 4, 9, 10)), 'minute'), true, 'day is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 1, 3, 4, 9, 10)), 'minute'), false, 'day is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 4, 4, 9, 10)), 'minute'), true, 'hour is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 2, 4, 9, 10)), 'minute'), false, 'hour is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 5, 9, 10)), 'minute'), true, 'minute is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 3, 9, 10)), 'minute'), false, 'minute is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 0, 0)), 'minute'), true, 'exact start of minute'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 59, 999)), 'minute'), true, 'exact end of minute'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 5, 0, 0)), 'minute'), true, 'start of next minute'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 3, 59, 999)), 'minute'), false, 'end of previous minute'); - assert.equal(m.isSameOrBefore(m, 'minute'), true, 'same moments are in the same minute'); - assert.equal(+m, +mCopy, 'isSameOrBefore minute should not change moment'); - }); - - test('is same or before second', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'second'), true, 'second match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 5, 10)), 'seconds'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 1, 2, 3, 4, 5, 10)), 'second'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 1, 2, 3, 4, 5, 10)), 'second'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'second'), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 12, 2, 3, 4, 5, 10)), 'second'), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 3, 3, 4, 5, 10)), 'second'), true, 'day is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 1, 3, 4, 5, 10)), 'second'), false, 'day is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 4, 4, 5, 10)), 'second'), true, 'hour is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 2, 4, 5, 10)), 'second'), false, 'hour is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 5, 5, 10)), 'second'), true, 'minute is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 3, 5, 10)), 'second'), false, 'minute is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 6, 10)), 'second'), true, 'second is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 4, 10)), 'second'), false, 'second is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 5, 0)), 'second'), true, 'exact start of second'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 5, 999)), 'second'), true, 'exact end of second'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 6, 0)), 'second'), true, 'start of next second'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 1, 2, 3, 4, 4, 999)), 'second'), false, 'end of previous second'); - assert.equal(m.isSameOrBefore(m, 'second'), true, 'same moments are in the same second'); - assert.equal(+m, +mCopy, 'isSameOrBefore second should not change moment'); - }); - - test('is same or before millisecond', function (assert) { - var m = moment(new Date(2011, 3, 2, 3, 4, 5, 10)), mCopy = moment(m); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'millisecond match'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 5, 10)), 'milliseconds'), true, 'plural should work'); - assert.equal(m.isSameOrBefore(moment(new Date(2012, 3, 2, 3, 4, 5, 10)), 'millisecond'), true, 'year is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2010, 3, 2, 3, 4, 5, 10)), 'millisecond'), false, 'year is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 4, 2, 3, 4, 5, 10)), 'millisecond'), true, 'month is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 2, 2, 3, 4, 5, 10)), 'millisecond'), false, 'month is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 3, 3, 4, 5, 10)), 'millisecond'), true, 'day is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 1, 1, 4, 5, 10)), 'millisecond'), false, 'day is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 4, 4, 5, 10)), 'millisecond'), true, 'hour is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 1, 4, 1, 5, 10)), 'millisecond'), false, 'hour is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 5, 5, 10)), 'millisecond'), true, 'minute is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 3, 5, 10)), 'millisecond'), false, 'minute is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 10)), 'millisecond'), true, 'second is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 5)), 'millisecond'), false, 'second is earlier'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 6, 11)), 'millisecond'), true, 'millisecond is later'); - assert.equal(m.isSameOrBefore(moment(new Date(2011, 3, 2, 3, 4, 4, 9)), 'millisecond'), false, 'millisecond is earlier'); - assert.equal(m.isSameOrBefore(m, 'millisecond'), true, 'same moments are in the same millisecond'); - assert.equal(+m, +mCopy, 'isSameOrBefore millisecond should not change moment'); - }); - - test('is same with utc offset moments', function (assert) { - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrBefore(moment('2013-02-01'), 'year'), 'zoned vs local moment'); - assert.ok(moment('2013-02-01').isSameOrBefore(moment('2013-02-01').utcOffset('-05:00'), 'year'), 'local vs zoned moment'); - assert.ok(moment.parseZone('2013-02-01T-05:00').isSameOrBefore(moment.parseZone('2013-02-01T-06:30'), 'year'), - 'zoned vs (differently) zoned moment'); - }); - - test('is same with invalid moments', function (assert) { - var m = moment(), invalid = moment.invalid(); - assert.equal(invalid.isSameOrBefore(invalid), false, 'invalid moments are not considered equal'); - assert.equal(m.isSameOrBefore(invalid), false, 'valid moment is not before invalid moment'); - assert.equal(invalid.isSameOrBefore(m), false, 'invalid moment is not before valid moment'); - assert.equal(m.isSameOrBefore(invalid, 'year'), false, 'invalid moment year'); - assert.equal(m.isSameOrBefore(invalid, 'month'), false, 'invalid moment month'); - assert.equal(m.isSameOrBefore(invalid, 'day'), false, 'invalid moment day'); - assert.equal(m.isSameOrBefore(invalid, 'hour'), false, 'invalid moment hour'); - assert.equal(m.isSameOrBefore(invalid, 'minute'), false, 'invalid moment minute'); - assert.equal(m.isSameOrBefore(invalid, 'second'), false, 'invalid moment second'); - assert.equal(m.isSameOrBefore(invalid, 'milliseconds'), false, 'invalid moment milliseconds'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('is valid'); - - test('array bad month', function (assert) { - assert.equal(moment([2010, -1]).isValid(), false, 'month -1 invalid'); - assert.equal(moment([2100, 12]).isValid(), false, 'month 12 invalid'); - }); - - test('array good month', function (assert) { - for (var i = 0; i < 12; i++) { - assert.equal(moment([2010, i]).isValid(), true, 'month ' + i); - assert.equal(moment.utc([2010, i]).isValid(), true, 'month ' + i); - } - }); - - test('array bad date', function (assert) { - var tests = [ - moment([2010, 0, 0]), - moment([2100, 0, 32]), - moment.utc([2010, 0, 0]), - moment.utc([2100, 0, 32]) - ], - i, m; - - for (i in tests) { - m = tests[i]; - assert.equal(m.isValid(), false); - } - }); - - test('h/hh with hour > 12', function (assert) { - assert.ok(moment('06/20/2014 11:51 PM', 'MM/DD/YYYY hh:mm A', true).isValid(), '11 for hh'); - assert.ok(moment('06/20/2014 11:51 AM', 'MM/DD/YYYY hh:mm A', true).isValid(), '11 for hh'); - assert.ok(moment('06/20/2014 23:51 PM', 'MM/DD/YYYY hh:mm A').isValid(), 'non-strict validity 23 for hh'); - assert.ok(moment('06/20/2014 23:51 PM', 'MM/DD/YYYY hh:mm A').parsingFlags().bigHour, 'non-strict bigHour 23 for hh'); - assert.ok(!moment('06/20/2014 23:51 PM', 'MM/DD/YYYY hh:mm A', true).isValid(), 'validity 23 for hh'); - assert.ok(moment('06/20/2014 23:51 PM', 'MM/DD/YYYY hh:mm A', true).parsingFlags().bigHour, 'bigHour 23 for hh'); - }); - - test('array bad date leap year', function (assert) { - assert.equal(moment([2010, 1, 29]).isValid(), false, '2010 feb 29'); - assert.equal(moment([2100, 1, 29]).isValid(), false, '2100 feb 29'); - assert.equal(moment([2008, 1, 30]).isValid(), false, '2008 feb 30'); - assert.equal(moment([2000, 1, 30]).isValid(), false, '2000 feb 30'); - - assert.equal(moment.utc([2010, 1, 29]).isValid(), false, 'utc 2010 feb 29'); - assert.equal(moment.utc([2100, 1, 29]).isValid(), false, 'utc 2100 feb 29'); - assert.equal(moment.utc([2008, 1, 30]).isValid(), false, 'utc 2008 feb 30'); - assert.equal(moment.utc([2000, 1, 30]).isValid(), false, 'utc 2000 feb 30'); - }); - - test('string + formats bad date', function (assert) { - assert.equal(moment('2020-00-00', []).isValid(), false, 'invalid on empty array'); - assert.equal(moment('2020-00-00', ['YYYY-MM-DD', 'DD-MM-YYYY']).isValid(), false, 'invalid on all in array'); - assert.equal(moment('2020-00-00', ['DD-MM-YYYY', 'YYYY-MM-DD']).isValid(), false, 'invalid on all in array'); - assert.equal(moment('2020-01-01', ['YYYY-MM-DD', 'DD-MM-YYYY']).isValid(), true, 'valid on first'); - assert.equal(moment('2020-01-01', ['DD-MM-YYYY', 'YYYY-MM-DD']).isValid(), true, 'valid on last'); - assert.equal(moment('2020-01-01', ['YYYY-MM-DD', 'YYYY-DD-MM']).isValid(), true, 'valid on both'); - assert.equal(moment('2020-13-01', ['YYYY-MM-DD', 'YYYY-DD-MM']).isValid(), true, 'valid on last'); - - assert.equal(moment('12-13-2012', ['DD-MM-YYYY', 'YYYY-MM-DD']).isValid(), false, 'month rollover'); - assert.equal(moment('12-13-2012', ['DD-MM-YYYY', 'DD-MM-YYYY']).isValid(), false, 'month rollover'); - assert.equal(moment('38-12-2012', ['DD-MM-YYYY']).isValid(), false, 'day rollover'); - }); - - test('string nonsensical with format', function (assert) { - assert.equal(moment('fail', 'MM-DD-YYYY').isValid(), false, 'string \'fail\' with format \'MM-DD-YYYY\''); - assert.equal(moment('xx-xx-2001', 'DD-MM-YYY').isValid(), true, 'string \'xx-xx-2001\' with format \'MM-DD-YYYY\''); - }); - - test('string with bad month name', function (assert) { - assert.equal(moment('01-Nam-2012', 'DD-MMM-YYYY').isValid(), false, '\'Nam\' is an invalid month'); - assert.equal(moment('01-Aug-2012', 'DD-MMM-YYYY').isValid(), true, '\'Aug\' is a valid month'); - }); - - test('string with spaceless format', function (assert) { - assert.equal(moment('10Sep2001', 'DDMMMYYYY').isValid(), true, 'Parsing 10Sep2001 should result in a valid date'); - }); - - test('invalid string iso 8601', function (assert) { - var tests = [ - '2010-00-00', - '2010-01-00', - '2010-01-40', - '2010-01-01T24:01', // 24:00:00 is actually valid - '2010-01-01T23:60', - '2010-01-01T23:59:60' - ], i; - - for (i = 0; i < tests.length; i++) { - assert.equal(moment(tests[i], moment.ISO_8601).isValid(), false, tests[i] + ' should be invalid'); - assert.equal(moment.utc(tests[i], moment.ISO_8601).isValid(), false, tests[i] + ' should be invalid'); - } - }); - - test('invalid string iso 8601 + timezone', function (assert) { - var tests = [ - '2010-00-00T+00:00', - '2010-01-00T+00:00', - '2010-01-40T+00:00', - '2010-01-40T24:01+00:00', - '2010-01-40T23:60+00:00', - '2010-01-40T23:59:60+00:00', - '2010-01-40T23:59:59.9999+00:00', - '2010-01-40T23:59:59,9999+00:00' - ], i; - - for (i = 0; i < tests.length; i++) { - assert.equal(moment(tests[i], moment.ISO_8601).isValid(), false, tests[i] + ' should be invalid'); - assert.equal(moment.utc(tests[i], moment.ISO_8601).isValid(), false, tests[i] + ' should be invalid'); - } - }); - - test('valid string iso 8601 - not strict', function (assert) { - var tests = [ - '2010-01-30 00:00:00,000Z', - '20100101', - '20100130', - '20100130T23+00:00', - '20100130T2359+0000', - '20100130T235959+0000', - '20100130T235959,999+0000', - '20100130T235959,999-0700', - '20100130T000000,000+0700', - '20100130 000000,000Z' - ]; - - for (var i = 0; i < tests.length; i++) { - assert.equal(moment(tests[i]).isValid(), true, tests[i] + ' should be valid in normal'); - assert.equal(moment.utc(tests[i]).isValid(), true, tests[i] + ' should be valid in normal'); - } - }); - - test('valid string iso 8601 + timezone', function (assert) { - var tests = [ - '2010-01-01', - '2010-01-30', - '2010-01-30T23+00:00', - '2010-01-30T23:59+00:00', - '2010-01-30T23:59:59+00:00', - '2010-01-30T23:59:59.999+00:00', - '2010-01-30T23:59:59.999-07:00', - '2010-01-30T00:00:00.000+07:00', - '2010-01-30T23:59:59.999-07', - '2010-01-30T00:00:00.000+07', - '2010-01-30 00:00:00.000Z' - ], i; - - for (i = 0; i < tests.length; i++) { - assert.equal(moment(tests[i]).isValid(), true, tests[i] + ' should be valid in normal'); - assert.equal(moment.utc(tests[i]).isValid(), true, tests[i] + ' should be valid in normal'); - assert.equal(moment(tests[i], moment.ISO_8601, true).isValid(), true, tests[i] + ' should be valid in strict'); - assert.equal(moment.utc(tests[i], moment.ISO_8601, true).isValid(), true, tests[i] + ' should be valid in strict'); - } - }); - - test('invalidAt', function (assert) { - assert.equal(moment([2000, 12]).invalidAt(), 1, 'month 12 is invalid: 0-11'); - assert.equal(moment([2000, 1, 30]).invalidAt(), 2, '30 is not a valid february day'); - assert.equal(moment([2000, 1, 29, 25]).invalidAt(), 3, '25 is invalid hour'); - assert.equal(moment([2000, 1, 29, 24, 1]).invalidAt(), 3, '24:01 is invalid hour'); - assert.equal(moment([2000, 1, 29, 23, 60]).invalidAt(), 4, '60 is invalid minute'); - assert.equal(moment([2000, 1, 29, 23, 59, 60]).invalidAt(), 5, '60 is invalid second'); - assert.equal(moment([2000, 1, 29, 23, 59, 59, 1000]).invalidAt(), 6, '1000 is invalid millisecond'); - assert.equal(moment([2000, 1, 29, 23, 59, 59, 999]).invalidAt(), -1, '-1 if everything is fine'); - }); - - test('valid Unix timestamp', function (assert) { - assert.equal(moment(1371065286, 'X').isValid(), true, 'number integer'); - assert.equal(moment(1379066897.0, 'X').isValid(), true, 'number whole 1dp'); - assert.equal(moment(1379066897.7, 'X').isValid(), true, 'number 1dp'); - assert.equal(moment(1379066897.00, 'X').isValid(), true, 'number whole 2dp'); - assert.equal(moment(1379066897.07, 'X').isValid(), true, 'number 2dp'); - assert.equal(moment(1379066897.17, 'X').isValid(), true, 'number 2dp'); - assert.equal(moment(1379066897.000, 'X').isValid(), true, 'number whole 3dp'); - assert.equal(moment(1379066897.007, 'X').isValid(), true, 'number 3dp'); - assert.equal(moment(1379066897.017, 'X').isValid(), true, 'number 3dp'); - assert.equal(moment(1379066897.157, 'X').isValid(), true, 'number 3dp'); - assert.equal(moment('1371065286', 'X').isValid(), true, 'string integer'); - assert.equal(moment('1379066897.', 'X').isValid(), true, 'string trailing .'); - assert.equal(moment('1379066897.0', 'X').isValid(), true, 'string whole 1dp'); - assert.equal(moment('1379066897.7', 'X').isValid(), true, 'string 1dp'); - assert.equal(moment('1379066897.00', 'X').isValid(), true, 'string whole 2dp'); - assert.equal(moment('1379066897.07', 'X').isValid(), true, 'string 2dp'); - assert.equal(moment('1379066897.17', 'X').isValid(), true, 'string 2dp'); - assert.equal(moment('1379066897.000', 'X').isValid(), true, 'string whole 3dp'); - assert.equal(moment('1379066897.007', 'X').isValid(), true, 'string 3dp'); - assert.equal(moment('1379066897.017', 'X').isValid(), true, 'string 3dp'); - assert.equal(moment('1379066897.157', 'X').isValid(), true, 'string 3dp'); - }); - - test('invalid Unix timestamp', function (assert) { - assert.equal(moment(undefined, 'X').isValid(), false, 'undefined'); - assert.equal(moment('undefined', 'X').isValid(), false, 'string undefined'); - try { - assert.equal(moment(null, 'X').isValid(), false, 'null'); - } catch (e) { - assert.ok(true, 'null'); - } - - assert.equal(moment('null', 'X').isValid(), false, 'string null'); - assert.equal(moment([], 'X').isValid(), false, 'array'); - assert.equal(moment('{}', 'X').isValid(), false, 'object'); - try { - assert.equal(moment('', 'X').isValid(), false, 'string empty'); - } catch (e) { - assert.ok(true, 'string empty'); - } - - assert.equal(moment(' ', 'X').isValid(), false, 'string space'); - }); - - test('valid Unix offset milliseconds', function (assert) { - assert.equal(moment(1234567890123, 'x').isValid(), true, 'number integer'); - assert.equal(moment('1234567890123', 'x').isValid(), true, 'string integer'); - }); - - test('invalid Unix offset milliseconds', function (assert) { - assert.equal(moment(undefined, 'x').isValid(), false, 'undefined'); - assert.equal(moment('undefined', 'x').isValid(), false, 'string undefined'); - try { - assert.equal(moment(null, 'x').isValid(), false, 'null'); - } catch (e) { - assert.ok(true, 'null'); - } - - assert.equal(moment('null', 'x').isValid(), false, 'string null'); - assert.equal(moment([], 'x').isValid(), false, 'array'); - assert.equal(moment('{}', 'x').isValid(), false, 'object'); - try { - assert.equal(moment('', 'x').isValid(), false, 'string empty'); - } catch (e) { - assert.ok(true, 'string empty'); - } - - assert.equal(moment(' ', 'x').isValid(), false, 'string space'); - }); - - test('empty', function (assert) { - assert.equal(moment(null).isValid(), false, 'null'); - assert.equal(moment('').isValid(), false, 'empty string'); - assert.equal(moment(null, 'YYYY').isValid(), false, 'format + null'); - assert.equal(moment('', 'YYYY').isValid(), false, 'format + empty string'); - assert.equal(moment(' ', 'YYYY').isValid(), false, 'format + empty when trimmed'); - }); - - test('days of the year', function (assert) { - assert.equal(moment('2010 300', 'YYYY DDDD').isValid(), true, 'day 300 of year valid'); - assert.equal(moment('2010 365', 'YYYY DDDD').isValid(), true, 'day 365 of year valid'); - assert.equal(moment('2010 366', 'YYYY DDDD').isValid(), false, 'day 366 of year invalid'); - assert.equal(moment('2012 365', 'YYYY DDDD').isValid(), true, 'day 365 of leap year valid'); - assert.equal(moment('2012 366', 'YYYY DDDD').isValid(), true, 'day 366 of leap year valid'); - assert.equal(moment('2012 367', 'YYYY DDDD').isValid(), false, 'day 367 of leap year invalid'); - }); - - test('24:00:00.000 is valid', function (assert) { - assert.equal(moment('2014-01-01 24', 'YYYY-MM-DD HH').isValid(), true, '24 is valid'); - assert.equal(moment('2014-01-01 24:00', 'YYYY-MM-DD HH:mm').isValid(), true, '24:00 is valid'); - assert.equal(moment('2014-01-01 24:01', 'YYYY-MM-DD HH:mm').isValid(), false, '24:01 is not valid'); - }); - - test('oddball permissiveness', function (assert) { - //https://github.com/moment/moment/issues/1128 - assert.ok(moment('2010-10-3199', ['MM/DD/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']).isValid()); - - //https://github.com/moment/moment/issues/1122 - assert.ok(moment('3:25', ['h:mma', 'hh:mma', 'H:mm', 'HH:mm']).isValid()); - }); - - test('0 hour is invalid in strict', function (assert) { - assert.equal(moment('00:01', 'hh:mm', true).isValid(), false, '00 hour is invalid in strict'); - assert.equal(moment('00:01', 'hh:mm').isValid(), true, '00 hour is valid in normal'); - assert.equal(moment('0:01', 'h:mm', true).isValid(), false, '0 hour is invalid in strict'); - assert.equal(moment('0:01', 'h:mm').isValid(), true, '0 hour is valid in normal'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('leap year'); - - test('leap year', function (assert) { - assert.equal(moment([2010, 0, 1]).isLeapYear(), false, '2010'); - assert.equal(moment([2100, 0, 1]).isLeapYear(), false, '2100'); - assert.equal(moment([2008, 0, 1]).isLeapYear(), true, '2008'); - assert.equal(moment([2000, 0, 1]).isLeapYear(), true, '2000'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('listers'); - - test('default', function (assert) { - assert.deepEqual(moment.months(), ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']); - assert.deepEqual(moment.monthsShort(), ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']); - assert.deepEqual(moment.weekdays(), ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']); - assert.deepEqual(moment.weekdaysShort(), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']); - assert.deepEqual(moment.weekdaysMin(), ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']); - }); - - test('index', function (assert) { - assert.equal(moment.months(0), 'January'); - assert.equal(moment.months(2), 'March'); - assert.equal(moment.monthsShort(0), 'Jan'); - assert.equal(moment.monthsShort(2), 'Mar'); - assert.equal(moment.weekdays(0), 'Sunday'); - assert.equal(moment.weekdays(2), 'Tuesday'); - assert.equal(moment.weekdaysShort(0), 'Sun'); - assert.equal(moment.weekdaysShort(2), 'Tue'); - assert.equal(moment.weekdaysMin(0), 'Su'); - assert.equal(moment.weekdaysMin(2), 'Tu'); - }); - - test('localized', function (assert) { - var months = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'), - monthsShort = 'on_tw_th_fo_fi_si_se_ei_ni_te_el_tw'.split('_'), - weekdays = 'one_two_three_four_five_six_seven'.split('_'), - weekdaysShort = 'on_tw_th_fo_fi_si_se'.split('_'), - weekdaysMin = '1_2_3_4_5_6_7'.split('_'), - weekdaysLocale = 'four_five_six_seven_one_two_three'.split('_'), - weekdaysShortLocale = 'fo_fi_si_se_on_tw_th'.split('_'), - weekdaysMinLocale = '4_5_6_7_1_2_3'.split('_'), - week = { - dow : 3, - doy : 6 - }; - - moment.locale('numerologists', { - months : months, - monthsShort : monthsShort, - weekdays : weekdays, - weekdaysShort: weekdaysShort, - weekdaysMin: weekdaysMin, - week : week - }); - - assert.deepEqual(moment.months(), months); - assert.deepEqual(moment.monthsShort(), monthsShort); - assert.deepEqual(moment.weekdays(), weekdays); - assert.deepEqual(moment.weekdaysShort(), weekdaysShort); - assert.deepEqual(moment.weekdaysMin(), weekdaysMin); - - assert.equal(moment.months(0), 'one'); - assert.equal(moment.monthsShort(0), 'on'); - assert.equal(moment.weekdays(0), 'one'); - assert.equal(moment.weekdaysShort(0), 'on'); - assert.equal(moment.weekdaysMin(0), '1'); - - assert.equal(moment.months(2), 'three'); - assert.equal(moment.monthsShort(2), 'th'); - assert.equal(moment.weekdays(2), 'three'); - assert.equal(moment.weekdaysShort(2), 'th'); - assert.equal(moment.weekdaysMin(2), '3'); - - assert.deepEqual(moment.weekdays(true), weekdaysLocale); - assert.deepEqual(moment.weekdaysShort(true), weekdaysShortLocale); - assert.deepEqual(moment.weekdaysMin(true), weekdaysMinLocale); - - assert.equal(moment.weekdays(true, 0), 'four'); - assert.equal(moment.weekdaysShort(true, 0), 'fo'); - assert.equal(moment.weekdaysMin(true, 0), '4'); - - assert.equal(moment.weekdays(false, 2), 'three'); - assert.equal(moment.weekdaysShort(false, 2), 'th'); - assert.equal(moment.weekdaysMin(false, 2), '3'); - }); - - test('with functions', function (assert) { - var monthsShort = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'), - monthsShortWeird = 'onesy_twosy_threesy_foursy_fivesy_sixsy_sevensy_eightsy_ninesy_tensy_elevensy_twelvesy'.split('_'); - - moment.locale('difficult', { - - monthsShort: function (m, format) { - var arr = format.match(/-MMM-/) ? monthsShortWeird : monthsShort; - return arr[m.month()]; - } - }); - - assert.deepEqual(moment.monthsShort(), monthsShort); - assert.deepEqual(moment.monthsShort('MMM'), monthsShort); - assert.deepEqual(moment.monthsShort('-MMM-'), monthsShortWeird); - - assert.deepEqual(moment.monthsShort('MMM', 2), 'three'); - assert.deepEqual(moment.monthsShort('-MMM-', 2), 'threesy'); - assert.deepEqual(moment.monthsShort(2), 'three'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - var indexOf; - - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } - - module('locale', { - setup : function () { - // TODO: Remove once locales are switched to ES6 - each([{ - name: 'en-gb', - data: {} - }, { - name: 'en-ca', - data: {} - }, { - name: 'es', - data: { - relativeTime: {past: 'hace %s', s: 'unos segundos', d: 'un día'}, - months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_') - } - }, { - name: 'fr', - data: {} - }, { - name: 'fr-ca', - data: {} - }, { - name: 'it', - data: {} - }, { - name: 'zh-cn', - data: { - months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_') - } - }], function (locale) { - if (moment.locale(locale.name) !== locale.name) { - moment.defineLocale(locale.name, locale.data); - } - }); - moment.locale('en'); - } - }); - - test('library getters and setters', function (assert) { - var r = moment.locale('en'); - - assert.equal(r, 'en', 'locale should return en by default'); - assert.equal(moment.locale(), 'en', 'locale should return en by default'); - - moment.locale('fr'); - assert.equal(moment.locale(), 'fr', 'locale should return the changed locale'); - - moment.locale('en-gb'); - assert.equal(moment.locale(), 'en-gb', 'locale should return the changed locale'); - - moment.locale('en'); - assert.equal(moment.locale(), 'en', 'locale should reset'); - - moment.locale('does-not-exist'); - assert.equal(moment.locale(), 'en', 'locale should reset'); - - moment.locale('EN'); - assert.equal(moment.locale(), 'en', 'Normalize locale key case'); - - moment.locale('EN_gb'); - assert.equal(moment.locale(), 'en-gb', 'Normalize locale key underscore'); - }); - - test('library setter array of locales', function (assert) { - assert.equal(moment.locale(['non-existent', 'fr', 'also-non-existent']), 'fr', 'passing an array uses the first valid locale'); - assert.equal(moment.locale(['es', 'fr', 'also-non-existent']), 'es', 'passing an array uses the first valid locale'); - }); - - test('library setter locale substrings', function (assert) { - assert.equal(moment.locale('fr-crap'), 'fr', 'use substrings'); - assert.equal(moment.locale('fr-does-not-exist'), 'fr', 'uses deep substrings'); - assert.equal(moment.locale('fr-CA-does-not-exist'), 'fr-ca', 'uses deepest substring'); - }); - - test('library getter locale array and substrings', function (assert) { - assert.equal(moment.locale(['en-CH', 'fr']), 'en', 'prefer root locale to shallower ones'); - assert.equal(moment.locale(['en-gb-leeds', 'en-CA']), 'en-gb', 'prefer root locale to shallower ones'); - assert.equal(moment.locale(['en-fake', 'en-CA']), 'en-ca', 'prefer alternatives with shared roots'); - assert.equal(moment.locale(['en-fake', 'en-fake2', 'en-ca']), 'en-ca', 'prefer alternatives with shared roots'); - assert.equal(moment.locale(['fake-CA', 'fake-MX', 'fr']), 'fr', 'always find something if possible'); - assert.equal(moment.locale(['fake-CA', 'fake-MX', 'fr']), 'fr', 'always find something if possible'); - assert.equal(moment.locale(['fake-CA', 'fake-MX', 'fr-fake-fake-fake']), 'fr', 'always find something if possible'); - assert.equal(moment.locale(['en', 'en-CA']), 'en', 'prefer earlier if it works'); - }); - - test('library ensure inheritance', function (assert) { - moment.locale('made-up', { - // I put them out of order - months : 'February_March_April_May_June_July_August_September_October_November_December_January'.split('_') - // the rest of the properties should be inherited. - }); - - assert.equal(moment([2012, 5, 6]).format('MMMM'), 'July', 'Override some of the configs'); - assert.equal(moment([2012, 5, 6]).format('MMM'), 'Jun', 'But not all of them'); - }); - - test('library ensure inheritance LT L LL LLL LLLL', function (assert) { - var locale = 'test-inherit-lt'; - - moment.defineLocale(locale, { - longDateFormat : { - LT : '-[LT]-', - L : '-[L]-', - LL : '-[LL]-', - LLL : '-[LLL]-', - LLLL : '-[LLLL]-' - }, - calendar : { - sameDay : '[sameDay] LT', - nextDay : '[nextDay] L', - nextWeek : '[nextWeek] LL', - lastDay : '[lastDay] LLL', - lastWeek : '[lastWeek] LLLL', - sameElse : 'L' - } - }); - - moment.locale('es'); - - assert.equal(moment().locale(locale).calendar(), 'sameDay -LT-', 'Should use instance locale in LT formatting'); - assert.equal(moment().add(1, 'days').locale(locale).calendar(), 'nextDay -L-', 'Should use instance locale in L formatting'); - assert.equal(moment().add(-1, 'days').locale(locale).calendar(), 'lastDay -LLL-', 'Should use instance locale in LL formatting'); - assert.equal(moment().add(4, 'days').locale(locale).calendar(), 'nextWeek -LL-', 'Should use instance locale in LLL formatting'); - assert.equal(moment().add(-4, 'days').locale(locale).calendar(), 'lastWeek -LLLL-', 'Should use instance locale in LLLL formatting'); - }); - - test('library localeData', function (assert) { - moment.locale('en'); - - var jan = moment([2000, 0]); - - assert.equal(moment.localeData().months(jan), 'January', 'no arguments returns global'); - assert.equal(moment.localeData('zh-cn').months(jan), '一月', 'a string returns the locale based on key'); - assert.equal(moment.localeData(moment().locale('es')).months(jan), 'enero', 'if you pass in a moment it uses the moment\'s locale'); - }); - - test('library deprecations', function (assert) { - test.expectedDeprecations('moment.lang'); - moment.lang('dude', {months: ['Movember']}); - assert.equal(moment.locale(), 'dude', 'setting the lang sets the locale'); - assert.equal(moment.lang(), moment.locale()); - assert.equal(moment.langData(), moment.localeData(), 'langData is localeData'); - moment.defineLocale('dude', null); - }); - - test('defineLocale', function (assert) { - moment.locale('en'); - moment.defineLocale('dude', {months: ['Movember']}); - assert.equal(moment().locale(), 'dude', 'defineLocale also sets it'); - assert.equal(moment().locale('dude').locale(), 'dude', 'defineLocale defines a locale'); - moment.defineLocale('dude', null); - }); - - test('locales', function (assert) { - moment.defineLocale('dude', {months: ['Movember']}); - assert.equal(true, !!~indexOf.call(moment.locales(), 'dude'), 'locales returns an array of defined locales'); - assert.equal(true, !!~indexOf.call(moment.locales(), 'en'), 'locales should always include english'); - moment.defineLocale('dude', null); - }); - - test('library convenience', function (assert) { - moment.locale('something', {week: {dow: 3}}); - moment.locale('something'); - assert.equal(moment.locale(), 'something', 'locale can be used to create the locale too'); - moment.defineLocale('something', null); - }); - - test('firstDayOfWeek firstDayOfYear locale getters', function (assert) { - moment.locale('something', {week: {dow: 3, doy: 4}}); - moment.locale('something'); - assert.equal(moment.localeData().firstDayOfWeek(), 3, 'firstDayOfWeek'); - assert.equal(moment.localeData().firstDayOfYear(), 4, 'firstDayOfYear'); - moment.defineLocale('something', null); - }); - - test('instance locale method', function (assert) { - moment.locale('en'); - - assert.equal(moment([2012, 5, 6]).format('MMMM'), 'June', 'Normally default to global'); - assert.equal(moment([2012, 5, 6]).locale('es').format('MMMM'), 'junio', 'Use the instance specific locale'); - assert.equal(moment([2012, 5, 6]).format('MMMM'), 'June', 'Using an instance specific locale does not affect other moments'); - }); - - test('instance locale method with array', function (assert) { - var m = moment().locale(['non-existent', 'fr', 'also-non-existent']); - assert.equal(m.locale(), 'fr', 'passing an array uses the first valid locale'); - m = moment().locale(['es', 'fr', 'also-non-existent']); - assert.equal(m.locale(), 'es', 'passing an array uses the first valid locale'); - }); - - test('instance getter locale substrings', function (assert) { - var m = moment(); - - m.locale('fr-crap'); - assert.equal(m.locale(), 'fr', 'use substrings'); - - m.locale('fr-does-not-exist'); - assert.equal(m.locale(), 'fr', 'uses deep substrings'); - }); - - test('instance locale persists with manipulation', function (assert) { - moment.locale('en'); - - assert.equal(moment([2012, 5, 6]).locale('es').add({days: 1}).format('MMMM'), 'junio', 'With addition'); - assert.equal(moment([2012, 5, 6]).locale('es').day(0).format('MMMM'), 'junio', 'With day getter'); - assert.equal(moment([2012, 5, 6]).locale('es').endOf('day').format('MMMM'), 'junio', 'With endOf'); - }); - - test('instance locale persists with cloning', function (assert) { - moment.locale('en'); - - var a = moment([2012, 5, 6]).locale('es'), - b = a.clone(), - c = moment(a); - - assert.equal(b.format('MMMM'), 'junio', 'using moment.fn.clone()'); - assert.equal(b.format('MMMM'), 'junio', 'using moment()'); - }); - - test('duration locale method', function (assert) { - moment.locale('en'); - - assert.equal(moment.duration({seconds: 44}).humanize(), 'a few seconds', 'Normally default to global'); - assert.equal(moment.duration({seconds: 44}).locale('es').humanize(), 'unos segundos', 'Use the instance specific locale'); - assert.equal(moment.duration({seconds: 44}).humanize(), 'a few seconds', 'Using an instance specific locale does not affect other durations'); - }); - - test('duration locale persists with cloning', function (assert) { - moment.locale('en'); - - var a = moment.duration({seconds: 44}).locale('es'), - b = moment.duration(a); - - assert.equal(b.humanize(), 'unos segundos', 'using moment.duration()'); - }); - - test('changing the global locale doesn\'t affect existing duration instances', function (assert) { - var mom = moment.duration(); - moment.locale('fr'); - assert.equal('en', mom.locale()); - }); - - test('duration deprecations', function (assert) { - test.expectedDeprecations('moment().lang()'); - assert.equal(moment.duration().lang(), moment.duration().localeData(), 'duration.lang is the same as duration.localeData'); - }); - - test('from and fromNow with invalid date', function (assert) { - assert.equal(moment(NaN).from(), 'Invalid date', 'moment.from with invalid moment'); - assert.equal(moment(NaN).fromNow(), 'Invalid date', 'moment.fromNow with invalid moment'); - }); - - test('from relative time future', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).subtract({s: 44})), 'in a few seconds', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({s: 45})), 'in a minute', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({s: 89})), 'in a minute', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({s: 90})), 'in 2 minutes', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({m: 44})), 'in 44 minutes', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({m: 45})), 'in an hour', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({m: 89})), 'in an hour', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({m: 90})), 'in 2 hours', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({h: 5})), 'in 5 hours', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({h: 21})), 'in 21 hours', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({h: 22})), 'in a day', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({h: 35})), 'in a day', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({h: 36})), 'in 2 days', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 1})), 'in a day', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 5})), 'in 5 days', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 25})), 'in 25 days', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 26})), 'in a month', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 30})), 'in a month', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 45})), 'in a month', '45 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 47})), 'in 2 months', '47 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 74})), 'in 2 months', '74 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 78})), 'in 3 months', '78 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({M: 1})), 'in a month', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({M: 5})), 'in 5 months', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 315})), 'in 10 months', '315 days = 10 months'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 344})), 'in a year', '344 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 345})), 'in a year', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({d: 548})), 'in 2 years', '548 days = in 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({y: 1})), 'in a year', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).subtract({y: 5})), 'in 5 years', '5 years = 5 years'); - }); - - test('from relative time past', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 44})), 'a few seconds ago', '44 seconds = a few seconds'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 45})), 'a minute ago', '45 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 89})), 'a minute ago', '89 seconds = a minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90})), '2 minutes ago', '90 seconds = 2 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 44})), '44 minutes ago', '44 minutes = 44 minutes'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 45})), 'an hour ago', '45 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 89})), 'an hour ago', '89 minutes = an hour'); - assert.equal(start.from(moment([2007, 1, 28]).add({m: 90})), '2 hours ago', '90 minutes = 2 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 5})), '5 hours ago', '5 hours = 5 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 21})), '21 hours ago', '21 hours = 21 hours'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 22})), 'a day ago', '22 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 35})), 'a day ago', '35 hours = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({h: 36})), '2 days ago', '36 hours = 2 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 1})), 'a day ago', '1 day = a day'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 5})), '5 days ago', '5 days = 5 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 25})), '25 days ago', '25 days = 25 days'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 26})), 'a month ago', '26 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 30})), 'a month ago', '30 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 43})), 'a month ago', '43 days = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 46})), '2 months ago', '46 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 74})), '2 months ago', '75 days = 2 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 76})), '3 months ago', '76 days = 3 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 1})), 'a month ago', '1 month = a month'); - assert.equal(start.from(moment([2007, 1, 28]).add({M: 5})), '5 months ago', '5 months = 5 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 315})), '10 months ago', '315 days = 10 months'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 344})), 'a year ago', '344 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 345})), 'a year ago', '345 days = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({d: 548})), '2 years ago', '548 days = 2 years'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 1})), 'a year ago', '1 year = a year'); - assert.equal(start.from(moment([2007, 1, 28]).add({y: 5})), '5 years ago', '5 years = 5 years'); - }); - - test('instance locale used with from', function (assert) { - moment.locale('en'); - - var a = moment([2012, 5, 6]).locale('es'), - b = moment([2012, 5, 7]); - - assert.equal(a.from(b), 'hace un día', 'preserve locale of first moment'); - assert.equal(b.from(a), 'in a day', 'do not preserve locale of second moment'); - }); - - test('instance localeData', function (assert) { - moment.defineLocale('dude', {week: {dow: 3}}); - assert.equal(moment().locale('dude').localeData()._week.dow, 3); - moment.defineLocale('dude', null); - }); - - test('month name callback function', function (assert) { - function fakeReplace(m, format) { - if (/test/.test(format)) { - return 'test'; - } - if (m.date() === 1) { - return 'date'; - } - return 'default'; - } - - moment.locale('made-up-2', { - months : fakeReplace, - monthsShort : fakeReplace, - weekdays : fakeReplace, - weekdaysShort : fakeReplace, - weekdaysMin : fakeReplace - }); - - assert.equal(moment().format('[test] dd ddd dddd MMM MMMM'), 'test test test test test test', 'format month name function should be able to access the format string'); - assert.equal(moment([2011, 0, 1]).format('dd ddd dddd MMM MMMM'), 'date date date date date', 'format month name function should be able to access the moment object'); - assert.equal(moment([2011, 0, 2]).format('dd ddd dddd MMM MMMM'), 'default default default default default', 'format month name function should be able to access the moment object'); - }); - - test('changing parts of a locale config', function (assert) { - test.expectedDeprecations('defineLocaleOverride'); - - moment.locale('partial-lang', { - months : 'a b c d e f g h i j k l'.split(' ') - }); - - assert.equal(moment([2011, 0, 1]).format('MMMM'), 'a', 'should be able to set locale values when creating the localeuage'); - - moment.locale('partial-lang', { - monthsShort : 'A B C D E F G H I J K L'.split(' ') - }); - - assert.equal(moment([2011, 0, 1]).format('MMMM MMM'), 'a A', 'should be able to set locale values after creating the localeuage'); - - moment.defineLocale('partial-lang', null); - }); - - test('start/endOf week feature for first-day-is-monday locales', function (assert) { - moment.locale('monday-lang', { - week : { - dow : 1 // Monday is the first day of the week - } - }); - - moment.locale('monday-lang'); - assert.equal(moment([2013, 0, 1]).startOf('week').day(), 1, 'for locale monday-lang first day of the week should be monday'); - assert.equal(moment([2013, 0, 1]).endOf('week').day(), 0, 'for locale monday-lang last day of the week should be sunday'); - moment.defineLocale('monday-lang', null); - }); - - test('meridiem parsing', function (assert) { - moment.locale('meridiem-parsing', { - meridiemParse : /[bd]/i, - isPM : function (input) { - return input === 'b'; - } - }); - - moment.locale('meridiem-parsing'); - assert.equal(moment('2012-01-01 3b', 'YYYY-MM-DD ha').hour(), 15, 'Custom parsing of meridiem should work'); - assert.equal(moment('2012-01-01 3d', 'YYYY-MM-DD ha').hour(), 3, 'Custom parsing of meridiem should work'); - moment.defineLocale('meridiem-parsing', null); - }); - - test('invalid date formatting', function (assert) { - moment.locale('has-invalid', { - invalidDate: 'KHAAAAAAAAAAAN!' - }); - - assert.equal(moment.invalid().format(), 'KHAAAAAAAAAAAN!'); - assert.equal(moment.invalid().format('YYYY-MM-DD'), 'KHAAAAAAAAAAAN!'); - moment.defineLocale('has-invalid', null); - }); - - test('return locale name', function (assert) { - var registered = moment.locale('return-this', {}); - - assert.equal(registered, 'return-this', 'returns the locale configured'); - moment.locale('return-this', null); - }); - - test('changing the global locale doesn\'t affect existing instances', function (assert) { - var mom = moment(); - moment.locale('fr'); - assert.equal('en', mom.locale()); - }); - - test('setting a language on instance returns the original moment for chaining', function (assert) { - test.expectedDeprecations('moment().lang()'); - var mom = moment(); - - assert.equal(mom.lang('fr'), mom, 'setting the language (lang) returns the original moment for chaining'); - assert.equal(mom.locale('it'), mom, 'setting the language (locale) returns the original moment for chaining'); - }); - - test('lang(key) changes the language of the instance', function (assert) { - test.expectedDeprecations('moment().lang()'); - var m = moment().month(0); - m.lang('fr'); - assert.equal(m.locale(), 'fr', 'm.lang(key) changes instance locale'); - }); - - test('moment#locale(false) resets to global locale', function (assert) { - var m = moment(); - - moment.locale('fr'); - m.locale('it'); - - assert.equal(moment.locale(), 'fr', 'global locale is it'); - assert.equal(m.locale(), 'it', 'instance locale is it'); - m.locale(false); - assert.equal(m.locale(), 'fr', 'instance locale reset to global locale'); - }); - - test('moment().locale with missing key doesn\'t change locale', function (assert) { - assert.equal(moment().locale('boo').localeData(), moment.localeData(), - 'preserve global locale in case of bad locale id'); - }); - - test('moment().lang with missing key doesn\'t change locale', function (assert) { - test.expectedDeprecations('moment().lang()'); - assert.equal(moment().lang('boo').localeData(), moment.localeData(), - 'preserve global locale in case of bad locale id'); - }); - - - // TODO: Enable this after fixing pl months parse hack hack - // test('monthsParseExact', function (assert) { - // var locale = 'test-months-parse-exact'; - - // moment.defineLocale(locale, { - // monthsParseExact: true, - // months: 'A_AA_AAA_B_B B_BB B_C_C-C_C,C2C_D_D+D_D`D*D'.split('_'), - // monthsShort: 'E_EE_EEE_F_FF_FFF_G_GG_GGG_H_HH_HHH'.split('_') - // }); - - // assert.equal(moment('A', 'MMMM', true).month(), 0, 'parse long month 0 with MMMM'); - // assert.equal(moment('AA', 'MMMM', true).month(), 1, 'parse long month 1 with MMMM'); - // assert.equal(moment('AAA', 'MMMM', true).month(), 2, 'parse long month 2 with MMMM'); - // assert.equal(moment('B B', 'MMMM', true).month(), 4, 'parse long month 4 with MMMM'); - // assert.equal(moment('BB B', 'MMMM', true).month(), 5, 'parse long month 5 with MMMM'); - // assert.equal(moment('C-C', 'MMMM', true).month(), 7, 'parse long month 7 with MMMM'); - // assert.equal(moment('C,C2C', 'MMMM', true).month(), 8, 'parse long month 8 with MMMM'); - // assert.equal(moment('D+D', 'MMMM', true).month(), 10, 'parse long month 10 with MMMM'); - // assert.equal(moment('D`D*D', 'MMMM', true).month(), 11, 'parse long month 11 with MMMM'); - - // assert.equal(moment('E', 'MMM', true).month(), 0, 'parse long month 0 with MMM'); - // assert.equal(moment('EE', 'MMM', true).month(), 1, 'parse long month 1 with MMM'); - // assert.equal(moment('EEE', 'MMM', true).month(), 2, 'parse long month 2 with MMM'); - - // assert.equal(moment('A', 'MMM').month(), 0, 'non-strict parse long month 0 with MMM'); - // assert.equal(moment('AA', 'MMM').month(), 1, 'non-strict parse long month 1 with MMM'); - // assert.equal(moment('AAA', 'MMM').month(), 2, 'non-strict parse long month 2 with MMM'); - // assert.equal(moment('E', 'MMMM').month(), 0, 'non-strict parse short month 0 with MMMM'); - // assert.equal(moment('EE', 'MMMM').month(), 1, 'non-strict parse short month 1 with MMMM'); - // assert.equal(moment('EEE', 'MMMM').month(), 2, 'non-strict parse short month 2 with MMMM'); - // }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('locale inheritance'); - - test('calendar', function (assert) { - moment.defineLocale('base-cal', { - calendar : { - sameDay: '[Today at] HH:mm', - nextDay: '[Tomorrow at] HH:mm', - nextWeek: '[Next week at] HH:mm', - lastDay: '[Yesterday at] HH:mm', - lastWeek: '[Last week at] HH:mm', - sameElse: '[whatever]' - } - }); - moment.defineLocale('child-cal', { - parentLocale: 'base-cal', - calendar: { - sameDay: '[Today] HH:mm', - nextDay: '[Tomorrow] HH:mm', - nextWeek: '[Next week] HH:mm' - } - }); - - moment.locale('child-cal'); - var anchor = moment.utc('2015-05-05T12:00:00', moment.ISO_8601); - assert.equal(anchor.clone().add(3, 'hours').calendar(anchor), 'Today 15:00', 'today uses child version'); - assert.equal(anchor.clone().add(1, 'day').calendar(anchor), 'Tomorrow 12:00', 'tomorrow uses child version'); - assert.equal(anchor.clone().add(3, 'days').calendar(anchor), 'Next week 12:00', 'next week uses child version'); - - assert.equal(anchor.clone().subtract(1, 'day').calendar(anchor), 'Yesterday at 12:00', 'yesterday uses parent version'); - assert.equal(anchor.clone().subtract(3, 'days').calendar(anchor), 'Last week at 12:00', 'last week uses parent version'); - assert.equal(anchor.clone().subtract(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version -'); - assert.equal(anchor.clone().add(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version +'); - }); - - test('missing', function (assert) { - moment.defineLocale('base-cal-2', { - calendar: { - sameDay: '[Today at] HH:mm', - nextDay: '[Tomorrow at] HH:mm', - nextWeek: '[Next week at] HH:mm', - lastDay: '[Yesterday at] HH:mm', - lastWeek: '[Last week at] HH:mm', - sameElse: '[whatever]' - } - }); - moment.defineLocale('child-cal-2', { - parentLocale: 'base-cal-2' - }); - moment.locale('child-cal-2'); - var anchor = moment.utc('2015-05-05T12:00:00', moment.ISO_8601); - assert.equal(anchor.clone().add(3, 'hours').calendar(anchor), 'Today at 15:00', 'today uses parent version'); - assert.equal(anchor.clone().add(1, 'day').calendar(anchor), 'Tomorrow at 12:00', 'tomorrow uses parent version'); - assert.equal(anchor.clone().add(3, 'days').calendar(anchor), 'Next week at 12:00', 'next week uses parent version'); - assert.equal(anchor.clone().subtract(1, 'day').calendar(anchor), 'Yesterday at 12:00', 'yesterday uses parent version'); - assert.equal(anchor.clone().subtract(3, 'days').calendar(anchor), 'Last week at 12:00', 'last week uses parent version'); - assert.equal(anchor.clone().subtract(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version -'); - assert.equal(anchor.clone().add(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version +'); - }); - - // Test function vs obj both directions - - test('long date format', function (assert) { - moment.defineLocale('base-ldf', { - longDateFormat : { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - } - }); - moment.defineLocale('child-ldf', { - parentLocale: 'base-ldf', - longDateFormat: { - LLL : '[child] MMMM D, YYYY h:mm A', - LLLL : '[child] dddd, MMMM D, YYYY h:mm A' - } - }); - - moment.locale('child-ldf'); - var anchor = moment.utc('2015-09-06T12:34:56', moment.ISO_8601); - assert.equal(anchor.format('LTS'), '12:34:56 PM', 'LTS uses base'); - assert.equal(anchor.format('LT'), '12:34 PM', 'LT uses base'); - assert.equal(anchor.format('L'), '09/06/2015', 'L uses base'); - assert.equal(anchor.format('l'), '9/6/2015', 'l uses base'); - assert.equal(anchor.format('LL'), 'September 6, 2015', 'LL uses base'); - assert.equal(anchor.format('ll'), 'Sep 6, 2015', 'll uses base'); - assert.equal(anchor.format('LLL'), 'child September 6, 2015 12:34 PM', 'LLL uses child'); - assert.equal(anchor.format('lll'), 'child Sep 6, 2015 12:34 PM', 'lll uses child'); - assert.equal(anchor.format('LLLL'), 'child Sunday, September 6, 2015 12:34 PM', 'LLLL uses child'); - assert.equal(anchor.format('llll'), 'child Sun, Sep 6, 2015 12:34 PM', 'llll uses child'); - }); - - test('ordinal', function (assert) { - moment.defineLocale('base-ordinal-1', { - ordinal : '%dx' - }); - moment.defineLocale('child-ordinal-1', { - parentLocale: 'base-ordinal-1', - ordinal : '%dy' - }); - - assert.equal(moment.utc('2015-02-03', moment.ISO_8601).format('Do'), '3y', 'ordinal uses child string'); - - moment.defineLocale('base-ordinal-2', { - ordinal : '%dx' - }); - moment.defineLocale('child-ordinal-2', { - parentLocale: 'base-ordinal-2', - ordinal : function (num) { - return num + 'y'; - } - }); - - assert.equal(moment.utc('2015-02-03', moment.ISO_8601).format('Do'), '3y', 'ordinal uses child function'); - - moment.defineLocale('base-ordinal-3', { - ordinal : function (num) { - return num + 'x'; - } - }); - moment.defineLocale('child-ordinal-3', { - parentLocale: 'base-ordinal-3', - ordinal : '%dy' - }); - - assert.equal(moment.utc('2015-02-03', moment.ISO_8601).format('Do'), '3y', 'ordinal uses child string (overwrite parent function)'); - }); - - test('ordinal parse', function (assert) { - moment.defineLocale('base-ordinal-parse-1', { - ordinalParse : /\d{1,2}x/ - }); - moment.defineLocale('child-ordinal-parse-1', { - parentLocale: 'base-ordinal-parse-1', - ordinalParse : /\d{1,2}y/ - }); - - assert.ok(moment.utc('2015-01-1y', 'YYYY-MM-Do', true).isValid(), 'ordinal parse uses child'); - - moment.defineLocale('base-ordinal-parse-2', { - ordinalParse : /\d{1,2}x/ - }); - moment.defineLocale('child-ordinal-parse-2', { - parentLocale: 'base-ordinal-parse-2', - ordinalParse : null - }); - - assert.ok(moment.utc('2015-01-1', 'YYYY-MM-Do', true).isValid(), 'ordinal parse uses child (default)'); - }); - - test('months', function (assert) { - moment.defineLocale('base-months', { - months : 'One_Two_Three_Four_Five_Six_Seven_Eight_Nine_Ten_Eleven_Twelve'.split('_') - }); - moment.defineLocale('child-months', { - parentLocale: 'base-months', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') - }); - assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('locale update'); - - test('calendar', function (assert) { - moment.defineLocale('cal', null); - moment.defineLocale('cal', { - calendar : { - sameDay: '[Today at] HH:mm', - nextDay: '[Tomorrow at] HH:mm', - nextWeek: '[Next week at] HH:mm', - lastDay: '[Yesterday at] HH:mm', - lastWeek: '[Last week at] HH:mm', - sameElse: '[whatever]' - } - }); - moment.updateLocale('cal', { - calendar: { - sameDay: '[Today] HH:mm', - nextDay: '[Tomorrow] HH:mm', - nextWeek: '[Next week] HH:mm' - } - }); - - moment.locale('cal'); - var anchor = moment.utc('2015-05-05T12:00:00', moment.ISO_8601); - assert.equal(anchor.clone().add(3, 'hours').calendar(anchor), 'Today 15:00', 'today uses child version'); - assert.equal(anchor.clone().add(1, 'day').calendar(anchor), 'Tomorrow 12:00', 'tomorrow uses child version'); - assert.equal(anchor.clone().add(3, 'days').calendar(anchor), 'Next week 12:00', 'next week uses child version'); - - assert.equal(anchor.clone().subtract(1, 'day').calendar(anchor), 'Yesterday at 12:00', 'yesterday uses parent version'); - assert.equal(anchor.clone().subtract(3, 'days').calendar(anchor), 'Last week at 12:00', 'last week uses parent version'); - assert.equal(anchor.clone().subtract(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version -'); - assert.equal(anchor.clone().add(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version +'); - }); - - test('missing', function (assert) { - moment.defineLocale('cal-2', null); - moment.defineLocale('cal-2', { - calendar: { - sameDay: '[Today at] HH:mm', - nextDay: '[Tomorrow at] HH:mm', - nextWeek: '[Next week at] HH:mm', - lastDay: '[Yesterday at] HH:mm', - lastWeek: '[Last week at] HH:mm', - sameElse: '[whatever]' - } - }); - moment.updateLocale('cal-2', { - }); - moment.locale('cal-2'); - var anchor = moment.utc('2015-05-05T12:00:00', moment.ISO_8601); - assert.equal(anchor.clone().add(3, 'hours').calendar(anchor), 'Today at 15:00', 'today uses parent version'); - assert.equal(anchor.clone().add(1, 'day').calendar(anchor), 'Tomorrow at 12:00', 'tomorrow uses parent version'); - assert.equal(anchor.clone().add(3, 'days').calendar(anchor), 'Next week at 12:00', 'next week uses parent version'); - assert.equal(anchor.clone().subtract(1, 'day').calendar(anchor), 'Yesterday at 12:00', 'yesterday uses parent version'); - assert.equal(anchor.clone().subtract(3, 'days').calendar(anchor), 'Last week at 12:00', 'last week uses parent version'); - assert.equal(anchor.clone().subtract(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version -'); - assert.equal(anchor.clone().add(7, 'days').calendar(anchor), 'whatever', 'sameElse uses parent version +'); - }); - - // Test function vs obj both directions - - test('long date format', function (assert) { - moment.defineLocale('ldf', null); - moment.defineLocale('ldf', { - longDateFormat : { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - } - }); - moment.updateLocale('ldf', { - longDateFormat: { - LLL : '[child] MMMM D, YYYY h:mm A', - LLLL : '[child] dddd, MMMM D, YYYY h:mm A' - } - }); - - moment.locale('ldf'); - var anchor = moment.utc('2015-09-06T12:34:56', moment.ISO_8601); - assert.equal(anchor.format('LTS'), '12:34:56 PM', 'LTS uses base'); - assert.equal(anchor.format('LT'), '12:34 PM', 'LT uses base'); - assert.equal(anchor.format('L'), '09/06/2015', 'L uses base'); - assert.equal(anchor.format('l'), '9/6/2015', 'l uses base'); - assert.equal(anchor.format('LL'), 'September 6, 2015', 'LL uses base'); - assert.equal(anchor.format('ll'), 'Sep 6, 2015', 'll uses base'); - assert.equal(anchor.format('LLL'), 'child September 6, 2015 12:34 PM', 'LLL uses child'); - assert.equal(anchor.format('lll'), 'child Sep 6, 2015 12:34 PM', 'lll uses child'); - assert.equal(anchor.format('LLLL'), 'child Sunday, September 6, 2015 12:34 PM', 'LLLL uses child'); - assert.equal(anchor.format('llll'), 'child Sun, Sep 6, 2015 12:34 PM', 'llll uses child'); - }); - - test('ordinal', function (assert) { - moment.defineLocale('ordinal-1', null); - moment.defineLocale('ordinal-1', { - ordinal : '%dx' - }); - moment.updateLocale('ordinal-1', { - ordinal : '%dy' - }); - - assert.equal(moment.utc('2015-02-03', moment.ISO_8601).format('Do'), '3y', 'ordinal uses child string'); - - moment.defineLocale('ordinal-2', null); - moment.defineLocale('ordinal-2', { - ordinal : '%dx' - }); - moment.updateLocale('ordinal-2', { - ordinal : function (num) { - return num + 'y'; - } - }); - - assert.equal(moment.utc('2015-02-03', moment.ISO_8601).format('Do'), '3y', 'ordinal uses child function'); - - moment.defineLocale('ordinal-3', null); - moment.defineLocale('ordinal-3', { - ordinal : function (num) { - return num + 'x'; - } - }); - moment.updateLocale('ordinal-3', { - ordinal : '%dy' - }); - - assert.equal(moment.utc('2015-02-03', moment.ISO_8601).format('Do'), '3y', 'ordinal uses child string (overwrite parent function)'); - }); - - test('ordinal parse', function (assert) { - moment.defineLocale('ordinal-parse-1', null); - moment.defineLocale('ordinal-parse-1', { - ordinalParse : /\d{1,2}x/ - }); - moment.updateLocale('ordinal-parse-1', { - ordinalParse : /\d{1,2}y/ - }); - - assert.ok(moment.utc('2015-01-1y', 'YYYY-MM-Do', true).isValid(), 'ordinal parse uses child'); - - moment.defineLocale('ordinal-parse-2', null); - moment.defineLocale('ordinal-parse-2', { - ordinalParse : /\d{1,2}x/ - }); - moment.updateLocale('ordinal-parse-2', { - ordinalParse : null - }); - - assert.ok(moment.utc('2015-01-1', 'YYYY-MM-Do', true).isValid(), 'ordinal parse uses child (default)'); - }); - - test('months', function (assert) { - moment.defineLocale('months', null); - moment.defineLocale('months', { - months : 'One_Two_Three_Four_Five_Six_Seven_Eight_Nine_Ten_Eleven_Twelve'.split('_') - }); - moment.updateLocale('months', { - parentLocale: 'base-months', - months : 'First_Second_Third_Fourth_Fifth_Sixth_Seventh_Eighth_Ninth_Tenth_Eleventh_Twelveth '.split('_') - }); - assert.ok(moment.utc('2015-01-01', 'YYYY-MM-DD').format('MMMM'), 'First', 'months uses child'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('min max'); - - test('min', function (assert) { - var now = moment(), - future = now.clone().add(1, 'month'), - past = now.clone().subtract(1, 'month'), - invalid = moment.invalid(); - - assert.equal(moment.min(now, future, past), past, 'min(now, future, past)'); - assert.equal(moment.min(future, now, past), past, 'min(future, now, past)'); - assert.equal(moment.min(future, past, now), past, 'min(future, past, now)'); - assert.equal(moment.min(past, future, now), past, 'min(past, future, now)'); - assert.equal(moment.min(now, past), past, 'min(now, past)'); - assert.equal(moment.min(past, now), past, 'min(past, now)'); - assert.equal(moment.min(now), now, 'min(now, past)'); - - assert.equal(moment.min([now, future, past]), past, 'min([now, future, past])'); - assert.equal(moment.min([now, past]), past, 'min(now, past)'); - assert.equal(moment.min([now]), now, 'min(now)'); - - assert.equal(moment.min([now, invalid]), invalid, 'min(now, invalid)'); - assert.equal(moment.min([invalid, now]), invalid, 'min(invalid, now)'); - }); - - test('max', function (assert) { - var now = moment(), - future = now.clone().add(1, 'month'), - past = now.clone().subtract(1, 'month'), - invalid = moment.invalid(); - - assert.equal(moment.max(now, future, past), future, 'max(now, future, past)'); - assert.equal(moment.max(future, now, past), future, 'max(future, now, past)'); - assert.equal(moment.max(future, past, now), future, 'max(future, past, now)'); - assert.equal(moment.max(past, future, now), future, 'max(past, future, now)'); - assert.equal(moment.max(now, past), now, 'max(now, past)'); - assert.equal(moment.max(past, now), now, 'max(past, now)'); - assert.equal(moment.max(now), now, 'max(now, past)'); - - assert.equal(moment.max([now, future, past]), future, 'max([now, future, past])'); - assert.equal(moment.max([now, past]), now, 'max(now, past)'); - assert.equal(moment.max([now]), now, 'max(now)'); - - assert.equal(moment.max([now, invalid]), invalid, 'max(now, invalid)'); - assert.equal(moment.max([invalid, now]), invalid, 'max(invalid, now)'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('mutable'); - - test('manipulation methods', function (assert) { - var m = moment(); - - assert.equal(m, m.year(2011), 'year() should be mutable'); - assert.equal(m, m.month(1), 'month() should be mutable'); - assert.equal(m, m.hours(7), 'hours() should be mutable'); - assert.equal(m, m.minutes(33), 'minutes() should be mutable'); - assert.equal(m, m.seconds(44), 'seconds() should be mutable'); - assert.equal(m, m.milliseconds(55), 'milliseconds() should be mutable'); - assert.equal(m, m.day(2), 'day() should be mutable'); - assert.equal(m, m.startOf('week'), 'startOf() should be mutable'); - assert.equal(m, m.add(1, 'days'), 'add() should be mutable'); - assert.equal(m, m.subtract(2, 'years'), 'subtract() should be mutable'); - assert.equal(m, m.local(), 'local() should be mutable'); - assert.equal(m, m.utc(), 'utc() should be mutable'); - }); - - test('non mutable methods', function (assert) { - var m = moment(); - assert.notEqual(m, m.clone(), 'clone() should not be mutable'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('normalize units'); - - test('normalize units', function (assert) { - var fullKeys = ['year', 'quarter', 'month', 'isoWeek', 'week', 'day', 'hour', 'minute', 'second', 'millisecond', 'date', 'dayOfYear', 'weekday', 'isoWeekday', 'weekYear', 'isoWeekYear'], - aliases = ['y', 'Q', 'M', 'W', 'w', 'd', 'h', 'm', 's', 'ms', 'D', 'DDD', 'e', 'E', 'gg', 'GG'], - length = fullKeys.length, - fullKey, - fullKeyCaps, - fullKeyPlural, - fullKeyCapsPlural, - fullKeyLower, - alias, - index; - - for (index = 0; index < length; index += 1) { - fullKey = fullKeys[index]; - fullKeyCaps = fullKey.toUpperCase(); - fullKeyLower = fullKey.toLowerCase(); - fullKeyPlural = fullKey + 's'; - fullKeyCapsPlural = fullKeyCaps + 's'; - alias = aliases[index]; - assert.equal(moment.normalizeUnits(fullKey), fullKey, 'Testing full key ' + fullKey); - assert.equal(moment.normalizeUnits(fullKeyCaps), fullKey, 'Testing full key capitalised ' + fullKey); - assert.equal(moment.normalizeUnits(fullKeyPlural), fullKey, 'Testing full key plural ' + fullKey); - assert.equal(moment.normalizeUnits(fullKeyCapsPlural), fullKey, 'Testing full key capitalised and plural ' + fullKey); - assert.equal(moment.normalizeUnits(alias), fullKey, 'Testing alias ' + fullKey); - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('now'); - - test('now', function (assert) { - var startOfTest = new Date().valueOf(), - momentNowTime = moment.now(), - afterMomentCreationTime = new Date().valueOf(); - - assert.ok(startOfTest <= momentNowTime, 'moment now() time should be now, not in the past'); - assert.ok(momentNowTime <= afterMomentCreationTime, 'moment now() time should be now, not in the future'); - }); - - test('now - Date mocked', function (assert) { - // We need to test mocking the global Date object, so disable 'Read Only' jshint check - /* jshint -W020 */ - var RealDate = Date, - customTimeMs = moment('2015-01-01T01:30:00.000Z').valueOf(); - - function MockDate() { - return new RealDate(customTimeMs); - } - - MockDate.now = function () { - return new MockDate().valueOf(); - }; - - MockDate.prototype = RealDate.prototype; - - Date = MockDate; - - try { - assert.equal(moment().valueOf(), customTimeMs, 'moment now() time should use the global Date object'); - } finally { - Date = RealDate; - } - }); - - test('now - custom value', function (assert) { - var customTimeStr = '2015-01-01T01:30:00.000Z', - customTime = moment(customTimeStr, moment.ISO_8601).valueOf(), - oldFn = moment.now; - - moment.now = function () { - return customTime; - }; - - try { - assert.ok(moment().toISOString() === customTimeStr, 'moment() constructor should use the function defined by moment.now, but it did not'); - assert.ok(moment.utc().toISOString() === customTimeStr, 'moment() constructor should use the function defined by moment.now, but it did not'); - assert.ok(moment.utc([]).toISOString() === '2015-01-01T00:00:00.000Z', 'moment() constructor should fall back to the date defined by moment.now when an empty array is given, but it did not'); - } finally { - moment.now = oldFn; - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('parsing flags'); - - function flags () { - return moment.apply(null, arguments).parsingFlags(); - } - - test('overflow with array', function (assert) { - //months - assert.equal(flags([2010, 0]).overflow, -1, 'month 0 valid'); - assert.equal(flags([2010, 1]).overflow, -1, 'month 1 valid'); - assert.equal(flags([2010, -1]).overflow, 1, 'month -1 invalid'); - assert.equal(flags([2100, 12]).overflow, 1, 'month 12 invalid'); - - //days - assert.equal(flags([2010, 1, 16]).overflow, -1, 'date valid'); - assert.equal(flags([2010, 1, -1]).overflow, 2, 'date -1 invalid'); - assert.equal(flags([2010, 1, 0]).overflow, 2, 'date 0 invalid'); - assert.equal(flags([2010, 1, 32]).overflow, 2, 'date 32 invalid'); - assert.equal(flags([2012, 1, 29]).overflow, -1, 'date leap year valid'); - assert.equal(flags([2010, 1, 29]).overflow, 2, 'date leap year invalid'); - - //hours - assert.equal(flags([2010, 1, 1, 8]).overflow, -1, 'hour valid'); - assert.equal(flags([2010, 1, 1, 0]).overflow, -1, 'hour 0 valid'); - assert.equal(flags([2010, 1, 1, -1]).overflow, 3, 'hour -1 invalid'); - assert.equal(flags([2010, 1, 1, 25]).overflow, 3, 'hour 25 invalid'); - assert.equal(flags([2010, 1, 1, 24, 1]).overflow, 3, 'hour 24:01 invalid'); - - //minutes - assert.equal(flags([2010, 1, 1, 8, 15]).overflow, -1, 'minute valid'); - assert.equal(flags([2010, 1, 1, 8, 0]).overflow, -1, 'minute 0 valid'); - assert.equal(flags([2010, 1, 1, 8, -1]).overflow, 4, 'minute -1 invalid'); - assert.equal(flags([2010, 1, 1, 8, 60]).overflow, 4, 'minute 60 invalid'); - - //seconds - assert.equal(flags([2010, 1, 1, 8, 15, 12]).overflow, -1, 'second valid'); - assert.equal(flags([2010, 1, 1, 8, 15, 0]).overflow, -1, 'second 0 valid'); - assert.equal(flags([2010, 1, 1, 8, 15, -1]).overflow, 5, 'second -1 invalid'); - assert.equal(flags([2010, 1, 1, 8, 15, 60]).overflow, 5, 'second 60 invalid'); - - //milliseconds - assert.equal(flags([2010, 1, 1, 8, 15, 12, 345]).overflow, -1, 'millisecond valid'); - assert.equal(flags([2010, 1, 1, 8, 15, 12, 0]).overflow, -1, 'millisecond 0 valid'); - assert.equal(flags([2010, 1, 1, 8, 15, 12, -1]).overflow, 6, 'millisecond -1 invalid'); - assert.equal(flags([2010, 1, 1, 8, 15, 12, 1000]).overflow, 6, 'millisecond 1000 invalid'); - - // 24 hrs - assert.equal(flags([2010, 1, 1, 24, 0, 0, 0]).overflow, -1, '24:00:00.000 is fine'); - assert.equal(flags([2010, 1, 1, 24, 1, 0, 0]).overflow, 3, '24:01:00.000 is wrong hour'); - assert.equal(flags([2010, 1, 1, 24, 0, 1, 0]).overflow, 3, '24:00:01.000 is wrong hour'); - assert.equal(flags([2010, 1, 1, 24, 0, 0, 1]).overflow, 3, '24:00:00.001 is wrong hour'); - }); - - test('overflow without format', function (assert) { - //months - assert.equal(flags('2001-01', 'YYYY-MM').overflow, -1, 'month 1 valid'); - assert.equal(flags('2001-12', 'YYYY-MM').overflow, -1, 'month 12 valid'); - assert.equal(flags('2001-13', 'YYYY-MM').overflow, 1, 'month 13 invalid'); - - //days - assert.equal(flags('2010-01-16', 'YYYY-MM-DD').overflow, -1, 'date 16 valid'); - assert.equal(flags('2010-01-0', 'YYYY-MM-DD').overflow, 2, 'date 0 invalid'); - assert.equal(flags('2010-01-32', 'YYYY-MM-DD').overflow, 2, 'date 32 invalid'); - assert.equal(flags('2012-02-29', 'YYYY-MM-DD').overflow, -1, 'date leap year valid'); - assert.equal(flags('2010-02-29', 'YYYY-MM-DD').overflow, 2, 'date leap year invalid'); - - //days of the year - assert.equal(flags('2010 300', 'YYYY DDDD').overflow, -1, 'day 300 of year valid'); - assert.equal(flags('2010 365', 'YYYY DDDD').overflow, -1, 'day 365 of year valid'); - assert.equal(flags('2010 366', 'YYYY DDDD').overflow, 2, 'day 366 of year invalid'); - assert.equal(flags('2012 366', 'YYYY DDDD').overflow, -1, 'day 366 of leap year valid'); - assert.equal(flags('2012 367', 'YYYY DDDD').overflow, 2, 'day 367 of leap year invalid'); - - //hours - assert.equal(flags('08', 'HH').overflow, -1, 'hour valid'); - assert.equal(flags('00', 'HH').overflow, -1, 'hour 0 valid'); - assert.equal(flags('25', 'HH').overflow, 3, 'hour 25 invalid'); - assert.equal(flags('24:01', 'HH:mm').overflow, 3, 'hour 24:01 invalid'); - - //minutes - assert.equal(flags('08:15', 'HH:mm').overflow, -1, 'minute valid'); - assert.equal(flags('08:00', 'HH:mm').overflow, -1, 'minute 0 valid'); - assert.equal(flags('08:60', 'HH:mm').overflow, 4, 'minute 60 invalid'); - - //seconds - assert.equal(flags('08:15:12', 'HH:mm:ss').overflow, -1, 'second valid'); - assert.equal(flags('08:15:00', 'HH:mm:ss').overflow, -1, 'second 0 valid'); - assert.equal(flags('08:15:60', 'HH:mm:ss').overflow, 5, 'second 60 invalid'); - - //milliseconds - assert.equal(flags('08:15:12:345', 'HH:mm:ss:SSSS').overflow, -1, 'millisecond valid'); - assert.equal(flags('08:15:12:000', 'HH:mm:ss:SSSS').overflow, -1, 'millisecond 0 valid'); - - //this is OK because we don't match the last digit, so it's 100 ms - assert.equal(flags('08:15:12:1000', 'HH:mm:ss:SSSS').overflow, -1, 'millisecond 1000 actually valid'); - }); - - test('extra tokens', function (assert) { - assert.deepEqual(flags('1982-05-25', 'YYYY-MM-DD').unusedTokens, [], 'nothing extra'); - assert.deepEqual(flags('1982-05', 'YYYY-MM-DD').unusedTokens, ['DD'], 'extra formatting token'); - assert.deepEqual(flags('1982', 'YYYY-MM-DD').unusedTokens, ['MM', 'DD'], 'multiple extra formatting tokens'); - assert.deepEqual(flags('1982-05', 'YYYY-MM-').unusedTokens, [], 'extra non-formatting token'); - assert.deepEqual(flags('1982-05-', 'YYYY-MM-DD').unusedTokens, ['DD'], 'non-extra non-formatting token'); - assert.deepEqual(flags('1982 05 1982', 'YYYY-MM-DD').unusedTokens, [], 'different non-formatting token'); - }); - - test('extra tokens strict', function (assert) { - assert.deepEqual(flags('1982-05-25', 'YYYY-MM-DD', true).unusedTokens, [], 'nothing extra'); - assert.deepEqual(flags('1982-05', 'YYYY-MM-DD', true).unusedTokens, ['-', 'DD'], 'extra formatting token'); - assert.deepEqual(flags('1982', 'YYYY-MM-DD', true).unusedTokens, ['-', 'MM', '-', 'DD'], 'multiple extra formatting tokens'); - assert.deepEqual(flags('1982-05', 'YYYY-MM-', true).unusedTokens, ['-'], 'extra non-formatting token'); - assert.deepEqual(flags('1982-05-', 'YYYY-MM-DD', true).unusedTokens, ['DD'], 'non-extra non-formatting token'); - assert.deepEqual(flags('1982 05 1982', 'YYYY-MM-DD', true).unusedTokens, ['-', '-'], 'different non-formatting token'); - }); - - test('unused input', function (assert) { - assert.deepEqual(flags('1982-05-25', 'YYYY-MM-DD').unusedInput, [], 'normal input'); - assert.deepEqual(flags('1982-05-25 this is more stuff', 'YYYY-MM-DD').unusedInput, [' this is more stuff'], 'trailing nonsense'); - assert.deepEqual(flags('1982-05-25 09:30', 'YYYY-MM-DD').unusedInput, [' 09:30'], ['trailing legit-looking input']); - assert.deepEqual(flags('1982-05-25 some junk', 'YYYY-MM-DD [some junk]').unusedInput, [], 'junk that actually gets matched'); - assert.deepEqual(flags('stuff at beginning 1982-05-25', 'YYYY-MM-DD').unusedInput, ['stuff at beginning '], 'leading junk'); - assert.deepEqual(flags('junk 1982 more junk 05 yet more junk25', 'YYYY-MM-DD').unusedInput, ['junk ', ' more junk ', ' yet more junk'], 'interstitial junk'); - }); - - test('unused input strict', function (assert) { - assert.deepEqual(flags('1982-05-25', 'YYYY-MM-DD', true).unusedInput, [], 'normal input'); - assert.deepEqual(flags('1982-05-25 this is more stuff', 'YYYY-MM-DD', true).unusedInput, [' this is more stuff'], 'trailing nonsense'); - assert.deepEqual(flags('1982-05-25 09:30', 'YYYY-MM-DD', true).unusedInput, [' 09:30'], ['trailing legit-looking input']); - assert.deepEqual(flags('1982-05-25 some junk', 'YYYY-MM-DD [some junk]', true).unusedInput, [], 'junk that actually gets matched'); - assert.deepEqual(flags('stuff at beginning 1982-05-25', 'YYYY-MM-DD', true).unusedInput, ['stuff at beginning '], 'leading junk'); - assert.deepEqual(flags('junk 1982 more junk 05 yet more junk25', 'YYYY-MM-DD', true).unusedInput, ['junk ', ' more junk ', ' yet more junk'], 'interstitial junk'); - }); - - test('chars left over', function (assert) { - assert.equal(flags('1982-05-25', 'YYYY-MM-DD').charsLeftOver, 0, 'normal input'); - assert.equal(flags('1982-05-25 this is more stuff', 'YYYY-MM-DD').charsLeftOver, ' this is more stuff'.length, 'trailing nonsense'); - assert.equal(flags('1982-05-25 09:30', 'YYYY-MM-DD').charsLeftOver, ' 09:30'.length, 'trailing legit-looking input'); - assert.equal(flags('stuff at beginning 1982-05-25', 'YYYY-MM-DD').charsLeftOver, 'stuff at beginning '.length, 'leading junk'); - assert.equal(flags('1982 junk 05 more junk25', 'YYYY-MM-DD').charsLeftOver, [' junk ', ' more junk'].join('').length, 'interstitial junk'); - assert.equal(flags('stuff at beginning 1982 junk 05 more junk25', 'YYYY-MM-DD').charsLeftOver, ['stuff at beginning ', ' junk ', ' more junk'].join('').length, 'leading and interstitial junk'); - }); - - test('empty', function (assert) { - assert.equal(flags('1982-05-25', 'YYYY-MM-DD').empty, false, 'normal input'); - assert.equal(flags('nothing here', 'YYYY-MM-DD').empty, true, 'pure garbage'); - assert.equal(flags('junk but has the number 2000 in it', 'YYYY-MM-DD').empty, false, 'only mostly garbage'); - assert.equal(flags('', 'YYYY-MM-DD').empty, true, 'empty string'); - assert.equal(flags('', 'YYYY-MM-DD').empty, true, 'blank string'); - }); - - test('null', function (assert) { - assert.equal(flags('1982-05-25', 'YYYY-MM-DD').nullInput, false, 'normal input'); - assert.equal(flags(null).nullInput, true, 'just null'); - assert.equal(flags(null, 'YYYY-MM-DD').nullInput, true, 'null with format'); - }); - - test('invalid month', function (assert) { - assert.equal(flags('1982 May', 'YYYY MMMM').invalidMonth, null, 'normal input'); - assert.equal(flags('1982 Laser', 'YYYY MMMM').invalidMonth, 'Laser', 'bad month name'); - }); - - test('empty format array', function (assert) { - assert.equal(flags('1982 May', ['YYYY MMM']).invalidFormat, false, 'empty format array'); - assert.equal(flags('1982 May', []).invalidFormat, true, 'empty format array'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - var symbolMap = { - '1': '!', - '2': '@', - '3': '#', - '4': '$', - '5': '%', - '6': '^', - '7': '&', - '8': '*', - '9': '(', - '0': ')' - }, - numberMap = { - '!': '1', - '@': '2', - '#': '3', - '$': '4', - '%': '5', - '^': '6', - '&': '7', - '*': '8', - '(': '9', - ')': '0' - }; - - module('preparse and postformat', { - setup: function () { - moment.locale('symbol', { - preparse: function (string) { - return string.replace(/[!@#$%\^&*()]/g, function (match) { - return numberMap[match]; - }); - }, - - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - } - }); - }, - teardown: function () { - moment.defineLocale('symbol', null); - } - }); - - test('transform', function (assert) { - assert.equal(moment.utc('@)!@-)*-@&', 'YYYY-MM-DD').unix(), 1346025600, 'preparse string + format'); - assert.equal(moment.utc('@)!@-)*-@&').unix(), 1346025600, 'preparse ISO8601 string'); - assert.equal(moment.unix(1346025600).utc().format('YYYY-MM-DD'), '@)!@-)*-@&', 'postformat'); - }); - - test('transform from', function (assert) { - var start = moment([2007, 1, 28]); - - assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '@ minutes', 'postformat should work on moment.fn.from'); - assert.equal(moment().add(6, 'd').fromNow(true), '^ days', 'postformat should work on moment.fn.fromNow'); - assert.equal(moment.duration(10, 'h').humanize(), '!) hours', 'postformat should work on moment.duration.fn.humanize'); - }); - - test('calendar day', function (assert) { - var a = moment().hours(12).minutes(0).seconds(0); - - assert.equal(moment(a).calendar(), 'Today at !@:)) PM', 'today at the same time'); - assert.equal(moment(a).add({m: 25}).calendar(), 'Today at !@:@% PM', 'Now plus 25 min'); - assert.equal(moment(a).add({h: 1}).calendar(), 'Today at !:)) PM', 'Now plus 1 hour'); - assert.equal(moment(a).add({d: 1}).calendar(), 'Tomorrow at !@:)) PM', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({h: 1}).calendar(), 'Today at !!:)) AM', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({d: 1}).calendar(), 'Yesterday at !@:)) PM', 'yesterday at the same time'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('quarter'); - - test('library quarter getter', function (assert) { - assert.equal(moment([1985, 1, 4]).quarter(), 1, 'Feb 4 1985 is Q1'); - assert.equal(moment([2029, 8, 18]).quarter(), 3, 'Sep 18 2029 is Q3'); - assert.equal(moment([2013, 3, 24]).quarter(), 2, 'Apr 24 2013 is Q2'); - assert.equal(moment([2015, 2, 5]).quarter(), 1, 'Mar 5 2015 is Q1'); - assert.equal(moment([1970, 0, 2]).quarter(), 1, 'Jan 2 1970 is Q1'); - assert.equal(moment([2001, 11, 12]).quarter(), 4, 'Dec 12 2001 is Q4'); - assert.equal(moment([2000, 0, 2]).quarter(), 1, 'Jan 2 2000 is Q1'); - }); - - test('quarter setter singular', function (assert) { - var m = moment([2014, 4, 11]); - assert.equal(m.quarter(2).month(), 4, 'set same quarter'); - assert.equal(m.quarter(3).month(), 7, 'set 3rd quarter'); - assert.equal(m.quarter(1).month(), 1, 'set 1st quarter'); - assert.equal(m.quarter(4).month(), 10, 'set 4th quarter'); - }); - - test('quarter setter plural', function (assert) { - var m = moment([2014, 4, 11]); - assert.equal(m.quarters(2).month(), 4, 'set same quarter'); - assert.equal(m.quarters(3).month(), 7, 'set 3rd quarter'); - assert.equal(m.quarters(1).month(), 1, 'set 1st quarter'); - assert.equal(m.quarters(4).month(), 10, 'set 4th quarter'); - }); - - test('quarter setter programmatic', function (assert) { - var m = moment([2014, 4, 11]); - assert.equal(m.set('quarter', 2).month(), 4, 'set same quarter'); - assert.equal(m.set('quarter', 3).month(), 7, 'set 3rd quarter'); - assert.equal(m.set('quarter', 1).month(), 1, 'set 1st quarter'); - assert.equal(m.set('quarter', 4).month(), 10, 'set 4th quarter'); - }); - - test('quarter setter programmatic plural', function (assert) { - var m = moment([2014, 4, 11]); - assert.equal(m.set('quarters', 2).month(), 4, 'set same quarter'); - assert.equal(m.set('quarters', 3).month(), 7, 'set 3rd quarter'); - assert.equal(m.set('quarters', 1).month(), 1, 'set 1st quarter'); - assert.equal(m.set('quarters', 4).month(), 10, 'set 4th quarter'); - }); - - test('quarter setter programmatic abbr', function (assert) { - var m = moment([2014, 4, 11]); - assert.equal(m.set('Q', 2).month(), 4, 'set same quarter'); - assert.equal(m.set('Q', 3).month(), 7, 'set 3rd quarter'); - assert.equal(m.set('Q', 1).month(), 1, 'set 1st quarter'); - assert.equal(m.set('Q', 4).month(), 10, 'set 4th quarter'); - }); - - test('quarter setter only month changes', function (assert) { - var m = moment([2014, 4, 11, 1, 2, 3, 4]).quarter(4); - assert.equal(m.year(), 2014, 'keep year'); - assert.equal(m.month(), 10, 'set month'); - assert.equal(m.date(), 11, 'keep date'); - assert.equal(m.hour(), 1, 'keep hour'); - assert.equal(m.minute(), 2, 'keep minutes'); - assert.equal(m.second(), 3, 'keep seconds'); - assert.equal(m.millisecond(), 4, 'keep milliseconds'); - }); - - test('quarter setter bubble to next year', function (assert) { - var m = moment([2014, 4, 11, 1, 2, 3, 4]).quarter(7); - assert.equal(m.year(), 2015, 'year bubbled'); - assert.equal(m.month(), 7, 'set month'); - assert.equal(m.date(), 11, 'keep date'); - assert.equal(m.hour(), 1, 'keep hour'); - assert.equal(m.minute(), 2, 'keep minutes'); - assert.equal(m.second(), 3, 'keep seconds'); - assert.equal(m.millisecond(), 4, 'keep milliseconds'); - }); - - test('quarter diff', function (assert) { - assert.equal(moment('2014-01-01').diff(moment('2014-04-01'), 'quarter'), - -1, 'diff -1 quarter'); - assert.equal(moment('2014-04-01').diff(moment('2014-01-01'), 'quarter'), - 1, 'diff 1 quarter'); - assert.equal(moment('2014-05-01').diff(moment('2014-01-01'), 'quarter'), - 1, 'diff 1 quarter'); - assert.ok(Math.abs((4 / 3) - moment('2014-05-01').diff( - moment('2014-01-01'), 'quarter', true)) < 0.00001, - 'diff 1 1/3 quarter'); - assert.equal(moment('2015-01-01').diff(moment('2014-01-01'), 'quarter'), - 4, 'diff 4 quarters'); - }); - - test('quarter setter bubble to previous year', function (assert) { - var m = moment([2014, 4, 11, 1, 2, 3, 4]).quarter(-3); - assert.equal(m.year(), 2013, 'year bubbled'); - assert.equal(m.month(), 1, 'set month'); - assert.equal(m.date(), 11, 'keep date'); - assert.equal(m.hour(), 1, 'keep hour'); - assert.equal(m.minute(), 2, 'keep minutes'); - assert.equal(m.second(), 3, 'keep seconds'); - assert.equal(m.millisecond(), 4, 'keep milliseconds'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('relative time'); - - test('default thresholds fromNow', function (assert) { - var a = moment(); - - // Seconds to minutes threshold - a.subtract(44, 'seconds'); - assert.equal(a.fromNow(), 'a few seconds ago', 'Below default seconds to minutes threshold'); - a.subtract(1, 'seconds'); - assert.equal(a.fromNow(), 'a minute ago', 'Above default seconds to minutes threshold'); - - // Minutes to hours threshold - a = moment(); - a.subtract(44, 'minutes'); - assert.equal(a.fromNow(), '44 minutes ago', 'Below default minute to hour threshold'); - a.subtract(1, 'minutes'); - assert.equal(a.fromNow(), 'an hour ago', 'Above default minute to hour threshold'); - - // Hours to days threshold - a = moment(); - a.subtract(21, 'hours'); - assert.equal(a.fromNow(), '21 hours ago', 'Below default hours to day threshold'); - a.subtract(1, 'hours'); - assert.equal(a.fromNow(), 'a day ago', 'Above default hours to day threshold'); - - // Days to month threshold - a = moment(); - a.subtract(25, 'days'); - assert.equal(a.fromNow(), '25 days ago', 'Below default days to month (singular) threshold'); - a.subtract(1, 'days'); - assert.equal(a.fromNow(), 'a month ago', 'Above default days to month (singular) threshold'); - - // months to year threshold - a = moment(); - a.subtract(10, 'months'); - assert.equal(a.fromNow(), '10 months ago', 'Below default days to years threshold'); - a.subtract(1, 'month'); - assert.equal(a.fromNow(), 'a year ago', 'Above default days to years threshold'); - }); - - test('default thresholds toNow', function (assert) { - var a = moment(); - - // Seconds to minutes threshold - a.subtract(44, 'seconds'); - assert.equal(a.toNow(), 'in a few seconds', 'Below default seconds to minutes threshold'); - a.subtract(1, 'seconds'); - assert.equal(a.toNow(), 'in a minute', 'Above default seconds to minutes threshold'); - - // Minutes to hours threshold - a = moment(); - a.subtract(44, 'minutes'); - assert.equal(a.toNow(), 'in 44 minutes', 'Below default minute to hour threshold'); - a.subtract(1, 'minutes'); - assert.equal(a.toNow(), 'in an hour', 'Above default minute to hour threshold'); - - // Hours to days threshold - a = moment(); - a.subtract(21, 'hours'); - assert.equal(a.toNow(), 'in 21 hours', 'Below default hours to day threshold'); - a.subtract(1, 'hours'); - assert.equal(a.toNow(), 'in a day', 'Above default hours to day threshold'); - - // Days to month threshold - a = moment(); - a.subtract(25, 'days'); - assert.equal(a.toNow(), 'in 25 days', 'Below default days to month (singular) threshold'); - a.subtract(1, 'days'); - assert.equal(a.toNow(), 'in a month', 'Above default days to month (singular) threshold'); - - // months to year threshold - a = moment(); - a.subtract(10, 'months'); - assert.equal(a.toNow(), 'in 10 months', 'Below default days to years threshold'); - a.subtract(1, 'month'); - assert.equal(a.toNow(), 'in a year', 'Above default days to years threshold'); - }); - - test('custom thresholds', function (assert) { - var a; - - // Seconds to minute threshold, under 30 - moment.relativeTimeThreshold('s', 25); - - a = moment(); - a.subtract(24, 'seconds'); - assert.equal(a.fromNow(), 'a few seconds ago', 'Below custom seconds to minute threshold, s < 30'); - a.subtract(1, 'seconds'); - assert.equal(a.fromNow(), 'a minute ago', 'Above custom seconds to minute threshold, s < 30'); - - // Seconds to minutes threshold - moment.relativeTimeThreshold('s', 55); - - a = moment(); - a.subtract(54, 'seconds'); - assert.equal(a.fromNow(), 'a few seconds ago', 'Below custom seconds to minutes threshold'); - a.subtract(1, 'seconds'); - assert.equal(a.fromNow(), 'a minute ago', 'Above custom seconds to minutes threshold'); - - moment.relativeTimeThreshold('s', 45); - - // Minutes to hours threshold - moment.relativeTimeThreshold('m', 55); - a = moment(); - a.subtract(54, 'minutes'); - assert.equal(a.fromNow(), '54 minutes ago', 'Below custom minutes to hours threshold'); - a.subtract(1, 'minutes'); - assert.equal(a.fromNow(), 'an hour ago', 'Above custom minutes to hours threshold'); - moment.relativeTimeThreshold('m', 45); - - // Hours to days threshold - moment.relativeTimeThreshold('h', 24); - a = moment(); - a.subtract(23, 'hours'); - assert.equal(a.fromNow(), '23 hours ago', 'Below custom hours to days threshold'); - a.subtract(1, 'hours'); - assert.equal(a.fromNow(), 'a day ago', 'Above custom hours to days threshold'); - moment.relativeTimeThreshold('h', 22); - - // Days to month threshold - moment.relativeTimeThreshold('d', 28); - a = moment(); - a.subtract(27, 'days'); - assert.equal(a.fromNow(), '27 days ago', 'Below custom days to month (singular) threshold'); - a.subtract(1, 'days'); - assert.equal(a.fromNow(), 'a month ago', 'Above custom days to month (singular) threshold'); - moment.relativeTimeThreshold('d', 26); - - // months to years threshold - moment.relativeTimeThreshold('M', 9); - a = moment(); - a.subtract(8, 'months'); - assert.equal(a.fromNow(), '8 months ago', 'Below custom days to years threshold'); - a.subtract(1, 'months'); - assert.equal(a.fromNow(), 'a year ago', 'Above custom days to years threshold'); - moment.relativeTimeThreshold('M', 11); - }); - - test('retrive threshold settings', function (assert) { - moment.relativeTimeThreshold('m', 45); - var minuteThreshold = moment.relativeTimeThreshold('m'); - - assert.equal(minuteThreshold, 45, 'Can retrieve minute setting'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('start and end of units'); - - test('start of year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('year'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('years'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('y'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 0, 'strip out the month'); - assert.equal(m.date(), 1, 'strip out the day'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of year', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('year'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('years'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('y'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 11, 'set the month'); - assert.equal(m.date(), 31, 'set the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of quarter', function (assert) { - var m = moment(new Date(2011, 4, 2, 3, 4, 5, 6)).startOf('quarter'), - ms = moment(new Date(2011, 4, 2, 3, 4, 5, 6)).startOf('quarters'), - ma = moment(new Date(2011, 4, 2, 3, 4, 5, 6)).startOf('Q'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.quarter(), 2, 'keep the quarter'); - assert.equal(m.month(), 3, 'strip out the month'); - assert.equal(m.date(), 1, 'strip out the day'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of quarter', function (assert) { - var m = moment(new Date(2011, 4, 2, 3, 4, 5, 6)).endOf('quarter'), - ms = moment(new Date(2011, 4, 2, 3, 4, 5, 6)).endOf('quarters'), - ma = moment(new Date(2011, 4, 2, 3, 4, 5, 6)).endOf('Q'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.quarter(), 2, 'keep the quarter'); - assert.equal(m.month(), 5, 'set the month'); - assert.equal(m.date(), 30, 'set the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of month', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('month'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('months'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('M'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 1, 'strip out the day'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of month', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('month'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('months'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('M'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 28, 'set the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of week', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('week'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('weeks'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('w'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 0, 'rolls back to January'); - assert.equal(m.day(), 0, 'set day of week'); - assert.equal(m.date(), 30, 'set correct date'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of week', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('week'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('weeks'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('weeks'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.day(), 6, 'set the day of the week'); - assert.equal(m.date(), 5, 'set the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of iso-week', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('isoWeek'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('isoWeeks'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('W'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 0, 'rollback to January'); - assert.equal(m.isoWeekday(), 1, 'set day of iso-week'); - assert.equal(m.date(), 31, 'set correct date'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of iso-week', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('isoWeek'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('isoWeeks'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('W'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.isoWeekday(), 7, 'set the day of the week'); - assert.equal(m.date(), 6, 'set the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of day', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('day'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('days'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('d'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of day', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('day'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('days'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('d'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of date', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('date'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('dates'); - - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 0, 'strip out the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of date', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('date'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('dates'); - - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 23, 'set the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - - test('start of hour', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('hour'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('hours'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('h'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 3, 'keep the hours'); - assert.equal(m.minutes(), 0, 'strip out the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of hour', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('hour'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('hours'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('h'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 3, 'keep the hours'); - assert.equal(m.minutes(), 59, 'set the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of minute', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('minute'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('minutes'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('m'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 3, 'keep the hours'); - assert.equal(m.minutes(), 4, 'keep the minutes'); - assert.equal(m.seconds(), 0, 'strip out the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of minute', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('minute'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('minutes'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('m'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 3, 'keep the hours'); - assert.equal(m.minutes(), 4, 'keep the minutes'); - assert.equal(m.seconds(), 59, 'set the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('start of second', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('second'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('seconds'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).startOf('s'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 3, 'keep the hours'); - assert.equal(m.minutes(), 4, 'keep the minutes'); - assert.equal(m.seconds(), 5, 'keep the the seconds'); - assert.equal(m.milliseconds(), 0, 'strip out the milliseconds'); - }); - - test('end of second', function (assert) { - var m = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('second'), - ms = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('seconds'), - ma = moment(new Date(2011, 1, 2, 3, 4, 5, 6)).endOf('s'); - assert.equal(+m, +ms, 'Plural or singular should work'); - assert.equal(+m, +ma, 'Full or abbreviated should work'); - assert.equal(m.year(), 2011, 'keep the year'); - assert.equal(m.month(), 1, 'keep the month'); - assert.equal(m.date(), 2, 'keep the day'); - assert.equal(m.hours(), 3, 'keep the hours'); - assert.equal(m.minutes(), 4, 'keep the minutes'); - assert.equal(m.seconds(), 5, 'keep the seconds'); - assert.equal(m.milliseconds(), 999, 'set the seconds'); - }); - - test('startOf across DST +1', function (assert) { - var oldUpdateOffset = moment.updateOffset, - // Based on a real story somewhere in America/Los_Angeles - dstAt = moment('2014-03-09T02:00:00-08:00').parseZone(), - m; - - moment.updateOffset = function (mom, keepTime) { - if (mom.isBefore(dstAt)) { - mom.utcOffset(-8, keepTime); - } else { - mom.utcOffset(-7, keepTime); - } - }; - - m = moment('2014-03-15T00:00:00-07:00').parseZone(); - m.startOf('y'); - assert.equal(m.format(), '2014-01-01T00:00:00-08:00', 'startOf(\'year\') across +1'); - - m = moment('2014-03-15T00:00:00-07:00').parseZone(); - m.startOf('M'); - assert.equal(m.format(), '2014-03-01T00:00:00-08:00', 'startOf(\'month\') across +1'); - - m = moment('2014-03-09T09:00:00-07:00').parseZone(); - m.startOf('d'); - assert.equal(m.format(), '2014-03-09T00:00:00-08:00', 'startOf(\'day\') across +1'); - - m = moment('2014-03-09T03:05:00-07:00').parseZone(); - m.startOf('h'); - assert.equal(m.format(), '2014-03-09T03:00:00-07:00', 'startOf(\'hour\') after +1'); - - m = moment('2014-03-09T01:35:00-08:00').parseZone(); - m.startOf('h'); - assert.equal(m.format(), '2014-03-09T01:00:00-08:00', 'startOf(\'hour\') before +1'); - - // There is no such time as 2:30-7 to try startOf('hour') across that - - moment.updateOffset = oldUpdateOffset; - }); - - test('startOf across DST -1', function (assert) { - var oldUpdateOffset = moment.updateOffset, - // Based on a real story somewhere in America/Los_Angeles - dstAt = moment('2014-11-02T02:00:00-07:00').parseZone(), - m; - - moment.updateOffset = function (mom, keepTime) { - if (mom.isBefore(dstAt)) { - mom.utcOffset(-7, keepTime); - } else { - mom.utcOffset(-8, keepTime); - } - }; - - m = moment('2014-11-15T00:00:00-08:00').parseZone(); - m.startOf('y'); - assert.equal(m.format(), '2014-01-01T00:00:00-07:00', 'startOf(\'year\') across -1'); - - m = moment('2014-11-15T00:00:00-08:00').parseZone(); - m.startOf('M'); - assert.equal(m.format(), '2014-11-01T00:00:00-07:00', 'startOf(\'month\') across -1'); - - m = moment('2014-11-02T09:00:00-08:00').parseZone(); - m.startOf('d'); - assert.equal(m.format(), '2014-11-02T00:00:00-07:00', 'startOf(\'day\') across -1'); - - // note that utc offset is -8 - m = moment('2014-11-02T01:30:00-08:00').parseZone(); - m.startOf('h'); - assert.equal(m.format(), '2014-11-02T01:00:00-08:00', 'startOf(\'hour\') after +1'); - - // note that utc offset is -7 - m = moment('2014-11-02T01:30:00-07:00').parseZone(); - m.startOf('h'); - assert.equal(m.format(), '2014-11-02T01:00:00-07:00', 'startOf(\'hour\') before +1'); - - moment.updateOffset = oldUpdateOffset; - }); - - test('endOf millisecond and no-arg', function (assert) { - var m = moment(); - assert.equal(+m, +m.clone().endOf(), 'endOf without argument should change time'); - assert.equal(+m, +m.clone().endOf('ms'), 'endOf with ms argument should change time'); - assert.equal(+m, +m.clone().endOf('millisecond'), 'endOf with millisecond argument should change time'); - assert.equal(+m, +m.clone().endOf('milliseconds'), 'endOf with milliseconds argument should change time'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('string prototype'); - - test('string prototype overrides call', function (assert) { - var prior = String.prototype.call, b; - String.prototype.call = function () { - return null; - }; - - b = moment(new Date(2011, 7, 28, 15, 25, 50, 125)); - assert.equal(b.format('MMMM Do YYYY, h:mm a'), 'August 28th 2011, 3:25 pm'); - - String.prototype.call = prior; - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('to type'); - - test('toObject', function (assert) { - var expected = { - years:2010, - months:3, - date:5, - hours:15, - minutes:10, - seconds:3, - milliseconds:123 - }; - assert.deepEqual(moment(expected).toObject(), expected, 'toObject invalid'); - }); - - test('toArray', function (assert) { - var expected = [2014, 11, 26, 11, 46, 58, 17]; - assert.deepEqual(moment(expected).toArray(), expected, 'toArray invalid'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('utc'); - - test('utc and local', function (assert) { - var m = moment(Date.UTC(2011, 1, 2, 3, 4, 5, 6)), offset, expected; - m.utc(); - // utc - assert.equal(m.date(), 2, 'the day should be correct for utc'); - assert.equal(m.day(), 3, 'the date should be correct for utc'); - assert.equal(m.hours(), 3, 'the hours should be correct for utc'); - - // local - m.local(); - if (m.utcOffset() < -180) { - assert.equal(m.date(), 1, 'the date should be correct for local'); - assert.equal(m.day(), 2, 'the day should be correct for local'); - } else { - assert.equal(m.date(), 2, 'the date should be correct for local'); - assert.equal(m.day(), 3, 'the day should be correct for local'); - } - offset = Math.floor(m.utcOffset() / 60); - expected = (24 + 3 + offset) % 24; - assert.equal(m.hours(), expected, 'the hours (' + m.hours() + ') should be correct for local'); - assert.equal(moment().utc().utcOffset(), 0, 'timezone in utc should always be zero'); - }); - - test('creating with utc and no arguments', function (assert) { - var startOfTest = new Date().valueOf(), - momentDefaultUtcTime = moment.utc().valueOf(), - afterMomentCreationTime = new Date().valueOf(); - - assert.ok(startOfTest <= momentDefaultUtcTime, 'moment UTC default time should be now, not in the past'); - assert.ok(momentDefaultUtcTime <= afterMomentCreationTime, 'moment UTC default time should be now, not in the future'); - }); - - test('creating with utc and a date parameter array', function (assert) { - var m = moment.utc([2011, 1, 2, 3, 4, 5, 6]); - assert.equal(m.date(), 2, 'the day should be correct for utc array'); - assert.equal(m.hours(), 3, 'the hours should be correct for utc array'); - - m = moment.utc('2011-02-02 3:04:05', 'YYYY-MM-DD HH:mm:ss'); - assert.equal(m.date(), 2, 'the day should be correct for utc parsing format'); - assert.equal(m.hours(), 3, 'the hours should be correct for utc parsing format'); - - m = moment.utc('2011-02-02T03:04:05+00:00'); - assert.equal(m.date(), 2, 'the day should be correct for utc parsing iso'); - assert.equal(m.hours(), 3, 'the hours should be correct for utc parsing iso'); - }); - - test('creating with utc without timezone', function (assert) { - var m = moment.utc('2012-01-02T08:20:00'); - assert.equal(m.date(), 2, 'the day should be correct for utc parse without timezone'); - assert.equal(m.hours(), 8, 'the hours should be correct for utc parse without timezone'); - - m = moment.utc('2012-01-02T08:20:00+09:00'); - assert.equal(m.date(), 1, 'the day should be correct for utc parse with timezone'); - assert.equal(m.hours(), 23, 'the hours should be correct for utc parse with timezone'); - }); - - test('cloning with utc offset', function (assert) { - var m = moment.utc('2012-01-02T08:20:00'); - assert.equal(moment.utc(m)._isUTC, true, 'the local offset should be converted to UTC'); - assert.equal(moment.utc(m.clone().utc())._isUTC, true, 'the local offset should stay in UTC'); - - m.utcOffset(120); - assert.equal(moment.utc(m)._isUTC, true, 'the explicit utc offset should stay in UTC'); - assert.equal(moment.utc(m).utcOffset(), 0, 'the explicit utc offset should have an offset of 0'); - }); - - test('weekday with utc', function (assert) { - assert.equal( - moment('2013-09-15T00:00:00Z').utc().weekday(), // first minute of the day - moment('2013-09-15T23:59:00Z').utc().weekday(), // last minute of the day - 'a UTC-moment\'s .weekday() should not be affected by the local timezone' - ); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('utc offset'); - - test('setter / getter blackbox', function (assert) { - var m = moment([2010]); - - assert.equal(m.clone().utcOffset(0).utcOffset(), 0, 'utcOffset 0'); - - assert.equal(m.clone().utcOffset(1).utcOffset(), 60, 'utcOffset 1 is 60'); - assert.equal(m.clone().utcOffset(60).utcOffset(), 60, 'utcOffset 60'); - assert.equal(m.clone().utcOffset('+01:00').utcOffset(), 60, 'utcOffset +01:00 is 60'); - assert.equal(m.clone().utcOffset('+0100').utcOffset(), 60, 'utcOffset +0100 is 60'); - - assert.equal(m.clone().utcOffset(-1).utcOffset(), -60, 'utcOffset -1 is -60'); - assert.equal(m.clone().utcOffset(-60).utcOffset(), -60, 'utcOffset -60'); - assert.equal(m.clone().utcOffset('-01:00').utcOffset(), -60, 'utcOffset -01:00 is -60'); - assert.equal(m.clone().utcOffset('-0100').utcOffset(), -60, 'utcOffset -0100 is -60'); - - assert.equal(m.clone().utcOffset(1.5).utcOffset(), 90, 'utcOffset 1.5 is 90'); - assert.equal(m.clone().utcOffset(90).utcOffset(), 90, 'utcOffset 1.5 is 90'); - assert.equal(m.clone().utcOffset('+01:30').utcOffset(), 90, 'utcOffset +01:30 is 90'); - assert.equal(m.clone().utcOffset('+0130').utcOffset(), 90, 'utcOffset +0130 is 90'); - - assert.equal(m.clone().utcOffset(-1.5).utcOffset(), -90, 'utcOffset -1.5'); - assert.equal(m.clone().utcOffset(-90).utcOffset(), -90, 'utcOffset -90'); - assert.equal(m.clone().utcOffset('-01:30').utcOffset(), -90, 'utcOffset +01:30 is 90'); - assert.equal(m.clone().utcOffset('-0130').utcOffset(), -90, 'utcOffset +0130 is 90'); - assert.equal(m.clone().utcOffset('+00:10').utcOffset(), 10, 'utcOffset +00:10 is 10'); - assert.equal(m.clone().utcOffset('-00:10').utcOffset(), -10, 'utcOffset +00:10 is 10'); - assert.equal(m.clone().utcOffset('+0010').utcOffset(), 10, 'utcOffset +0010 is 10'); - assert.equal(m.clone().utcOffset('-0010').utcOffset(), -10, 'utcOffset +0010 is 10'); - }); - - test('utcOffset shorthand hours -> minutes', function (assert) { - var i; - for (i = -15; i <= 15; ++i) { - assert.equal(moment().utcOffset(i).utcOffset(), i * 60, - '' + i + ' -> ' + i * 60); - } - assert.equal(moment().utcOffset(-16).utcOffset(), -16, '-16 -> -16'); - assert.equal(moment().utcOffset(16).utcOffset(), 16, '16 -> 16'); - }); - - test('isLocal, isUtc, isUtcOffset', function (assert) { - assert.ok(moment().isLocal(), 'moment() creates objects in local time'); - assert.ok(!moment.utc().isLocal(), 'moment.utc creates objects NOT in local time'); - assert.ok(moment.utc().local().isLocal(), 'moment.fn.local() converts to local time'); - assert.ok(!moment().utcOffset(5).isLocal(), 'moment.fn.utcOffset(N) puts objects NOT in local time'); - assert.ok(moment().utcOffset(5).local().isLocal(), 'moment.fn.local() converts to local time'); - - assert.ok(moment.utc().isUtc(), 'moment.utc() creates objects in utc time'); - assert.ok(moment().utcOffset(0).isUtc(), 'utcOffset(0) is equivalent to utc mode'); - assert.ok(!moment().utcOffset(1).isUtc(), 'utcOffset(1) is NOT equivalent to utc mode'); - - assert.ok(!moment().isUtcOffset(), 'moment() creates objects NOT in utc-offset mode'); - assert.ok(moment.utc().isUtcOffset(), 'moment.utc() creates objects in utc-offset mode'); - assert.ok(moment().utcOffset(3).isUtcOffset(), 'utcOffset(N != 0) creates objects in utc-offset mode'); - assert.ok(moment().utcOffset(0).isUtcOffset(), 'utcOffset(0) creates objects in utc-offset mode'); - }); - - test('isUTC', function (assert) { - assert.ok(moment.utc().isUTC(), 'moment.utc() creates objects in utc time'); - assert.ok(moment().utcOffset(0).isUTC(), 'utcOffset(0) is equivalent to utc mode'); - assert.ok(!moment().utcOffset(1).isUTC(), 'utcOffset(1) is NOT equivalent to utc mode'); - }); - - test('change hours when changing the utc offset', function (assert) { - var m = moment.utc([2000, 0, 1, 6]); - assert.equal(m.hour(), 6, 'UTC 6AM should be 6AM at +0000'); - - // sanity check - m.utcOffset(0); - assert.equal(m.hour(), 6, 'UTC 6AM should be 6AM at +0000'); - - m.utcOffset(-60); - assert.equal(m.hour(), 5, 'UTC 6AM should be 5AM at -0100'); - - m.utcOffset(60); - assert.equal(m.hour(), 7, 'UTC 6AM should be 7AM at +0100'); - }); - - test('change minutes when changing the utc offset', function (assert) { - var m = moment.utc([2000, 0, 1, 6, 31]); - - m.utcOffset(0); - assert.equal(m.format('HH:mm'), '06:31', 'UTC 6:31AM should be 6:31AM at +0000'); - - m.utcOffset(-30); - assert.equal(m.format('HH:mm'), '06:01', 'UTC 6:31AM should be 6:01AM at -0030'); - - m.utcOffset(30); - assert.equal(m.format('HH:mm'), '07:01', 'UTC 6:31AM should be 7:01AM at +0030'); - - m.utcOffset(-1380); - assert.equal(m.format('HH:mm'), '07:31', 'UTC 6:31AM should be 7:31AM at +1380'); - }); - - test('distance from the unix epoch', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA), - zoneC = moment(zoneA), - zoneD = moment(zoneA), - zoneE = moment(zoneA); - - zoneB.utc(); - assert.equal(+zoneA, +zoneB, 'moment should equal moment.utc'); - - zoneC.utcOffset(60); - assert.equal(+zoneA, +zoneC, 'moment should equal moment.utcOffset(60)'); - - zoneD.utcOffset(-480); - assert.equal(+zoneA, +zoneD, - 'moment should equal moment.utcOffset(-480)'); - - zoneE.utcOffset(-1000); - assert.equal(+zoneA, +zoneE, - 'moment should equal moment.utcOffset(-1000)'); - }); - - test('update offset after changing any values', function (assert) { - var oldOffset = moment.updateOffset, - m = moment.utc([2000, 6, 1]); - - moment.updateOffset = function (mom, keepTime) { - if (mom.__doChange) { - if (+mom > 962409600000) { - mom.utcOffset(-120, keepTime); - } else { - mom.utcOffset(-60, keepTime); - } - } - }; - - assert.equal(m.format('ZZ'), '+0000', 'should be at +0000'); - assert.equal(m.format('HH:mm'), '00:00', 'should start 12AM at +0000 timezone'); - - m.__doChange = true; - m.add(1, 'h'); - - assert.equal(m.format('ZZ'), '-0200', 'should be at -0200'); - assert.equal(m.format('HH:mm'), '23:00', '1AM at +0000 should be 11PM at -0200 timezone'); - - m.subtract(1, 'h'); - - assert.equal(m.format('ZZ'), '-0100', 'should be at -0100'); - assert.equal(m.format('HH:mm'), '23:00', '12AM at +0000 should be 11PM at -0100 timezone'); - - moment.updateOffset = oldOffset; - }); - - ////////////////// - test('getters and setters', function (assert) { - var a = moment([2011, 5, 20]); - - assert.equal(a.clone().utcOffset(-120).year(2012).year(), 2012, 'should get and set year correctly'); - assert.equal(a.clone().utcOffset(-120).month(1).month(), 1, 'should get and set month correctly'); - assert.equal(a.clone().utcOffset(-120).date(2).date(), 2, 'should get and set date correctly'); - assert.equal(a.clone().utcOffset(-120).day(1).day(), 1, 'should get and set day correctly'); - assert.equal(a.clone().utcOffset(-120).hour(1).hour(), 1, 'should get and set hour correctly'); - assert.equal(a.clone().utcOffset(-120).minute(1).minute(), 1, 'should get and set minute correctly'); - }); - - test('getters', function (assert) { - var a = moment.utc([2012, 0, 1, 0, 0, 0]); - - assert.equal(a.clone().utcOffset(-120).year(), 2011, 'should get year correctly'); - assert.equal(a.clone().utcOffset(-120).month(), 11, 'should get month correctly'); - assert.equal(a.clone().utcOffset(-120).date(), 31, 'should get date correctly'); - assert.equal(a.clone().utcOffset(-120).hour(), 22, 'should get hour correctly'); - assert.equal(a.clone().utcOffset(-120).minute(), 0, 'should get minute correctly'); - - assert.equal(a.clone().utcOffset(120).year(), 2012, 'should get year correctly'); - assert.equal(a.clone().utcOffset(120).month(), 0, 'should get month correctly'); - assert.equal(a.clone().utcOffset(120).date(), 1, 'should get date correctly'); - assert.equal(a.clone().utcOffset(120).hour(), 2, 'should get hour correctly'); - assert.equal(a.clone().utcOffset(120).minute(), 0, 'should get minute correctly'); - - assert.equal(a.clone().utcOffset(90).year(), 2012, 'should get year correctly'); - assert.equal(a.clone().utcOffset(90).month(), 0, 'should get month correctly'); - assert.equal(a.clone().utcOffset(90).date(), 1, 'should get date correctly'); - assert.equal(a.clone().utcOffset(90).hour(), 1, 'should get hour correctly'); - assert.equal(a.clone().utcOffset(90).minute(), 30, 'should get minute correctly'); - }); - - test('from', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA).utcOffset(-720), - zoneC = moment(zoneA).utcOffset(-360), - zoneD = moment(zoneA).utcOffset(690), - other = moment(zoneA).add(35, 'm'); - - assert.equal(zoneA.from(other), zoneB.from(other), 'moment#from should be the same in all zones'); - assert.equal(zoneA.from(other), zoneC.from(other), 'moment#from should be the same in all zones'); - assert.equal(zoneA.from(other), zoneD.from(other), 'moment#from should be the same in all zones'); - }); - - test('diff', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA).utcOffset(-720), - zoneC = moment(zoneA).utcOffset(-360), - zoneD = moment(zoneA).utcOffset(690), - other = moment(zoneA).add(35, 'm'); - - assert.equal(zoneA.diff(other), zoneB.diff(other), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other), zoneC.diff(other), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other), zoneD.diff(other), 'moment#diff should be the same in all zones'); - - assert.equal(zoneA.diff(other, 'minute', true), zoneB.diff(other, 'minute', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'minute', true), zoneC.diff(other, 'minute', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'minute', true), zoneD.diff(other, 'minute', true), 'moment#diff should be the same in all zones'); - - assert.equal(zoneA.diff(other, 'hour', true), zoneB.diff(other, 'hour', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'hour', true), zoneC.diff(other, 'hour', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'hour', true), zoneD.diff(other, 'hour', true), 'moment#diff should be the same in all zones'); - }); - - test('unix offset and timestamp', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA).utcOffset(-720), - zoneC = moment(zoneA).utcOffset(-360), - zoneD = moment(zoneA).utcOffset(690); - - assert.equal(zoneA.unix(), zoneB.unix(), 'moment#unix should be the same in all zones'); - assert.equal(zoneA.unix(), zoneC.unix(), 'moment#unix should be the same in all zones'); - assert.equal(zoneA.unix(), zoneD.unix(), 'moment#unix should be the same in all zones'); - - assert.equal(+zoneA, +zoneB, 'moment#valueOf should be the same in all zones'); - assert.equal(+zoneA, +zoneC, 'moment#valueOf should be the same in all zones'); - assert.equal(+zoneA, +zoneD, 'moment#valueOf should be the same in all zones'); - }); - - test('cloning', function (assert) { - assert.equal(moment().utcOffset(-120).clone().utcOffset(), -120, - 'explicit cloning should retain the offset'); - assert.equal(moment().utcOffset(120).clone().utcOffset(), 120, - 'explicit cloning should retain the offset'); - assert.equal(moment(moment().utcOffset(-120)).utcOffset(), -120, - 'implicit cloning should retain the offset'); - assert.equal(moment(moment().utcOffset(120)).utcOffset(), 120, - 'implicit cloning should retain the offset'); - }); - - test('start of / end of', function (assert) { - var a = moment.utc([2010, 1, 2, 0, 0, 0]).utcOffset(-450); - - assert.equal(a.clone().startOf('day').hour(), 0, - 'start of day should work on moments with utc offset'); - assert.equal(a.clone().startOf('day').minute(), 0, - 'start of day should work on moments with utc offset'); - assert.equal(a.clone().startOf('hour').minute(), 0, - 'start of hour should work on moments with utc offset'); - - assert.equal(a.clone().endOf('day').hour(), 23, - 'end of day should work on moments with utc offset'); - assert.equal(a.clone().endOf('day').minute(), 59, - 'end of day should work on moments with utc offset'); - assert.equal(a.clone().endOf('hour').minute(), 59, - 'end of hour should work on moments with utc offset'); - }); - - test('reset offset with moment#utc', function (assert) { - var a = moment.utc([2012]).utcOffset(-480); - - assert.equal(a.clone().hour(), 16, 'different utc offset should have different hour'); - assert.equal(a.clone().utc().hour(), 0, 'calling moment#utc should reset the offset'); - }); - - test('reset offset with moment#local', function (assert) { - var a = moment([2012]).utcOffset(-480); - - assert.equal(a.clone().local().hour(), 0, 'calling moment#local should reset the offset'); - }); - - test('toDate', function (assert) { - var zoneA = new Date(), - zoneB = moment(zoneA).utcOffset(-720).toDate(), - zoneC = moment(zoneA).utcOffset(-360).toDate(), - zoneD = moment(zoneA).utcOffset(690).toDate(); - - assert.equal(+zoneA, +zoneB, 'moment#toDate should output a date with the right unix timestamp'); - assert.equal(+zoneA, +zoneC, 'moment#toDate should output a date with the right unix timestamp'); - assert.equal(+zoneA, +zoneD, 'moment#toDate should output a date with the right unix timestamp'); - }); - - test('same / before / after', function (assert) { - var zoneA = moment().utc(), - zoneB = moment(zoneA).utcOffset(-120), - zoneC = moment(zoneA).utcOffset(120); - - assert.ok(zoneA.isSame(zoneB), 'two moments with different offsets should be the same'); - assert.ok(zoneA.isSame(zoneC), 'two moments with different offsets should be the same'); - - assert.ok(zoneA.isSame(zoneB, 'hour'), 'two moments with different offsets should be the same hour'); - assert.ok(zoneA.isSame(zoneC, 'hour'), 'two moments with different offsets should be the same hour'); - - zoneA.add(1, 'hour'); - - assert.ok(zoneA.isAfter(zoneB), 'isAfter should work with two moments with different offsets'); - assert.ok(zoneA.isAfter(zoneC), 'isAfter should work with two moments with different offsets'); - - assert.ok(zoneA.isAfter(zoneB, 'hour'), 'isAfter:hour should work with two moments with different offsets'); - assert.ok(zoneA.isAfter(zoneC, 'hour'), 'isAfter:hour should work with two moments with different offsets'); - - zoneA.subtract(2, 'hour'); - - assert.ok(zoneA.isBefore(zoneB), 'isBefore should work with two moments with different offsets'); - assert.ok(zoneA.isBefore(zoneC), 'isBefore should work with two moments with different offsets'); - - assert.ok(zoneA.isBefore(zoneB, 'hour'), 'isBefore:hour should work with two moments with different offsets'); - assert.ok(zoneA.isBefore(zoneC, 'hour'), 'isBefore:hour should work with two moments with different offsets'); - }); - - test('add / subtract over dst', function (assert) { - var oldOffset = moment.updateOffset, - m = moment.utc([2000, 2, 31, 3]); - - moment.updateOffset = function (mom, keepTime) { - if (mom.clone().utc().month() > 2) { - mom.utcOffset(60, keepTime); - } else { - mom.utcOffset(0, keepTime); - } - }; - - assert.equal(m.hour(), 3, 'should start at 00:00'); - - m.add(24, 'hour'); - - assert.equal(m.hour(), 4, 'adding 24 hours should disregard dst'); - - m.subtract(24, 'hour'); - - assert.equal(m.hour(), 3, 'subtracting 24 hours should disregard dst'); - - m.add(1, 'day'); - - assert.equal(m.hour(), 3, 'adding 1 day should have the same hour'); - - m.subtract(1, 'day'); - - assert.equal(m.hour(), 3, 'subtracting 1 day should have the same hour'); - - m.add(1, 'month'); - - assert.equal(m.hour(), 3, 'adding 1 month should have the same hour'); - - m.subtract(1, 'month'); - - assert.equal(m.hour(), 3, 'subtracting 1 month should have the same hour'); - - moment.updateOffset = oldOffset; - }); - - test('isDST', function (assert) { - var oldOffset = moment.updateOffset; - - moment.updateOffset = function (mom, keepTime) { - if (mom.month() > 2 && mom.month() < 9) { - mom.utcOffset(60, keepTime); - } else { - mom.utcOffset(0, keepTime); - } - }; - - assert.ok(!moment().month(0).isDST(), 'Jan should not be summer dst'); - assert.ok(moment().month(6).isDST(), 'Jul should be summer dst'); - assert.ok(!moment().month(11).isDST(), 'Dec should not be summer dst'); - - moment.updateOffset = function (mom) { - if (mom.month() > 2 && mom.month() < 9) { - mom.utcOffset(0); - } else { - mom.utcOffset(60); - } - }; - - assert.ok(moment().month(0).isDST(), 'Jan should be winter dst'); - assert.ok(!moment().month(6).isDST(), 'Jul should not be winter dst'); - assert.ok(moment().month(11).isDST(), 'Dec should be winter dst'); - - moment.updateOffset = oldOffset; - }); - - test('zone names', function (assert) { - assert.equal(moment().zoneAbbr(), '', 'Local zone abbr should be empty'); - assert.equal(moment().format('z'), '', 'Local zone formatted abbr should be empty'); - assert.equal(moment().zoneName(), '', 'Local zone name should be empty'); - assert.equal(moment().format('zz'), '', 'Local zone formatted name should be empty'); - - assert.equal(moment.utc().zoneAbbr(), 'UTC', 'UTC zone abbr should be UTC'); - assert.equal(moment.utc().format('z'), 'UTC', 'UTC zone formatted abbr should be UTC'); - assert.equal(moment.utc().zoneName(), 'Coordinated Universal Time', 'UTC zone abbr should be Coordinated Universal Time'); - assert.equal(moment.utc().format('zz'), 'Coordinated Universal Time', 'UTC zone formatted abbr should be Coordinated Universal Time'); - }); - - test('hours alignment with UTC', function (assert) { - assert.equal(moment().utcOffset(-120).hasAlignedHourOffset(), true); - assert.equal(moment().utcOffset(180).hasAlignedHourOffset(), true); - assert.equal(moment().utcOffset(-90).hasAlignedHourOffset(), false); - assert.equal(moment().utcOffset(90).hasAlignedHourOffset(), false); - }); - - test('hours alignment with other zone', function (assert) { - var m = moment().utcOffset(-120); - - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-180)), true); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(180)), true); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-90)), false); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(90)), false); - - m = moment().utcOffset(-90); - - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-180)), false); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(180)), false); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-30)), true); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(30)), true); - - m = moment().utcOffset(60); - - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-180)), true); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(180)), true); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-90)), false); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(90)), false); - - m = moment().utcOffset(-25); - - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(35)), true); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-85)), true); - - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(-35)), false); - assert.equal(m.hasAlignedHourOffset(moment().utcOffset(85)), false); - }); - - test('parse zone', function (assert) { - var m = moment('2013-01-01T00:00:00-13:00').parseZone(); - assert.equal(m.utcOffset(), -13 * 60); - assert.equal(m.hours(), 0); - }); - - test('parse zone static', function (assert) { - var m = moment.parseZone('2013-01-01T00:00:00-13:00'); - assert.equal(m.utcOffset(), -13 * 60); - assert.equal(m.hours(), 0); - }); - - test('parse zone with more arguments', function (assert) { - var m; - m = moment.parseZone('2013 01 01 05 -13:00', 'YYYY MM DD HH ZZ'); - assert.equal(m.format(), '2013-01-01T05:00:00-13:00', 'accept input and format'); - m = moment.parseZone('2013-01-01-13:00', 'YYYY MM DD ZZ', true); - assert.equal(m.isValid(), false, 'accept input, format and strict flag'); - m = moment.parseZone('2013-01-01-13:00', ['DD MM YYYY ZZ', 'YYYY MM DD ZZ']); - assert.equal(m.format(), '2013-01-01T00:00:00-13:00', 'accept input and array of formats'); - }); - - test('parse zone with a timezone from the format string', function (assert) { - var m = moment('11-12-2013 -0400 +1100', 'DD-MM-YYYY ZZ #####').parseZone(); - - assert.equal(m.utcOffset(), -4 * 60); - }); - - test('parse zone without a timezone included in the format string', function (assert) { - var m = moment('11-12-2013 -0400 +1100', 'DD-MM-YYYY').parseZone(); - - assert.equal(m.utcOffset(), 11 * 60); - }); - - test('timezone format', function (assert) { - assert.equal(moment().utcOffset(60).format('ZZ'), '+0100', '-60 -> +0100'); - assert.equal(moment().utcOffset(90).format('ZZ'), '+0130', '-90 -> +0130'); - assert.equal(moment().utcOffset(120).format('ZZ'), '+0200', '-120 -> +0200'); - - assert.equal(moment().utcOffset(-60).format('ZZ'), '-0100', '+60 -> -0100'); - assert.equal(moment().utcOffset(-90).format('ZZ'), '-0130', '+90 -> -0130'); - assert.equal(moment().utcOffset(-120).format('ZZ'), '-0200', '+120 -> -0200'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('week year'); - - test('iso week year', function (assert) { - // Some examples taken from http://en.wikipedia.org/wiki/ISO_week - assert.equal(moment([2005, 0, 1]).isoWeekYear(), 2004); - assert.equal(moment([2005, 0, 2]).isoWeekYear(), 2004); - assert.equal(moment([2005, 0, 3]).isoWeekYear(), 2005); - assert.equal(moment([2005, 11, 31]).isoWeekYear(), 2005); - assert.equal(moment([2006, 0, 1]).isoWeekYear(), 2005); - assert.equal(moment([2006, 0, 2]).isoWeekYear(), 2006); - assert.equal(moment([2007, 0, 1]).isoWeekYear(), 2007); - assert.equal(moment([2007, 11, 30]).isoWeekYear(), 2007); - assert.equal(moment([2007, 11, 31]).isoWeekYear(), 2008); - assert.equal(moment([2008, 0, 1]).isoWeekYear(), 2008); - assert.equal(moment([2008, 11, 28]).isoWeekYear(), 2008); - assert.equal(moment([2008, 11, 29]).isoWeekYear(), 2009); - assert.equal(moment([2008, 11, 30]).isoWeekYear(), 2009); - assert.equal(moment([2008, 11, 31]).isoWeekYear(), 2009); - assert.equal(moment([2009, 0, 1]).isoWeekYear(), 2009); - assert.equal(moment([2010, 0, 1]).isoWeekYear(), 2009); - assert.equal(moment([2010, 0, 2]).isoWeekYear(), 2009); - assert.equal(moment([2010, 0, 3]).isoWeekYear(), 2009); - assert.equal(moment([2010, 0, 4]).isoWeekYear(), 2010); - }); - - test('week year', function (assert) { - // Some examples taken from http://en.wikipedia.org/wiki/ISO_week - moment.locale('dow: 1,doy: 4', {week: {dow: 1, doy: 4}}); // like iso - assert.equal(moment([2005, 0, 1]).weekYear(), 2004); - assert.equal(moment([2005, 0, 2]).weekYear(), 2004); - assert.equal(moment([2005, 0, 3]).weekYear(), 2005); - assert.equal(moment([2005, 11, 31]).weekYear(), 2005); - assert.equal(moment([2006, 0, 1]).weekYear(), 2005); - assert.equal(moment([2006, 0, 2]).weekYear(), 2006); - assert.equal(moment([2007, 0, 1]).weekYear(), 2007); - assert.equal(moment([2007, 11, 30]).weekYear(), 2007); - assert.equal(moment([2007, 11, 31]).weekYear(), 2008); - assert.equal(moment([2008, 0, 1]).weekYear(), 2008); - assert.equal(moment([2008, 11, 28]).weekYear(), 2008); - assert.equal(moment([2008, 11, 29]).weekYear(), 2009); - assert.equal(moment([2008, 11, 30]).weekYear(), 2009); - assert.equal(moment([2008, 11, 31]).weekYear(), 2009); - assert.equal(moment([2009, 0, 1]).weekYear(), 2009); - assert.equal(moment([2010, 0, 1]).weekYear(), 2009); - assert.equal(moment([2010, 0, 2]).weekYear(), 2009); - assert.equal(moment([2010, 0, 3]).weekYear(), 2009); - assert.equal(moment([2010, 0, 4]).weekYear(), 2010); - - moment.locale('dow: 1,doy: 7', {week: {dow: 1, doy: 7}}); - assert.equal(moment([2004, 11, 26]).weekYear(), 2004); - assert.equal(moment([2004, 11, 27]).weekYear(), 2005); - assert.equal(moment([2005, 11, 25]).weekYear(), 2005); - assert.equal(moment([2005, 11, 26]).weekYear(), 2006); - assert.equal(moment([2006, 11, 31]).weekYear(), 2006); - assert.equal(moment([2007, 0, 1]).weekYear(), 2007); - assert.equal(moment([2007, 11, 30]).weekYear(), 2007); - assert.equal(moment([2007, 11, 31]).weekYear(), 2008); - assert.equal(moment([2008, 11, 28]).weekYear(), 2008); - assert.equal(moment([2008, 11, 29]).weekYear(), 2009); - assert.equal(moment([2009, 11, 27]).weekYear(), 2009); - assert.equal(moment([2009, 11, 28]).weekYear(), 2010); - }); - - // Verifies that the week number, week day computation is correct for all dow, doy combinations - test('week year roundtrip', function (assert) { - var dow, doy, wd, m, localeName; - for (dow = 0; dow < 7; ++dow) { - for (doy = dow; doy < dow + 7; ++doy) { - for (wd = 0; wd < 7; ++wd) { - localeName = 'dow: ' + dow + ', doy: ' + doy; - moment.locale(localeName, {week: {dow: dow, doy: doy}}); - // We use the 10th week as the 1st one can spill to the previous year - m = moment('2015 10 ' + wd, 'gggg w d', true); - assert.equal(m.format('gggg w d'), '2015 10 ' + wd, 'dow: ' + dow + ' doy: ' + doy + ' wd: ' + wd); - m = moment('2015 10 ' + wd, 'gggg w e', true); - assert.equal(m.format('gggg w e'), '2015 10 ' + wd, 'dow: ' + dow + ' doy: ' + doy + ' wd: ' + wd); - moment.defineLocale(localeName, null); - } - } - } - }); - - test('week numbers 2012/2013', function (assert) { - moment.locale('dow: 6, doy: 12', {week: {dow: 6, doy: 12}}); - assert.equal(52, moment('2012-12-28', 'YYYY-MM-DD').week(), '2012-12-28 is week 52'); // 51 -- should be 52? - assert.equal(1, moment('2012-12-29', 'YYYY-MM-DD').week(), '2012-12-29 is week 1'); // 52 -- should be 1 - assert.equal(1, moment('2013-01-01', 'YYYY-MM-DD').week(), '2013-01-01 is week 1'); // 52 -- should be 1 - assert.equal(2, moment('2013-01-08', 'YYYY-MM-DD').week(), '2013-01-08 is week 2'); // 53 -- should be 2 - assert.equal(2, moment('2013-01-11', 'YYYY-MM-DD').week(), '2013-01-11 is week 2'); // 53 -- should be 2 - assert.equal(3, moment('2013-01-12', 'YYYY-MM-DD').week(), '2013-01-12 is week 3'); // 1 -- should be 3 - assert.equal(52, moment('2012-01-01', 'YYYY-MM-DD').weeksInYear(), 'weeks in 2012 are 52'); // 52 - moment.defineLocale('dow: 6, doy: 12', null); - }); - - test('weeks numbers dow:1 doy:4', function (assert) { - moment.locale('dow: 1, doy: 4', {week: {dow: 1, doy: 4}}); - assert.equal(moment([2012, 0, 1]).week(), 52, 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).week(), 1, 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).week(), 1, 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).week(), 2, 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).week(), 2, 'Jan 15 2012 should be week 2'); - assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); - assert.equal(moment([2007, 0, 7]).week(), 1, 'Jan 7 2007 should be week 1'); - assert.equal(moment([2007, 0, 8]).week(), 2, 'Jan 8 2007 should be week 2'); - assert.equal(moment([2007, 0, 14]).week(), 2, 'Jan 14 2007 should be week 2'); - assert.equal(moment([2007, 0, 15]).week(), 3, 'Jan 15 2007 should be week 3'); - assert.equal(moment([2007, 11, 31]).week(), 1, 'Dec 31 2007 should be week 1'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 6]).week(), 1, 'Jan 6 2008 should be week 1'); - assert.equal(moment([2008, 0, 7]).week(), 2, 'Jan 7 2008 should be week 2'); - assert.equal(moment([2008, 0, 13]).week(), 2, 'Jan 13 2008 should be week 2'); - assert.equal(moment([2008, 0, 14]).week(), 3, 'Jan 14 2008 should be week 3'); - assert.equal(moment([2002, 11, 30]).week(), 1, 'Dec 30 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 5]).week(), 1, 'Jan 5 2003 should be week 1'); - assert.equal(moment([2003, 0, 6]).week(), 2, 'Jan 6 2003 should be week 2'); - assert.equal(moment([2003, 0, 12]).week(), 2, 'Jan 12 2003 should be week 2'); - assert.equal(moment([2003, 0, 13]).week(), 3, 'Jan 13 2003 should be week 3'); - assert.equal(moment([2008, 11, 29]).week(), 1, 'Dec 29 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 4]).week(), 1, 'Jan 4 2009 should be week 1'); - assert.equal(moment([2009, 0, 5]).week(), 2, 'Jan 5 2009 should be week 2'); - assert.equal(moment([2009, 0, 11]).week(), 2, 'Jan 11 2009 should be week 2'); - assert.equal(moment([2009, 0, 13]).week(), 3, 'Jan 12 2009 should be week 3'); - assert.equal(moment([2009, 11, 28]).week(), 53, 'Dec 28 2009 should be week 53'); - assert.equal(moment([2010, 0, 1]).week(), 53, 'Jan 1 2010 should be week 53'); - assert.equal(moment([2010, 0, 3]).week(), 53, 'Jan 3 2010 should be week 53'); - assert.equal(moment([2010, 0, 4]).week(), 1, 'Jan 4 2010 should be week 1'); - assert.equal(moment([2010, 0, 10]).week(), 1, 'Jan 10 2010 should be week 1'); - assert.equal(moment([2010, 0, 11]).week(), 2, 'Jan 11 2010 should be week 2'); - assert.equal(moment([2010, 11, 27]).week(), 52, 'Dec 27 2010 should be week 52'); - assert.equal(moment([2011, 0, 1]).week(), 52, 'Jan 1 2011 should be week 52'); - assert.equal(moment([2011, 0, 2]).week(), 52, 'Jan 2 2011 should be week 52'); - assert.equal(moment([2011, 0, 3]).week(), 1, 'Jan 3 2011 should be week 1'); - assert.equal(moment([2011, 0, 9]).week(), 1, 'Jan 9 2011 should be week 1'); - assert.equal(moment([2011, 0, 10]).week(), 2, 'Jan 10 2011 should be week 2'); - moment.defineLocale('dow: 1, doy: 4', null); - }); - - test('weeks numbers dow:6 doy:12', function (assert) { - moment.locale('dow: 6, doy: 12', {week: {dow: 6, doy: 12}}); - assert.equal(moment([2011, 11, 31]).week(), 1, 'Dec 31 2011 should be week 1'); - assert.equal(moment([2012, 0, 6]).week(), 1, 'Jan 6 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).week(), 2, 'Jan 7 2012 should be week 2'); - assert.equal(moment([2012, 0, 13]).week(), 2, 'Jan 13 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).week(), 3, 'Jan 14 2012 should be week 3'); - assert.equal(moment([2006, 11, 30]).week(), 1, 'Dec 30 2006 should be week 1'); - assert.equal(moment([2007, 0, 5]).week(), 1, 'Jan 5 2007 should be week 1'); - assert.equal(moment([2007, 0, 6]).week(), 2, 'Jan 6 2007 should be week 2'); - assert.equal(moment([2007, 0, 12]).week(), 2, 'Jan 12 2007 should be week 2'); - assert.equal(moment([2007, 0, 13]).week(), 3, 'Jan 13 2007 should be week 3'); - assert.equal(moment([2007, 11, 29]).week(), 1, 'Dec 29 2007 should be week 1'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 4]).week(), 1, 'Jan 4 2008 should be week 1'); - assert.equal(moment([2008, 0, 5]).week(), 2, 'Jan 5 2008 should be week 2'); - assert.equal(moment([2008, 0, 11]).week(), 2, 'Jan 11 2008 should be week 2'); - assert.equal(moment([2008, 0, 12]).week(), 3, 'Jan 12 2008 should be week 3'); - assert.equal(moment([2002, 11, 28]).week(), 1, 'Dec 28 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 3]).week(), 1, 'Jan 3 2003 should be week 1'); - assert.equal(moment([2003, 0, 4]).week(), 2, 'Jan 4 2003 should be week 2'); - assert.equal(moment([2003, 0, 10]).week(), 2, 'Jan 10 2003 should be week 2'); - assert.equal(moment([2003, 0, 11]).week(), 3, 'Jan 11 2003 should be week 3'); - assert.equal(moment([2008, 11, 27]).week(), 1, 'Dec 27 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 2]).week(), 1, 'Jan 2 2009 should be week 1'); - assert.equal(moment([2009, 0, 3]).week(), 2, 'Jan 3 2009 should be week 2'); - assert.equal(moment([2009, 0, 9]).week(), 2, 'Jan 9 2009 should be week 2'); - assert.equal(moment([2009, 0, 10]).week(), 3, 'Jan 10 2009 should be week 3'); - assert.equal(moment([2009, 11, 26]).week(), 1, 'Dec 26 2009 should be week 1'); - assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1'); - assert.equal(moment([2010, 0, 2]).week(), 2, 'Jan 2 2010 should be week 2'); - assert.equal(moment([2010, 0, 8]).week(), 2, 'Jan 8 2010 should be week 2'); - assert.equal(moment([2010, 0, 9]).week(), 3, 'Jan 9 2010 should be week 3'); - assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1'); - assert.equal(moment([2011, 0, 7]).week(), 1, 'Jan 7 2011 should be week 1'); - assert.equal(moment([2011, 0, 8]).week(), 2, 'Jan 8 2011 should be week 2'); - assert.equal(moment([2011, 0, 14]).week(), 2, 'Jan 14 2011 should be week 2'); - assert.equal(moment([2011, 0, 15]).week(), 3, 'Jan 15 2011 should be week 3'); - moment.defineLocale('dow: 6, doy: 12', null); - }); - - test('weeks numbers dow:1 doy:7', function (assert) { - moment.locale('dow: 1, doy: 7', {week: {dow: 1, doy: 7}}); - assert.equal(moment([2011, 11, 26]).week(), 1, 'Dec 26 2011 should be week 1'); - assert.equal(moment([2012, 0, 1]).week(), 1, 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 2]).week(), 2, 'Jan 2 2012 should be week 2'); - assert.equal(moment([2012, 0, 8]).week(), 2, 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 9]).week(), 3, 'Jan 9 2012 should be week 3'); - assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); - assert.equal(moment([2007, 0, 7]).week(), 1, 'Jan 7 2007 should be week 1'); - assert.equal(moment([2007, 0, 8]).week(), 2, 'Jan 8 2007 should be week 2'); - assert.equal(moment([2007, 0, 14]).week(), 2, 'Jan 14 2007 should be week 2'); - assert.equal(moment([2007, 0, 15]).week(), 3, 'Jan 15 2007 should be week 3'); - assert.equal(moment([2007, 11, 31]).week(), 1, 'Dec 31 2007 should be week 1'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 6]).week(), 1, 'Jan 6 2008 should be week 1'); - assert.equal(moment([2008, 0, 7]).week(), 2, 'Jan 7 2008 should be week 2'); - assert.equal(moment([2008, 0, 13]).week(), 2, 'Jan 13 2008 should be week 2'); - assert.equal(moment([2008, 0, 14]).week(), 3, 'Jan 14 2008 should be week 3'); - assert.equal(moment([2002, 11, 30]).week(), 1, 'Dec 30 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 5]).week(), 1, 'Jan 5 2003 should be week 1'); - assert.equal(moment([2003, 0, 6]).week(), 2, 'Jan 6 2003 should be week 2'); - assert.equal(moment([2003, 0, 12]).week(), 2, 'Jan 12 2003 should be week 2'); - assert.equal(moment([2003, 0, 13]).week(), 3, 'Jan 13 2003 should be week 3'); - assert.equal(moment([2008, 11, 29]).week(), 1, 'Dec 29 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 4]).week(), 1, 'Jan 4 2009 should be week 1'); - assert.equal(moment([2009, 0, 5]).week(), 2, 'Jan 5 2009 should be week 2'); - assert.equal(moment([2009, 0, 11]).week(), 2, 'Jan 11 2009 should be week 2'); - assert.equal(moment([2009, 0, 12]).week(), 3, 'Jan 12 2009 should be week 3'); - assert.equal(moment([2009, 11, 28]).week(), 1, 'Dec 28 2009 should be week 1'); - assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1'); - assert.equal(moment([2010, 0, 3]).week(), 1, 'Jan 3 2010 should be week 1'); - assert.equal(moment([2010, 0, 4]).week(), 2, 'Jan 4 2010 should be week 2'); - assert.equal(moment([2010, 0, 10]).week(), 2, 'Jan 10 2010 should be week 2'); - assert.equal(moment([2010, 0, 11]).week(), 3, 'Jan 11 2010 should be week 3'); - assert.equal(moment([2010, 11, 27]).week(), 1, 'Dec 27 2010 should be week 1'); - assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1'); - assert.equal(moment([2011, 0, 2]).week(), 1, 'Jan 2 2011 should be week 1'); - assert.equal(moment([2011, 0, 3]).week(), 2, 'Jan 3 2011 should be week 2'); - assert.equal(moment([2011, 0, 9]).week(), 2, 'Jan 9 2011 should be week 2'); - assert.equal(moment([2011, 0, 10]).week(), 3, 'Jan 10 2011 should be week 3'); - moment.defineLocale('dow: 1, doy: 7', null); - }); - - test('weeks numbers dow:0 doy:6', function (assert) { - moment.locale('dow: 0, doy: 6', {week: {dow: 0, doy: 6}}); - assert.equal(moment([2012, 0, 1]).week(), 1, 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).week(), 1, 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).week(), 2, 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).week(), 2, 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).week(), 3, 'Jan 15 2012 should be week 3'); - assert.equal(moment([2006, 11, 31]).week(), 1, 'Dec 31 2006 should be week 1'); - assert.equal(moment([2007, 0, 1]).week(), 1, 'Jan 1 2007 should be week 1'); - assert.equal(moment([2007, 0, 6]).week(), 1, 'Jan 6 2007 should be week 1'); - assert.equal(moment([2007, 0, 7]).week(), 2, 'Jan 7 2007 should be week 2'); - assert.equal(moment([2007, 0, 13]).week(), 2, 'Jan 13 2007 should be week 2'); - assert.equal(moment([2007, 0, 14]).week(), 3, 'Jan 14 2007 should be week 3'); - assert.equal(moment([2007, 11, 29]).week(), 52, 'Dec 29 2007 should be week 52'); - assert.equal(moment([2008, 0, 1]).week(), 1, 'Jan 1 2008 should be week 1'); - assert.equal(moment([2008, 0, 5]).week(), 1, 'Jan 5 2008 should be week 1'); - assert.equal(moment([2008, 0, 6]).week(), 2, 'Jan 6 2008 should be week 2'); - assert.equal(moment([2008, 0, 12]).week(), 2, 'Jan 12 2008 should be week 2'); - assert.equal(moment([2008, 0, 13]).week(), 3, 'Jan 13 2008 should be week 3'); - assert.equal(moment([2002, 11, 29]).week(), 1, 'Dec 29 2002 should be week 1'); - assert.equal(moment([2003, 0, 1]).week(), 1, 'Jan 1 2003 should be week 1'); - assert.equal(moment([2003, 0, 4]).week(), 1, 'Jan 4 2003 should be week 1'); - assert.equal(moment([2003, 0, 5]).week(), 2, 'Jan 5 2003 should be week 2'); - assert.equal(moment([2003, 0, 11]).week(), 2, 'Jan 11 2003 should be week 2'); - assert.equal(moment([2003, 0, 12]).week(), 3, 'Jan 12 2003 should be week 3'); - assert.equal(moment([2008, 11, 28]).week(), 1, 'Dec 28 2008 should be week 1'); - assert.equal(moment([2009, 0, 1]).week(), 1, 'Jan 1 2009 should be week 1'); - assert.equal(moment([2009, 0, 3]).week(), 1, 'Jan 3 2009 should be week 1'); - assert.equal(moment([2009, 0, 4]).week(), 2, 'Jan 4 2009 should be week 2'); - assert.equal(moment([2009, 0, 10]).week(), 2, 'Jan 10 2009 should be week 2'); - assert.equal(moment([2009, 0, 11]).week(), 3, 'Jan 11 2009 should be week 3'); - assert.equal(moment([2009, 11, 27]).week(), 1, 'Dec 27 2009 should be week 1'); - assert.equal(moment([2010, 0, 1]).week(), 1, 'Jan 1 2010 should be week 1'); - assert.equal(moment([2010, 0, 2]).week(), 1, 'Jan 2 2010 should be week 1'); - assert.equal(moment([2010, 0, 3]).week(), 2, 'Jan 3 2010 should be week 2'); - assert.equal(moment([2010, 0, 9]).week(), 2, 'Jan 9 2010 should be week 2'); - assert.equal(moment([2010, 0, 10]).week(), 3, 'Jan 10 2010 should be week 3'); - assert.equal(moment([2010, 11, 26]).week(), 1, 'Dec 26 2010 should be week 1'); - assert.equal(moment([2011, 0, 1]).week(), 1, 'Jan 1 2011 should be week 1'); - assert.equal(moment([2011, 0, 2]).week(), 2, 'Jan 2 2011 should be week 2'); - assert.equal(moment([2011, 0, 8]).week(), 2, 'Jan 8 2011 should be week 2'); - assert.equal(moment([2011, 0, 9]).week(), 3, 'Jan 9 2011 should be week 3'); - moment.defineLocale('dow: 0, doy: 6', null); - }); - - test('week year overflows', function (assert) { - assert.equal('2005-01-01', moment.utc('2004-W53-6', moment.ISO_8601, true).format('YYYY-MM-DD'), '2004-W53-6 is 1st Jan 2005'); - assert.equal('2007-12-31', moment.utc('2008-W01-1', moment.ISO_8601, true).format('YYYY-MM-DD'), '2008-W01-1 is 31st Dec 2007'); - }); - - test('weeks overflow', function (assert) { - assert.equal(7, moment.utc('2004-W54-1', moment.ISO_8601, true).parsingFlags().overflow, '2004 has only 53 weeks'); - assert.equal(7, moment.utc('2004-W00-1', moment.ISO_8601, true).parsingFlags().overflow, 'there is no 0th week'); - }); - - test('weekday overflow', function (assert) { - assert.equal(8, moment.utc('2004-W30-0', moment.ISO_8601, true).parsingFlags().overflow, 'there is no 0 iso weekday'); - assert.equal(8, moment.utc('2004-W30-8', moment.ISO_8601, true).parsingFlags().overflow, 'there is no 8 iso weekday'); - assert.equal(8, moment.utc('2004-w30-7', 'gggg-[w]ww-e', true).parsingFlags().overflow, 'there is no 7 \'e\' weekday'); - assert.equal(8, moment.utc('2004-w30-7', 'gggg-[w]ww-d', true).parsingFlags().overflow, 'there is no 7 \'d\' weekday'); - }); - - test('week year setter works', function (assert) { - for (var year = 2000; year <= 2020; year += 1) { - assert.equal(moment.utc('2012-12-31T00:00:00.000Z').isoWeekYear(year).isoWeekYear(), year, 'setting iso-week-year to ' + year); - assert.equal(moment.utc('2012-12-31T00:00:00.000Z').weekYear(year).weekYear(), year, 'setting week-year to ' + year); - } - - assert.equal(moment.utc('2004-W53-1', moment.ISO_8601, true).isoWeekYear(2013).format('GGGG-[W]WW-E'), '2013-W52-1', '2004-W53-1 to 2013'); - assert.equal(moment.utc('2004-W53-1', moment.ISO_8601, true).isoWeekYear(2020).format('GGGG-[W]WW-E'), '2020-W53-1', '2004-W53-1 to 2020'); - assert.equal(moment.utc('2005-W52-1', moment.ISO_8601, true).isoWeekYear(2004).format('GGGG-[W]WW-E'), '2004-W52-1', '2005-W52-1 to 2004'); - assert.equal(moment.utc('2013-W30-4', moment.ISO_8601, true).isoWeekYear(2015).format('GGGG-[W]WW-E'), '2015-W30-4', '2013-W30-4 to 2015'); - - assert.equal(moment.utc('2005-w53-0', 'gggg-[w]ww-e', true).weekYear(2013).format('gggg-[w]ww-e'), '2013-w52-0', '2005-w53-0 to 2013'); - assert.equal(moment.utc('2005-w53-0', 'gggg-[w]ww-e', true).weekYear(2016).format('gggg-[w]ww-e'), '2016-w53-0', '2005-w53-0 to 2016'); - assert.equal(moment.utc('2004-w52-0', 'gggg-[w]ww-e', true).weekYear(2005).format('gggg-[w]ww-e'), '2005-w52-0', '2004-w52-0 to 2005'); - assert.equal(moment.utc('2013-w30-4', 'gggg-[w]ww-e', true).weekYear(2015).format('gggg-[w]ww-e'), '2015-w30-4', '2013-w30-4 to 2015'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('week day'); - - test('iso weekday', function (assert) { - var i; - - for (i = 0; i < 7; ++i) { - moment.locale('dow:' + i + ',doy: 6', {week: {dow: i, doy: 6}}); - assert.equal(moment([1985, 1, 4]).isoWeekday(), 1, 'Feb 4 1985 is Monday -- 1st day'); - assert.equal(moment([2029, 8, 18]).isoWeekday(), 2, 'Sep 18 2029 is Tuesday -- 2nd day'); - assert.equal(moment([2013, 3, 24]).isoWeekday(), 3, 'Apr 24 2013 is Wednesday -- 3rd day'); - assert.equal(moment([2015, 2, 5]).isoWeekday(), 4, 'Mar 5 2015 is Thursday -- 4th day'); - assert.equal(moment([1970, 0, 2]).isoWeekday(), 5, 'Jan 2 1970 is Friday -- 5th day'); - assert.equal(moment([2001, 4, 12]).isoWeekday(), 6, 'May 12 2001 is Saturday -- 6th day'); - assert.equal(moment([2000, 0, 2]).isoWeekday(), 7, 'Jan 2 2000 is Sunday -- 7th day'); - } - }); - - test('iso weekday setter', function (assert) { - var a = moment([2011, 0, 10]); - assert.equal(moment(a).isoWeekday(1).date(), 10, 'set from mon to mon'); - assert.equal(moment(a).isoWeekday(4).date(), 13, 'set from mon to thu'); - assert.equal(moment(a).isoWeekday(7).date(), 16, 'set from mon to sun'); - assert.equal(moment(a).isoWeekday(-6).date(), 3, 'set from mon to last mon'); - assert.equal(moment(a).isoWeekday(-3).date(), 6, 'set from mon to last thu'); - assert.equal(moment(a).isoWeekday(0).date(), 9, 'set from mon to last sun'); - assert.equal(moment(a).isoWeekday(8).date(), 17, 'set from mon to next mon'); - assert.equal(moment(a).isoWeekday(11).date(), 20, 'set from mon to next thu'); - assert.equal(moment(a).isoWeekday(14).date(), 23, 'set from mon to next sun'); - - a = moment([2011, 0, 13]); - assert.equal(moment(a).isoWeekday(1).date(), 10, 'set from thu to mon'); - assert.equal(moment(a).isoWeekday(4).date(), 13, 'set from thu to thu'); - assert.equal(moment(a).isoWeekday(7).date(), 16, 'set from thu to sun'); - assert.equal(moment(a).isoWeekday(-6).date(), 3, 'set from thu to last mon'); - assert.equal(moment(a).isoWeekday(-3).date(), 6, 'set from thu to last thu'); - assert.equal(moment(a).isoWeekday(0).date(), 9, 'set from thu to last sun'); - assert.equal(moment(a).isoWeekday(8).date(), 17, 'set from thu to next mon'); - assert.equal(moment(a).isoWeekday(11).date(), 20, 'set from thu to next thu'); - assert.equal(moment(a).isoWeekday(14).date(), 23, 'set from thu to next sun'); - - a = moment([2011, 0, 16]); - assert.equal(moment(a).isoWeekday(1).date(), 10, 'set from sun to mon'); - assert.equal(moment(a).isoWeekday(4).date(), 13, 'set from sun to thu'); - assert.equal(moment(a).isoWeekday(7).date(), 16, 'set from sun to sun'); - assert.equal(moment(a).isoWeekday(-6).date(), 3, 'set from sun to last mon'); - assert.equal(moment(a).isoWeekday(-3).date(), 6, 'set from sun to last thu'); - assert.equal(moment(a).isoWeekday(0).date(), 9, 'set from sun to last sun'); - assert.equal(moment(a).isoWeekday(8).date(), 17, 'set from sun to next mon'); - assert.equal(moment(a).isoWeekday(11).date(), 20, 'set from sun to next thu'); - assert.equal(moment(a).isoWeekday(14).date(), 23, 'set from sun to next sun'); - }); - - test('weekday first day of week Sunday (dow 0)', function (assert) { - moment.locale('dow: 0,doy: 6', {week: {dow: 0, doy: 6}}); - assert.equal(moment([1985, 1, 3]).weekday(), 0, 'Feb 3 1985 is Sunday -- 0th day'); - assert.equal(moment([2029, 8, 17]).weekday(), 1, 'Sep 17 2029 is Monday -- 1st day'); - assert.equal(moment([2013, 3, 23]).weekday(), 2, 'Apr 23 2013 is Tuesday -- 2nd day'); - assert.equal(moment([2015, 2, 4]).weekday(), 3, 'Mar 4 2015 is Wednesday -- 3nd day'); - assert.equal(moment([1970, 0, 1]).weekday(), 4, 'Jan 1 1970 is Thursday -- 4th day'); - assert.equal(moment([2001, 4, 11]).weekday(), 5, 'May 11 2001 is Friday -- 5th day'); - assert.equal(moment([2000, 0, 1]).weekday(), 6, 'Jan 1 2000 is Saturday -- 6th day'); - }); - - test('weekday first day of week Monday (dow 1)', function (assert) { - moment.locale('dow: 1,doy: 6', {week: {dow: 1, doy: 6}}); - assert.equal(moment([1985, 1, 4]).weekday(), 0, 'Feb 4 1985 is Monday -- 0th day'); - assert.equal(moment([2029, 8, 18]).weekday(), 1, 'Sep 18 2029 is Tuesday -- 1st day'); - assert.equal(moment([2013, 3, 24]).weekday(), 2, 'Apr 24 2013 is Wednesday -- 2nd day'); - assert.equal(moment([2015, 2, 5]).weekday(), 3, 'Mar 5 2015 is Thursday -- 3nd day'); - assert.equal(moment([1970, 0, 2]).weekday(), 4, 'Jan 2 1970 is Friday -- 4th day'); - assert.equal(moment([2001, 4, 12]).weekday(), 5, 'May 12 2001 is Saturday -- 5th day'); - assert.equal(moment([2000, 0, 2]).weekday(), 6, 'Jan 2 2000 is Sunday -- 6th day'); - }); - - test('weekday first day of week Tuesday (dow 2)', function (assert) { - moment.locale('dow: 2,doy: 6', {week: {dow: 2, doy: 6}}); - assert.equal(moment([1985, 1, 5]).weekday(), 0, 'Feb 5 1985 is Tuesday -- 0th day'); - assert.equal(moment([2029, 8, 19]).weekday(), 1, 'Sep 19 2029 is Wednesday -- 1st day'); - assert.equal(moment([2013, 3, 25]).weekday(), 2, 'Apr 25 2013 is Thursday -- 2nd day'); - assert.equal(moment([2015, 2, 6]).weekday(), 3, 'Mar 6 2015 is Friday -- 3nd day'); - assert.equal(moment([1970, 0, 3]).weekday(), 4, 'Jan 3 1970 is Staturday -- 4th day'); - assert.equal(moment([2001, 4, 13]).weekday(), 5, 'May 13 2001 is Sunday -- 5th day'); - assert.equal(moment([2000, 0, 3]).weekday(), 6, 'Jan 3 2000 is Monday -- 6th day'); - }); - - test('weekday first day of week Wednesday (dow 3)', function (assert) { - moment.locale('dow: 3,doy: 6', {week: {dow: 3, doy: 6}}); - assert.equal(moment([1985, 1, 6]).weekday(), 0, 'Feb 6 1985 is Wednesday -- 0th day'); - assert.equal(moment([2029, 8, 20]).weekday(), 1, 'Sep 20 2029 is Thursday -- 1st day'); - assert.equal(moment([2013, 3, 26]).weekday(), 2, 'Apr 26 2013 is Friday -- 2nd day'); - assert.equal(moment([2015, 2, 7]).weekday(), 3, 'Mar 7 2015 is Saturday -- 3nd day'); - assert.equal(moment([1970, 0, 4]).weekday(), 4, 'Jan 4 1970 is Sunday -- 4th day'); - assert.equal(moment([2001, 4, 14]).weekday(), 5, 'May 14 2001 is Monday -- 5th day'); - assert.equal(moment([2000, 0, 4]).weekday(), 6, 'Jan 4 2000 is Tuesday -- 6th day'); - moment.locale('dow:3,doy:6', null); - }); - - test('weekday first day of week Thursday (dow 4)', function (assert) { - moment.locale('dow: 4,doy: 6', {week: {dow: 4, doy: 6}}); - assert.equal(moment([1985, 1, 7]).weekday(), 0, 'Feb 7 1985 is Thursday -- 0th day'); - assert.equal(moment([2029, 8, 21]).weekday(), 1, 'Sep 21 2029 is Friday -- 1st day'); - assert.equal(moment([2013, 3, 27]).weekday(), 2, 'Apr 27 2013 is Saturday -- 2nd day'); - assert.equal(moment([2015, 2, 8]).weekday(), 3, 'Mar 8 2015 is Sunday -- 3nd day'); - assert.equal(moment([1970, 0, 5]).weekday(), 4, 'Jan 5 1970 is Monday -- 4th day'); - assert.equal(moment([2001, 4, 15]).weekday(), 5, 'May 15 2001 is Tuesday -- 5th day'); - assert.equal(moment([2000, 0, 5]).weekday(), 6, 'Jan 5 2000 is Wednesday -- 6th day'); - }); - - test('weekday first day of week Friday (dow 5)', function (assert) { - moment.locale('dow: 5,doy: 6', {week: {dow: 5, doy: 6}}); - assert.equal(moment([1985, 1, 8]).weekday(), 0, 'Feb 8 1985 is Friday -- 0th day'); - assert.equal(moment([2029, 8, 22]).weekday(), 1, 'Sep 22 2029 is Staturday -- 1st day'); - assert.equal(moment([2013, 3, 28]).weekday(), 2, 'Apr 28 2013 is Sunday -- 2nd day'); - assert.equal(moment([2015, 2, 9]).weekday(), 3, 'Mar 9 2015 is Monday -- 3nd day'); - assert.equal(moment([1970, 0, 6]).weekday(), 4, 'Jan 6 1970 is Tuesday -- 4th day'); - assert.equal(moment([2001, 4, 16]).weekday(), 5, 'May 16 2001 is Wednesday -- 5th day'); - assert.equal(moment([2000, 0, 6]).weekday(), 6, 'Jan 6 2000 is Thursday -- 6th day'); - }); - - test('weekday first day of week Saturday (dow 6)', function (assert) { - moment.locale('dow: 6,doy: 6', {week: {dow: 6, doy: 6}}); - assert.equal(moment([1985, 1, 9]).weekday(), 0, 'Feb 9 1985 is Staturday -- 0th day'); - assert.equal(moment([2029, 8, 23]).weekday(), 1, 'Sep 23 2029 is Sunday -- 1st day'); - assert.equal(moment([2013, 3, 29]).weekday(), 2, 'Apr 29 2013 is Monday -- 2nd day'); - assert.equal(moment([2015, 2, 10]).weekday(), 3, 'Mar 10 2015 is Tuesday -- 3nd day'); - assert.equal(moment([1970, 0, 7]).weekday(), 4, 'Jan 7 1970 is Wednesday -- 4th day'); - assert.equal(moment([2001, 4, 17]).weekday(), 5, 'May 17 2001 is Thursday -- 5th day'); - assert.equal(moment([2000, 0, 7]).weekday(), 6, 'Jan 7 2000 is Friday -- 6th day'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('weeks'); - - test('day of year', function (assert) { - assert.equal(moment([2000, 0, 1]).dayOfYear(), 1, 'Jan 1 2000 should be day 1 of the year'); - assert.equal(moment([2000, 1, 28]).dayOfYear(), 59, 'Feb 28 2000 should be day 59 of the year'); - assert.equal(moment([2000, 1, 29]).dayOfYear(), 60, 'Feb 28 2000 should be day 60 of the year'); - assert.equal(moment([2000, 11, 31]).dayOfYear(), 366, 'Dec 31 2000 should be day 366 of the year'); - assert.equal(moment([2001, 0, 1]).dayOfYear(), 1, 'Jan 1 2001 should be day 1 of the year'); - assert.equal(moment([2001, 1, 28]).dayOfYear(), 59, 'Feb 28 2001 should be day 59 of the year'); - assert.equal(moment([2001, 2, 1]).dayOfYear(), 60, 'Mar 1 2001 should be day 60 of the year'); - assert.equal(moment([2001, 11, 31]).dayOfYear(), 365, 'Dec 31 2001 should be day 365 of the year'); - }); - - test('day of year setters', function (assert) { - assert.equal(moment([2000, 0, 1]).dayOfYear(200).dayOfYear(), 200, 'Setting Jan 1 2000 day of the year to 200 should work'); - assert.equal(moment([2000, 1, 28]).dayOfYear(200).dayOfYear(), 200, 'Setting Feb 28 2000 day of the year to 200 should work'); - assert.equal(moment([2000, 1, 29]).dayOfYear(200).dayOfYear(), 200, 'Setting Feb 28 2000 day of the year to 200 should work'); - assert.equal(moment([2000, 11, 31]).dayOfYear(200).dayOfYear(), 200, 'Setting Dec 31 2000 day of the year to 200 should work'); - assert.equal(moment().dayOfYear(1).dayOfYear(), 1, 'Setting day of the year to 1 should work'); - assert.equal(moment().dayOfYear(59).dayOfYear(), 59, 'Setting day of the year to 59 should work'); - assert.equal(moment().dayOfYear(60).dayOfYear(), 60, 'Setting day of the year to 60 should work'); - assert.equal(moment().dayOfYear(365).dayOfYear(), 365, 'Setting day of the year to 365 should work'); - }); - - test('iso weeks year starting sunday', function (assert) { - assert.equal(moment([2012, 0, 1]).isoWeek(), 52, 'Jan 1 2012 should be iso week 52'); - assert.equal(moment([2012, 0, 2]).isoWeek(), 1, 'Jan 2 2012 should be iso week 1'); - assert.equal(moment([2012, 0, 8]).isoWeek(), 1, 'Jan 8 2012 should be iso week 1'); - assert.equal(moment([2012, 0, 9]).isoWeek(), 2, 'Jan 9 2012 should be iso week 2'); - assert.equal(moment([2012, 0, 15]).isoWeek(), 2, 'Jan 15 2012 should be iso week 2'); - }); - - test('iso weeks year starting monday', function (assert) { - assert.equal(moment([2007, 0, 1]).isoWeek(), 1, 'Jan 1 2007 should be iso week 1'); - assert.equal(moment([2007, 0, 7]).isoWeek(), 1, 'Jan 7 2007 should be iso week 1'); - assert.equal(moment([2007, 0, 8]).isoWeek(), 2, 'Jan 8 2007 should be iso week 2'); - assert.equal(moment([2007, 0, 14]).isoWeek(), 2, 'Jan 14 2007 should be iso week 2'); - assert.equal(moment([2007, 0, 15]).isoWeek(), 3, 'Jan 15 2007 should be iso week 3'); - }); - - test('iso weeks year starting tuesday', function (assert) { - assert.equal(moment([2007, 11, 31]).isoWeek(), 1, 'Dec 31 2007 should be iso week 1'); - assert.equal(moment([2008, 0, 1]).isoWeek(), 1, 'Jan 1 2008 should be iso week 1'); - assert.equal(moment([2008, 0, 6]).isoWeek(), 1, 'Jan 6 2008 should be iso week 1'); - assert.equal(moment([2008, 0, 7]).isoWeek(), 2, 'Jan 7 2008 should be iso week 2'); - assert.equal(moment([2008, 0, 13]).isoWeek(), 2, 'Jan 13 2008 should be iso week 2'); - assert.equal(moment([2008, 0, 14]).isoWeek(), 3, 'Jan 14 2008 should be iso week 3'); - }); - - test('iso weeks year starting wednesday', function (assert) { - assert.equal(moment([2002, 11, 30]).isoWeek(), 1, 'Dec 30 2002 should be iso week 1'); - assert.equal(moment([2003, 0, 1]).isoWeek(), 1, 'Jan 1 2003 should be iso week 1'); - assert.equal(moment([2003, 0, 5]).isoWeek(), 1, 'Jan 5 2003 should be iso week 1'); - assert.equal(moment([2003, 0, 6]).isoWeek(), 2, 'Jan 6 2003 should be iso week 2'); - assert.equal(moment([2003, 0, 12]).isoWeek(), 2, 'Jan 12 2003 should be iso week 2'); - assert.equal(moment([2003, 0, 13]).isoWeek(), 3, 'Jan 13 2003 should be iso week 3'); - }); - - test('iso weeks year starting thursday', function (assert) { - assert.equal(moment([2008, 11, 29]).isoWeek(), 1, 'Dec 29 2008 should be iso week 1'); - assert.equal(moment([2009, 0, 1]).isoWeek(), 1, 'Jan 1 2009 should be iso week 1'); - assert.equal(moment([2009, 0, 4]).isoWeek(), 1, 'Jan 4 2009 should be iso week 1'); - assert.equal(moment([2009, 0, 5]).isoWeek(), 2, 'Jan 5 2009 should be iso week 2'); - assert.equal(moment([2009, 0, 11]).isoWeek(), 2, 'Jan 11 2009 should be iso week 2'); - assert.equal(moment([2009, 0, 13]).isoWeek(), 3, 'Jan 12 2009 should be iso week 3'); - }); - - test('iso weeks year starting friday', function (assert) { - assert.equal(moment([2009, 11, 28]).isoWeek(), 53, 'Dec 28 2009 should be iso week 53'); - assert.equal(moment([2010, 0, 1]).isoWeek(), 53, 'Jan 1 2010 should be iso week 53'); - assert.equal(moment([2010, 0, 3]).isoWeek(), 53, 'Jan 3 2010 should be iso week 53'); - assert.equal(moment([2010, 0, 4]).isoWeek(), 1, 'Jan 4 2010 should be iso week 1'); - assert.equal(moment([2010, 0, 10]).isoWeek(), 1, 'Jan 10 2010 should be iso week 1'); - assert.equal(moment([2010, 0, 11]).isoWeek(), 2, 'Jan 11 2010 should be iso week 2'); - }); - - test('iso weeks year starting saturday', function (assert) { - assert.equal(moment([2010, 11, 27]).isoWeek(), 52, 'Dec 27 2010 should be iso week 52'); - assert.equal(moment([2011, 0, 1]).isoWeek(), 52, 'Jan 1 2011 should be iso week 52'); - assert.equal(moment([2011, 0, 2]).isoWeek(), 52, 'Jan 2 2011 should be iso week 52'); - assert.equal(moment([2011, 0, 3]).isoWeek(), 1, 'Jan 3 2011 should be iso week 1'); - assert.equal(moment([2011, 0, 9]).isoWeek(), 1, 'Jan 9 2011 should be iso week 1'); - assert.equal(moment([2011, 0, 10]).isoWeek(), 2, 'Jan 10 2011 should be iso week 2'); - }); - - test('iso weeks year starting sunday formatted', function (assert) { - assert.equal(moment([2012, 0, 1]).format('W WW Wo'), '52 52 52nd', 'Jan 1 2012 should be iso week 52'); - assert.equal(moment([2012, 0, 2]).format('W WW Wo'), '1 01 1st', 'Jan 2 2012 should be iso week 1'); - assert.equal(moment([2012, 0, 8]).format('W WW Wo'), '1 01 1st', 'Jan 8 2012 should be iso week 1'); - assert.equal(moment([2012, 0, 9]).format('W WW Wo'), '2 02 2nd', 'Jan 9 2012 should be iso week 2'); - assert.equal(moment([2012, 0, 15]).format('W WW Wo'), '2 02 2nd', 'Jan 15 2012 should be iso week 2'); - }); - - test('weeks plural year starting sunday', function (assert) { - assert.equal(moment([2012, 0, 1]).weeks(), 1, 'Jan 1 2012 should be week 1'); - assert.equal(moment([2012, 0, 7]).weeks(), 1, 'Jan 7 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).weeks(), 2, 'Jan 8 2012 should be week 2'); - assert.equal(moment([2012, 0, 14]).weeks(), 2, 'Jan 14 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).weeks(), 3, 'Jan 15 2012 should be week 3'); - }); - - test('iso weeks plural year starting sunday', function (assert) { - assert.equal(moment([2012, 0, 1]).isoWeeks(), 52, 'Jan 1 2012 should be iso week 52'); - assert.equal(moment([2012, 0, 2]).isoWeeks(), 1, 'Jan 2 2012 should be iso week 1'); - assert.equal(moment([2012, 0, 8]).isoWeeks(), 1, 'Jan 8 2012 should be iso week 1'); - assert.equal(moment([2012, 0, 9]).isoWeeks(), 2, 'Jan 9 2012 should be iso week 2'); - assert.equal(moment([2012, 0, 15]).isoWeeks(), 2, 'Jan 15 2012 should be iso week 2'); - }); - - test('weeks setter', function (assert) { - assert.equal(moment([2012, 0, 1]).week(30).week(), 30, 'Setting Jan 1 2012 to week 30 should work'); - assert.equal(moment([2012, 0, 7]).week(30).week(), 30, 'Setting Jan 7 2012 to week 30 should work'); - assert.equal(moment([2012, 0, 8]).week(30).week(), 30, 'Setting Jan 8 2012 to week 30 should work'); - assert.equal(moment([2012, 0, 14]).week(30).week(), 30, 'Setting Jan 14 2012 to week 30 should work'); - assert.equal(moment([2012, 0, 15]).week(30).week(), 30, 'Setting Jan 15 2012 to week 30 should work'); - }); - - test('iso weeks setter', function (assert) { - assert.equal(moment([2012, 0, 1]).isoWeeks(25).isoWeeks(), 25, 'Setting Jan 1 2012 to week 25 should work'); - assert.equal(moment([2012, 0, 2]).isoWeeks(24).isoWeeks(), 24, 'Setting Jan 2 2012 to week 24 should work'); - assert.equal(moment([2012, 0, 8]).isoWeeks(23).isoWeeks(), 23, 'Setting Jan 8 2012 to week 23 should work'); - assert.equal(moment([2012, 0, 9]).isoWeeks(22).isoWeeks(), 22, 'Setting Jan 9 2012 to week 22 should work'); - assert.equal(moment([2012, 0, 15]).isoWeeks(21).isoWeeks(), 21, 'Setting Jan 15 2012 to week 21 should work'); - }); - - test('iso weeks setter day of year', function (assert) { - assert.equal(moment([2012, 0, 1]).isoWeek(1).dayOfYear(), 9, 'Setting Jan 1 2012 to week 1 should be day of year 8'); - assert.equal(moment([2012, 0, 1]).isoWeek(1).year(), 2011, 'Setting Jan 1 2012 to week 1 should be year 2011'); - assert.equal(moment([2012, 0, 2]).isoWeek(1).dayOfYear(), 2, 'Setting Jan 2 2012 to week 1 should be day of year 2'); - assert.equal(moment([2012, 0, 8]).isoWeek(1).dayOfYear(), 8, 'Setting Jan 8 2012 to week 1 should be day of year 8'); - assert.equal(moment([2012, 0, 9]).isoWeek(1).dayOfYear(), 2, 'Setting Jan 9 2012 to week 1 should be day of year 2'); - assert.equal(moment([2012, 0, 15]).isoWeek(1).dayOfYear(), 8, 'Setting Jan 15 2012 to week 1 should be day of year 8'); - }); - - test('years with iso week 53', function (assert) { - // Based on a table taken from http://en.wikipedia.org/wiki/ISO_week_date - // (as downloaded on 2014-01-06) listing the 71 years in a 400-year cycle - // that have 53 weeks; in this case reflecting the 2000 based cycle - assert.equal(moment([2004, 11, 31]).isoWeek(), 53, 'Dec 31 2004 should be iso week 53'); - assert.equal(moment([2009, 11, 31]).isoWeek(), 53, 'Dec 31 2009 should be iso week 53'); - assert.equal(moment([2015, 11, 31]).isoWeek(), 53, 'Dec 31 2015 should be iso week 53'); - assert.equal(moment([2020, 11, 31]).isoWeek(), 53, 'Dec 31 2020 should be iso week 53'); - assert.equal(moment([2026, 11, 31]).isoWeek(), 53, 'Dec 31 2026 should be iso week 53'); - assert.equal(moment([2032, 11, 31]).isoWeek(), 53, 'Dec 31 2032 should be iso week 53'); - assert.equal(moment([2037, 11, 31]).isoWeek(), 53, 'Dec 31 2037 should be iso week 53'); - assert.equal(moment([2043, 11, 31]).isoWeek(), 53, 'Dec 31 2043 should be iso week 53'); - assert.equal(moment([2048, 11, 31]).isoWeek(), 53, 'Dec 31 2048 should be iso week 53'); - assert.equal(moment([2054, 11, 31]).isoWeek(), 53, 'Dec 31 2054 should be iso week 53'); - assert.equal(moment([2060, 11, 31]).isoWeek(), 53, 'Dec 31 2060 should be iso week 53'); - assert.equal(moment([2065, 11, 31]).isoWeek(), 53, 'Dec 31 2065 should be iso week 53'); - assert.equal(moment([2071, 11, 31]).isoWeek(), 53, 'Dec 31 2071 should be iso week 53'); - assert.equal(moment([2076, 11, 31]).isoWeek(), 53, 'Dec 31 2076 should be iso week 53'); - assert.equal(moment([2082, 11, 31]).isoWeek(), 53, 'Dec 31 2082 should be iso week 53'); - assert.equal(moment([2088, 11, 31]).isoWeek(), 53, 'Dec 31 2088 should be iso week 53'); - assert.equal(moment([2093, 11, 31]).isoWeek(), 53, 'Dec 31 2093 should be iso week 53'); - assert.equal(moment([2099, 11, 31]).isoWeek(), 53, 'Dec 31 2099 should be iso week 53'); - assert.equal(moment([2105, 11, 31]).isoWeek(), 53, 'Dec 31 2105 should be iso week 53'); - assert.equal(moment([2111, 11, 31]).isoWeek(), 53, 'Dec 31 2111 should be iso week 53'); - assert.equal(moment([2116, 11, 31]).isoWeek(), 53, 'Dec 31 2116 should be iso week 53'); - assert.equal(moment([2122, 11, 31]).isoWeek(), 53, 'Dec 31 2122 should be iso week 53'); - assert.equal(moment([2128, 11, 31]).isoWeek(), 53, 'Dec 31 2128 should be iso week 53'); - assert.equal(moment([2133, 11, 31]).isoWeek(), 53, 'Dec 31 2133 should be iso week 53'); - assert.equal(moment([2139, 11, 31]).isoWeek(), 53, 'Dec 31 2139 should be iso week 53'); - assert.equal(moment([2144, 11, 31]).isoWeek(), 53, 'Dec 31 2144 should be iso week 53'); - assert.equal(moment([2150, 11, 31]).isoWeek(), 53, 'Dec 31 2150 should be iso week 53'); - assert.equal(moment([2156, 11, 31]).isoWeek(), 53, 'Dec 31 2156 should be iso week 53'); - assert.equal(moment([2161, 11, 31]).isoWeek(), 53, 'Dec 31 2161 should be iso week 53'); - assert.equal(moment([2167, 11, 31]).isoWeek(), 53, 'Dec 31 2167 should be iso week 53'); - assert.equal(moment([2172, 11, 31]).isoWeek(), 53, 'Dec 31 2172 should be iso week 53'); - assert.equal(moment([2178, 11, 31]).isoWeek(), 53, 'Dec 31 2178 should be iso week 53'); - assert.equal(moment([2184, 11, 31]).isoWeek(), 53, 'Dec 31 2184 should be iso week 53'); - assert.equal(moment([2189, 11, 31]).isoWeek(), 53, 'Dec 31 2189 should be iso week 53'); - assert.equal(moment([2195, 11, 31]).isoWeek(), 53, 'Dec 31 2195 should be iso week 53'); - assert.equal(moment([2201, 11, 31]).isoWeek(), 53, 'Dec 31 2201 should be iso week 53'); - assert.equal(moment([2207, 11, 31]).isoWeek(), 53, 'Dec 31 2207 should be iso week 53'); - assert.equal(moment([2212, 11, 31]).isoWeek(), 53, 'Dec 31 2212 should be iso week 53'); - assert.equal(moment([2218, 11, 31]).isoWeek(), 53, 'Dec 31 2218 should be iso week 53'); - assert.equal(moment([2224, 11, 31]).isoWeek(), 53, 'Dec 31 2224 should be iso week 53'); - assert.equal(moment([2229, 11, 31]).isoWeek(), 53, 'Dec 31 2229 should be iso week 53'); - assert.equal(moment([2235, 11, 31]).isoWeek(), 53, 'Dec 31 2235 should be iso week 53'); - assert.equal(moment([2240, 11, 31]).isoWeek(), 53, 'Dec 31 2240 should be iso week 53'); - assert.equal(moment([2246, 11, 31]).isoWeek(), 53, 'Dec 31 2246 should be iso week 53'); - assert.equal(moment([2252, 11, 31]).isoWeek(), 53, 'Dec 31 2252 should be iso week 53'); - assert.equal(moment([2257, 11, 31]).isoWeek(), 53, 'Dec 31 2257 should be iso week 53'); - assert.equal(moment([2263, 11, 31]).isoWeek(), 53, 'Dec 31 2263 should be iso week 53'); - assert.equal(moment([2268, 11, 31]).isoWeek(), 53, 'Dec 31 2268 should be iso week 53'); - assert.equal(moment([2274, 11, 31]).isoWeek(), 53, 'Dec 31 2274 should be iso week 53'); - assert.equal(moment([2280, 11, 31]).isoWeek(), 53, 'Dec 31 2280 should be iso week 53'); - assert.equal(moment([2285, 11, 31]).isoWeek(), 53, 'Dec 31 2285 should be iso week 53'); - assert.equal(moment([2291, 11, 31]).isoWeek(), 53, 'Dec 31 2291 should be iso week 53'); - assert.equal(moment([2296, 11, 31]).isoWeek(), 53, 'Dec 31 2296 should be iso week 53'); - assert.equal(moment([2303, 11, 31]).isoWeek(), 53, 'Dec 31 2303 should be iso week 53'); - assert.equal(moment([2308, 11, 31]).isoWeek(), 53, 'Dec 31 2308 should be iso week 53'); - assert.equal(moment([2314, 11, 31]).isoWeek(), 53, 'Dec 31 2314 should be iso week 53'); - assert.equal(moment([2320, 11, 31]).isoWeek(), 53, 'Dec 31 2320 should be iso week 53'); - assert.equal(moment([2325, 11, 31]).isoWeek(), 53, 'Dec 31 2325 should be iso week 53'); - assert.equal(moment([2331, 11, 31]).isoWeek(), 53, 'Dec 31 2331 should be iso week 53'); - assert.equal(moment([2336, 11, 31]).isoWeek(), 53, 'Dec 31 2336 should be iso week 53'); - assert.equal(moment([2342, 11, 31]).isoWeek(), 53, 'Dec 31 2342 should be iso week 53'); - assert.equal(moment([2348, 11, 31]).isoWeek(), 53, 'Dec 31 2348 should be iso week 53'); - assert.equal(moment([2353, 11, 31]).isoWeek(), 53, 'Dec 31 2353 should be iso week 53'); - assert.equal(moment([2359, 11, 31]).isoWeek(), 53, 'Dec 31 2359 should be iso week 53'); - assert.equal(moment([2364, 11, 31]).isoWeek(), 53, 'Dec 31 2364 should be iso week 53'); - assert.equal(moment([2370, 11, 31]).isoWeek(), 53, 'Dec 31 2370 should be iso week 53'); - assert.equal(moment([2376, 11, 31]).isoWeek(), 53, 'Dec 31 2376 should be iso week 53'); - assert.equal(moment([2381, 11, 31]).isoWeek(), 53, 'Dec 31 2381 should be iso week 53'); - assert.equal(moment([2387, 11, 31]).isoWeek(), 53, 'Dec 31 2387 should be iso week 53'); - assert.equal(moment([2392, 11, 31]).isoWeek(), 53, 'Dec 31 2392 should be iso week 53'); - assert.equal(moment([2398, 11, 31]).isoWeek(), 53, 'Dec 31 2398 should be iso week 53'); - }); - - test('count years with iso week 53', function (assert) { - // Based on http://en.wikipedia.org/wiki/ISO_week_date (as seen on 2014-01-06) - // stating that there are 71 years in a 400-year cycle that have 53 weeks; - // in this case reflecting the 2000 based cycle - var count = 0, i; - for (i = 0; i < 400; i++) { - count += (moment([2000 + i, 11, 31]).isoWeek() === 53) ? 1 : 0; - } - assert.equal(count, 71, 'Should have 71 years in 400-year cycle with iso week 53'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('weeks in year'); - - test('isoWeeksInYear', function (assert) { - assert.equal(moment([2004]).isoWeeksInYear(), 53, '2004 has 53 iso weeks'); - assert.equal(moment([2005]).isoWeeksInYear(), 52, '2005 has 53 iso weeks'); - assert.equal(moment([2006]).isoWeeksInYear(), 52, '2006 has 53 iso weeks'); - assert.equal(moment([2007]).isoWeeksInYear(), 52, '2007 has 52 iso weeks'); - assert.equal(moment([2008]).isoWeeksInYear(), 52, '2008 has 53 iso weeks'); - assert.equal(moment([2009]).isoWeeksInYear(), 53, '2009 has 53 iso weeks'); - assert.equal(moment([2010]).isoWeeksInYear(), 52, '2010 has 52 iso weeks'); - assert.equal(moment([2011]).isoWeeksInYear(), 52, '2011 has 52 iso weeks'); - assert.equal(moment([2012]).isoWeeksInYear(), 52, '2012 has 52 iso weeks'); - assert.equal(moment([2013]).isoWeeksInYear(), 52, '2013 has 52 iso weeks'); - assert.equal(moment([2014]).isoWeeksInYear(), 52, '2014 has 52 iso weeks'); - assert.equal(moment([2015]).isoWeeksInYear(), 53, '2015 has 53 iso weeks'); - }); - - test('weeksInYear doy/dow = 1/4', function (assert) { - moment.locale('1/4', {week: {dow: 1, doy: 4}}); - - assert.equal(moment([2004]).weeksInYear(), 53, '2004 has 53 weeks'); - assert.equal(moment([2005]).weeksInYear(), 52, '2005 has 53 weeks'); - assert.equal(moment([2006]).weeksInYear(), 52, '2006 has 53 weeks'); - assert.equal(moment([2007]).weeksInYear(), 52, '2007 has 52 weeks'); - assert.equal(moment([2008]).weeksInYear(), 52, '2008 has 53 weeks'); - assert.equal(moment([2009]).weeksInYear(), 53, '2009 has 53 weeks'); - assert.equal(moment([2010]).weeksInYear(), 52, '2010 has 52 weeks'); - assert.equal(moment([2011]).weeksInYear(), 52, '2011 has 52 weeks'); - assert.equal(moment([2012]).weeksInYear(), 52, '2012 has 52 weeks'); - assert.equal(moment([2013]).weeksInYear(), 52, '2013 has 52 weeks'); - assert.equal(moment([2014]).weeksInYear(), 52, '2014 has 52 weeks'); - assert.equal(moment([2015]).weeksInYear(), 53, '2015 has 53 weeks'); - }); - - test('weeksInYear doy/dow = 6/12', function (assert) { - moment.locale('6/12', {week: {dow: 6, doy: 12}}); - - assert.equal(moment([2004]).weeksInYear(), 53, '2004 has 53 weeks'); - assert.equal(moment([2005]).weeksInYear(), 52, '2005 has 53 weeks'); - assert.equal(moment([2006]).weeksInYear(), 52, '2006 has 53 weeks'); - assert.equal(moment([2007]).weeksInYear(), 52, '2007 has 52 weeks'); - assert.equal(moment([2008]).weeksInYear(), 52, '2008 has 53 weeks'); - assert.equal(moment([2009]).weeksInYear(), 52, '2009 has 53 weeks'); - assert.equal(moment([2010]).weeksInYear(), 53, '2010 has 52 weeks'); - assert.equal(moment([2011]).weeksInYear(), 52, '2011 has 52 weeks'); - assert.equal(moment([2012]).weeksInYear(), 52, '2012 has 52 weeks'); - assert.equal(moment([2013]).weeksInYear(), 52, '2013 has 52 weeks'); - assert.equal(moment([2014]).weeksInYear(), 52, '2014 has 52 weeks'); - assert.equal(moment([2015]).weeksInYear(), 52, '2015 has 53 weeks'); - }); - - test('weeksInYear doy/dow = 1/7', function (assert) { - moment.locale('1/7', {week: {dow: 1, doy: 7}}); - - assert.equal(moment([2004]).weeksInYear(), 52, '2004 has 53 weeks'); - assert.equal(moment([2005]).weeksInYear(), 52, '2005 has 53 weeks'); - assert.equal(moment([2006]).weeksInYear(), 53, '2006 has 53 weeks'); - assert.equal(moment([2007]).weeksInYear(), 52, '2007 has 52 weeks'); - assert.equal(moment([2008]).weeksInYear(), 52, '2008 has 53 weeks'); - assert.equal(moment([2009]).weeksInYear(), 52, '2009 has 53 weeks'); - assert.equal(moment([2010]).weeksInYear(), 52, '2010 has 52 weeks'); - assert.equal(moment([2011]).weeksInYear(), 52, '2011 has 52 weeks'); - assert.equal(moment([2012]).weeksInYear(), 53, '2012 has 52 weeks'); - assert.equal(moment([2013]).weeksInYear(), 52, '2013 has 52 weeks'); - assert.equal(moment([2014]).weeksInYear(), 52, '2014 has 52 weeks'); - assert.equal(moment([2015]).weeksInYear(), 52, '2015 has 53 weeks'); - }); - - test('weeksInYear doy/dow = 0/6', function (assert) { - moment.locale('0/6', {week: {dow: 0, doy: 6}}); - - assert.equal(moment([2004]).weeksInYear(), 52, '2004 has 53 weeks'); - assert.equal(moment([2005]).weeksInYear(), 53, '2005 has 53 weeks'); - assert.equal(moment([2006]).weeksInYear(), 52, '2006 has 53 weeks'); - assert.equal(moment([2007]).weeksInYear(), 52, '2007 has 52 weeks'); - assert.equal(moment([2008]).weeksInYear(), 52, '2008 has 53 weeks'); - assert.equal(moment([2009]).weeksInYear(), 52, '2009 has 53 weeks'); - assert.equal(moment([2010]).weeksInYear(), 52, '2010 has 52 weeks'); - assert.equal(moment([2011]).weeksInYear(), 53, '2011 has 52 weeks'); - assert.equal(moment([2012]).weeksInYear(), 52, '2012 has 52 weeks'); - assert.equal(moment([2013]).weeksInYear(), 52, '2013 has 52 weeks'); - assert.equal(moment([2014]).weeksInYear(), 52, '2014 has 52 weeks'); - assert.equal(moment([2015]).weeksInYear(), 52, '2015 has 53 weeks'); - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - function isNearSpringDST() { - return moment().subtract(1, 'day').utcOffset() !== moment().add(1, 'day').utcOffset(); - } - - module('zone switching'); - - test('local to utc, keepLocalTime = true', function (assert) { - var m = moment(), - fmt = 'YYYY-DD-MM HH:mm:ss'; - assert.equal(m.clone().utc(true).format(fmt), m.format(fmt), 'local to utc failed to keep local time'); - }); - - test('local to utc, keepLocalTime = false', function (assert) { - var m = moment(); - assert.equal(m.clone().utc().valueOf(), m.valueOf(), 'local to utc failed to keep utc time (implicit)'); - assert.equal(m.clone().utc(false).valueOf(), m.valueOf(), 'local to utc failed to keep utc time (explicit)'); - }); - - test('local to zone, keepLocalTime = true', function (assert) { - test.expectedDeprecations('moment().zone'); - var m = moment(), - fmt = 'YYYY-DD-MM HH:mm:ss', - z; - - // Apparently there is -12:00 and +14:00 - // http://en.wikipedia.org/wiki/UTC+14:00 - // http://en.wikipedia.org/wiki/UTC-12:00 - for (z = -12; z <= 14; ++z) { - assert.equal(m.clone().zone(z * 60, true).format(fmt), m.format(fmt), - 'local to zone(' + z + ':00) failed to keep local time'); - } - }); - - test('local to zone, keepLocalTime = false', function (assert) { - test.expectedDeprecations('moment().zone'); - var m = moment(), - z; - - // Apparently there is -12:00 and +14:00 - // http://en.wikipedia.org/wiki/UTC+14:00 - // http://en.wikipedia.org/wiki/UTC-12:00 - for (z = -12; z <= 14; ++z) { - assert.equal(m.clone().zone(z * 60).valueOf(), m.valueOf(), - 'local to zone(' + z + ':00) failed to keep utc time (implicit)'); - assert.equal(m.clone().zone(z * 60, false).valueOf(), m.valueOf(), - 'local to zone(' + z + ':00) failed to keep utc time (explicit)'); - } - }); - - test('utc to local, keepLocalTime = true', function (assert) { - // Don't test near the spring DST transition - if (isNearSpringDST()) { - expect(0); - return; - } - - var um = moment.utc(), - fmt = 'YYYY-DD-MM HH:mm:ss'; - - assert.equal(um.clone().local(true).format(fmt), um.format(fmt), 'utc to local failed to keep local time'); - }); - - test('utc to local, keepLocalTime = false', function (assert) { - var um = moment.utc(); - assert.equal(um.clone().local().valueOf(), um.valueOf(), 'utc to local failed to keep utc time (implicit)'); - assert.equal(um.clone().local(false).valueOf(), um.valueOf(), 'utc to local failed to keep utc time (explicit)'); - }); - - test('zone to local, keepLocalTime = true', function (assert) { - test.expectedDeprecations('moment().zone'); - // Don't test near the spring DST transition - if (isNearSpringDST()) { - expect(0); - return; - } - - var m = moment(), - fmt = 'YYYY-DD-MM HH:mm:ss', - z; - - // Apparently there is -12:00 and +14:00 - // http://en.wikipedia.org/wiki/UTC+14:00 - // http://en.wikipedia.org/wiki/UTC-12:00 - for (z = -12; z <= 14; ++z) { - m.zone(z * 60); - - assert.equal(m.clone().local(true).format(fmt), m.format(fmt), - 'zone(' + z + ':00) to local failed to keep local time'); - } - }); - - test('zone to local, keepLocalTime = false', function (assert) { - test.expectedDeprecations('moment().zone'); - var m = moment(), - z; - - // Apparently there is -12:00 and +14:00 - // http://en.wikipedia.org/wiki/UTC+14:00 - // http://en.wikipedia.org/wiki/UTC-12:00 - for (z = -12; z <= 14; ++z) { - m.zone(z * 60); - - assert.equal(m.clone().local(false).valueOf(), m.valueOf(), - 'zone(' + z + ':00) to local failed to keep utc time (explicit)'); - assert.equal(m.clone().local().valueOf(), m.valueOf(), - 'zone(' + z + ':00) to local failed to keep utc time (implicit)'); - } - }); - -})); - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; - - function each(array, callback) { - var i; - for (i = 0; i < array.length; i++) { - callback(array[i], i, array); - } - } - - function objectKeys(obj) { - if (Object.keys) { - return Object.keys(obj); - } else { - // IE8 - var res = [], i; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - res.push(i); - } - } - return res; - } - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function defineCommonLocaleTests(locale, options) { - test('lenient ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing ' + i + ' date check'); - } - }); - - test('lenient ordinal parsing of number', function (assert) { - var i, testMoment; - for (i = 1; i <= 31; ++i) { - testMoment = moment('2014 01 ' + i, 'YYYY MM Do'); - assert.equal(testMoment.year(), 2014, - 'lenient ordinal parsing of number ' + i + ' year check'); - assert.equal(testMoment.month(), 0, - 'lenient ordinal parsing of number ' + i + ' month check'); - assert.equal(testMoment.date(), i, - 'lenient ordinal parsing of number ' + i + ' date check'); - } - }); - - test('strict ordinal parsing', function (assert) { - var i, ordinalStr, testMoment; - for (i = 1; i <= 31; ++i) { - ordinalStr = moment([2014, 0, i]).format('YYYY MM Do'); - testMoment = moment(ordinalStr, 'YYYY MM Do', true); - assert.ok(testMoment.isValid(), 'strict ordinal parsing ' + i); - } - }); - - test('meridiem invariant', function (assert) { - var h, m, t1, t2; - for (h = 0; h < 24; ++h) { - for (m = 0; m < 60; m += 15) { - t1 = moment.utc([2000, 0, 1, h, m]); - t2 = moment.utc(t1.format('A h:mm'), 'A h:mm'); - assert.equal(t2.format('HH:mm'), t1.format('HH:mm'), - 'meridiem at ' + t1.format('HH:mm')); - } - } - }); - - test('date format correctness', function (assert) { - var data, tokens; - data = moment.localeData()._longDateFormat; - tokens = objectKeys(data); - each(tokens, function (srchToken) { - // Check each format string to make sure it does not contain any - // tokens that need to be expanded. - each(tokens, function (baseToken) { - // strip escaped sequences - var format = data[baseToken].replace(/(\[[^\]]*\])/g, ''); - assert.equal(false, !!~format.indexOf(srchToken), - 'contains ' + srchToken + ' in ' + baseToken); - }); - }); - }); - - test('month parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr') { - // I can't fix it :( - expect(0); - return; - } - function tester(format) { - var r; - r = moment(m.format(format), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.month(), m.month(), 'month ' + i + ' fmt ' + format + ' lower strict'); - } - - for (i = 0; i < 12; ++i) { - m = moment([2015, i, 15, 18]); - tester('MMM'); - tester('MMM.'); - tester('MMMM'); - tester('MMMM.'); - } - }); - - test('weekday parsing correctness', function (assert) { - var i, m; - - if (locale === 'tr' || locale === 'az') { - // There is a lower-case letter (ı), that converted to upper then - // lower changes to i - expect(0); - return; - } - function tester(format) { - var r, baseMsg = 'weekday ' + m.weekday() + ' fmt ' + format; - r = moment(m.format(format), format); - assert.equal(r.weekday(), m.weekday(), baseMsg); - r = moment(m.format(format).toLocaleUpperCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper'); - r = moment(m.format(format).toLocaleLowerCase(), format); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower'); - - r = moment(m.format(format), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' strict'); - r = moment(m.format(format).toLocaleUpperCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' upper strict'); - r = moment(m.format(format).toLocaleLowerCase(), format, true); - assert.equal(r.weekday(), m.weekday(), baseMsg + ' lower strict'); - } - - for (i = 0; i < 7; ++i) { - m = moment.utc([2015, i, 15, 18]); - tester('dd'); - tester('ddd'); - tester('dddd'); - } - }); - } - - function setupDeprecationHandler(test, moment, scope) { - test._expectedDeprecations = null; - test._observedDeprecations = null; - test._oldSupress = moment.suppressDeprecationWarnings; - moment.suppressDeprecationWarnings = true; - test.expectedDeprecations = function () { - test._expectedDeprecations = arguments; - test._observedDeprecations = []; - }; - moment.deprecationHandler = function (name, msg) { - var deprecationId = matchedDeprecation(name, msg, test._expectedDeprecations); - if (deprecationId === -1) { - throw new Error('Unexpected deprecation thrown name=' + - name + ' msg=' + msg); - } - test._observedDeprecations[deprecationId] = 1; - }; - } - - function teardownDeprecationHandler(test, moment, scope) { - moment.suppressDeprecationWarnings = test._oldSupress; - - if (test._expectedDeprecations != null) { - var missedDeprecations = []; - each(test._expectedDeprecations, function (deprecationPattern, id) { - if (test._observedDeprecations[id] !== 1) { - missedDeprecations.push(deprecationPattern); - } - }); - if (missedDeprecations.length !== 0) { - throw new Error('Expected deprecation warnings did not happen: ' + - missedDeprecations.join(' ')); - } - } - } - - function matchedDeprecation(name, msg, deprecations) { - if (deprecations == null) { - return -1; - } - for (var i = 0; i < deprecations.length; ++i) { - if (name != null && name === deprecations[i]) { - return i; - } - if (msg != null && msg.substring(0, deprecations[i].length) === deprecations[i]) { - return i; - } - } - return -1; - } - - /*global QUnit:false*/ - - var test = QUnit.test; - - var expect = QUnit.expect; - - function module (name, lifecycle) { - QUnit.module(name, { - setup : function () { - moment.locale('en'); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - teardownDeprecationHandler(test, moment, 'core'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - } - - function localeModule (name, lifecycle) { - QUnit.module('locale:' + name, { - setup : function () { - moment.locale(name); - moment.createFromInputFallback = function (config) { - throw new Error('input not handled by moment: ' + config._i); - }; - setupDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.setup) { - lifecycle.setup(); - } - }, - teardown : function () { - moment.locale('en'); - teardownDeprecationHandler(test, moment, 'locale'); - if (lifecycle && lifecycle.teardown) { - lifecycle.teardown(); - } - } - }); - defineCommonLocaleTests(name, -1, -1); - } - - module('zones', { - 'setup': function () { - test.expectedDeprecations('moment().zone'); - } - }); - - test('set zone', function (assert) { - var zone = moment(); - - zone.zone(0); - assert.equal(zone.zone(), 0, 'should be able to set the zone to 0'); - - zone.zone(60); - assert.equal(zone.zone(), 60, 'should be able to set the zone to 60'); - - zone.zone(-60); - assert.equal(zone.zone(), -60, 'should be able to set the zone to -60'); - }); - - test('set zone shorthand', function (assert) { - var zone = moment(); - - zone.zone(1); - assert.equal(zone.zone(), 60, 'setting the zone to 1 should imply hours and convert to 60'); - - zone.zone(-1); - assert.equal(zone.zone(), -60, 'setting the zone to -1 should imply hours and convert to -60'); - - zone.zone(15); - assert.equal(zone.zone(), 900, 'setting the zone to 15 should imply hours and convert to 900'); - - zone.zone(-15); - assert.equal(zone.zone(), -900, 'setting the zone to -15 should imply hours and convert to -900'); - - zone.zone(16); - assert.equal(zone.zone(), 16, 'setting the zone to 16 should imply minutes'); - - zone.zone(-16); - assert.equal(zone.zone(), -16, 'setting the zone to -16 should imply minutes'); - }); - - test('set zone with string', function (assert) { - var zone = moment(); - - zone.zone('+00:00'); - assert.equal(zone.zone(), 0, 'set the zone with a timezone string'); - - zone.zone('2013-03-07T07:00:00-08:00'); - assert.equal(zone.zone(), 480, 'set the zone with a string that does not begin with the timezone'); - - zone.zone('2013-03-07T07:00:00+0100'); - assert.equal(zone.zone(), -60, 'set the zone with a string that uses the +0000 syntax'); - - zone.zone('2013-03-07T07:00:00+02'); - assert.equal(zone.zone(), -120, 'set the zone with a string that uses the +00 syntax'); - - zone.zone('03-07-2013T07:00:00-08:00'); - assert.equal(zone.zone(), 480, 'set the zone with a string with a non-ISO 8601 date'); - }); - - test('change hours when changing the zone', function (assert) { - var zone = moment.utc([2000, 0, 1, 6]); - - zone.zone(0); - assert.equal(zone.hour(), 6, 'UTC 6AM should be 6AM at +0000'); - - zone.zone(60); - assert.equal(zone.hour(), 5, 'UTC 6AM should be 5AM at -0100'); - - zone.zone(-60); - assert.equal(zone.hour(), 7, 'UTC 6AM should be 7AM at +0100'); - }); - - test('change minutes when changing the zone', function (assert) { - var zone = moment.utc([2000, 0, 1, 6, 31]); - - zone.zone(0); - assert.equal(zone.format('HH:mm'), '06:31', 'UTC 6:31AM should be 6:31AM at +0000'); - - zone.zone(30); - assert.equal(zone.format('HH:mm'), '06:01', 'UTC 6:31AM should be 6:01AM at -0030'); - - zone.zone(-30); - assert.equal(zone.format('HH:mm'), '07:01', 'UTC 6:31AM should be 7:01AM at +0030'); - - zone.zone(1380); - assert.equal(zone.format('HH:mm'), '07:31', 'UTC 6:31AM should be 7:31AM at +1380'); - }); - - test('distance from the unix epoch', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA), - zoneC = moment(zoneA), - zoneD = moment(zoneA), - zoneE = moment(zoneA); - - zoneB.utc(); - assert.equal(+zoneA, +zoneB, 'moment should equal moment.utc'); - - zoneC.zone(-60); - assert.equal(+zoneA, +zoneC, 'moment should equal moment.zone(-60)'); - - zoneD.zone(480); - assert.equal(+zoneA, +zoneD, 'moment should equal moment.zone(480)'); - - zoneE.zone(1000); - assert.equal(+zoneA, +zoneE, 'moment should equal moment.zone(1000)'); - }); - - test('update offset after changing any values', function (assert) { - var oldOffset = moment.updateOffset, - m = moment.utc([2000, 6, 1]); - - moment.updateOffset = function (mom, keepTime) { - if (mom.__doChange) { - if (+mom > 962409600000) { - mom.zone(120, keepTime); - } else { - mom.zone(60, keepTime); - } - } - }; - - assert.equal(m.format('ZZ'), '+0000', 'should be at +0000'); - assert.equal(m.format('HH:mm'), '00:00', 'should start 12AM at +0000 timezone'); - - m.__doChange = true; - m.add(1, 'h'); - - assert.equal(m.format('ZZ'), '-0200', 'should be at -0200'); - assert.equal(m.format('HH:mm'), '23:00', '1AM at +0000 should be 11PM at -0200 timezone'); - - m.subtract(1, 'h'); - - assert.equal(m.format('ZZ'), '-0100', 'should be at -0100'); - assert.equal(m.format('HH:mm'), '23:00', '12AM at +0000 should be 11PM at -0100 timezone'); - - moment.updateOffset = oldOffset; - }); - - test('getters and setters', function (assert) { - var a = moment([2011, 5, 20]); - - assert.equal(a.clone().zone(120).year(2012).year(), 2012, 'should get and set year correctly'); - assert.equal(a.clone().zone(120).month(1).month(), 1, 'should get and set month correctly'); - assert.equal(a.clone().zone(120).date(2).date(), 2, 'should get and set date correctly'); - assert.equal(a.clone().zone(120).day(1).day(), 1, 'should get and set day correctly'); - assert.equal(a.clone().zone(120).hour(1).hour(), 1, 'should get and set hour correctly'); - assert.equal(a.clone().zone(120).minute(1).minute(), 1, 'should get and set minute correctly'); - }); - - test('getters', function (assert) { - var a = moment.utc([2012, 0, 1, 0, 0, 0]); - - assert.equal(a.clone().zone(120).year(), 2011, 'should get year correctly'); - assert.equal(a.clone().zone(120).month(), 11, 'should get month correctly'); - assert.equal(a.clone().zone(120).date(), 31, 'should get date correctly'); - assert.equal(a.clone().zone(120).hour(), 22, 'should get hour correctly'); - assert.equal(a.clone().zone(120).minute(), 0, 'should get minute correctly'); - - assert.equal(a.clone().zone(-120).year(), 2012, 'should get year correctly'); - assert.equal(a.clone().zone(-120).month(), 0, 'should get month correctly'); - assert.equal(a.clone().zone(-120).date(), 1, 'should get date correctly'); - assert.equal(a.clone().zone(-120).hour(), 2, 'should get hour correctly'); - assert.equal(a.clone().zone(-120).minute(), 0, 'should get minute correctly'); - - assert.equal(a.clone().zone(-90).year(), 2012, 'should get year correctly'); - assert.equal(a.clone().zone(-90).month(), 0, 'should get month correctly'); - assert.equal(a.clone().zone(-90).date(), 1, 'should get date correctly'); - assert.equal(a.clone().zone(-90).hour(), 1, 'should get hour correctly'); - assert.equal(a.clone().zone(-90).minute(), 30, 'should get minute correctly'); - }); - - test('from', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA).zone(720), - zoneC = moment(zoneA).zone(360), - zoneD = moment(zoneA).zone(-690), - other = moment(zoneA).add(35, 'm'); - - assert.equal(zoneA.from(other), zoneB.from(other), 'moment#from should be the same in all zones'); - assert.equal(zoneA.from(other), zoneC.from(other), 'moment#from should be the same in all zones'); - assert.equal(zoneA.from(other), zoneD.from(other), 'moment#from should be the same in all zones'); - }); - - test('diff', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA).zone(720), - zoneC = moment(zoneA).zone(360), - zoneD = moment(zoneA).zone(-690), - other = moment(zoneA).add(35, 'm'); - - assert.equal(zoneA.diff(other), zoneB.diff(other), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other), zoneC.diff(other), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other), zoneD.diff(other), 'moment#diff should be the same in all zones'); - - assert.equal(zoneA.diff(other, 'minute', true), zoneB.diff(other, 'minute', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'minute', true), zoneC.diff(other, 'minute', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'minute', true), zoneD.diff(other, 'minute', true), 'moment#diff should be the same in all zones'); - - assert.equal(zoneA.diff(other, 'hour', true), zoneB.diff(other, 'hour', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'hour', true), zoneC.diff(other, 'hour', true), 'moment#diff should be the same in all zones'); - assert.equal(zoneA.diff(other, 'hour', true), zoneD.diff(other, 'hour', true), 'moment#diff should be the same in all zones'); - }); - - test('unix offset and timestamp', function (assert) { - var zoneA = moment(), - zoneB = moment(zoneA).zone(720), - zoneC = moment(zoneA).zone(360), - zoneD = moment(zoneA).zone(-690); - - assert.equal(zoneA.unix(), zoneB.unix(), 'moment#unix should be the same in all zones'); - assert.equal(zoneA.unix(), zoneC.unix(), 'moment#unix should be the same in all zones'); - assert.equal(zoneA.unix(), zoneD.unix(), 'moment#unix should be the same in all zones'); - - assert.equal(+zoneA, +zoneB, 'moment#valueOf should be the same in all zones'); - assert.equal(+zoneA, +zoneC, 'moment#valueOf should be the same in all zones'); - assert.equal(+zoneA, +zoneD, 'moment#valueOf should be the same in all zones'); - }); - - test('cloning', function (assert) { - assert.equal(moment().zone(120).clone().zone(), 120, 'explicit cloning should retain the zone'); - assert.equal(moment().zone(-120).clone().zone(), -120, 'explicit cloning should retain the zone'); - assert.equal(moment(moment().zone(120)).zone(), 120, 'implicit cloning should retain the zone'); - assert.equal(moment(moment().zone(-120)).zone(), -120, 'implicit cloning should retain the zone'); - }); - - test('start of / end of', function (assert) { - var a = moment.utc([2010, 1, 2, 0, 0, 0]).zone(450); - - assert.equal(a.clone().startOf('day').hour(), 0, 'start of day should work on moments with a zone'); - assert.equal(a.clone().startOf('day').minute(), 0, 'start of day should work on moments with a zone'); - assert.equal(a.clone().startOf('hour').minute(), 0, 'start of hour should work on moments with a zone'); - - assert.equal(a.clone().endOf('day').hour(), 23, 'end of day should work on moments with a zone'); - assert.equal(a.clone().endOf('day').minute(), 59, 'end of day should work on moments with a zone'); - assert.equal(a.clone().endOf('hour').minute(), 59, 'end of hour should work on moments with a zone'); - }); - - test('reset zone with moment#utc', function (assert) { - var a = moment.utc([2012]).zone(480); - - assert.equal(a.clone().hour(), 16, 'different zone should have different hour'); - assert.equal(a.clone().utc().hour(), 0, 'calling moment#utc should reset the offset'); - }); - - test('reset zone with moment#local', function (assert) { - var a = moment([2012]).zone(480); - - assert.equal(a.clone().local().hour(), 0, 'calling moment#local should reset the offset'); - }); - - test('toDate', function (assert) { - var zoneA = new Date(), - zoneB = moment(zoneA).zone(720).toDate(), - zoneC = moment(zoneA).zone(360).toDate(), - zoneD = moment(zoneA).zone(-690).toDate(); - - assert.equal(+zoneA, +zoneB, 'moment#toDate should output a date with the right unix timestamp'); - assert.equal(+zoneA, +zoneC, 'moment#toDate should output a date with the right unix timestamp'); - assert.equal(+zoneA, +zoneD, 'moment#toDate should output a date with the right unix timestamp'); - }); - - test('same / before / after', function (assert) { - var zoneA = moment().utc(), - zoneB = moment(zoneA).zone(120), - zoneC = moment(zoneA).zone(-120); - - assert.ok(zoneA.isSame(zoneB), 'two moments with different offsets should be the same'); - assert.ok(zoneA.isSame(zoneC), 'two moments with different offsets should be the same'); - - assert.ok(zoneA.isSame(zoneB, 'hour'), 'two moments with different offsets should be the same hour'); - assert.ok(zoneA.isSame(zoneC, 'hour'), 'two moments with different offsets should be the same hour'); - - zoneA.add(1, 'hour'); - - assert.ok(zoneA.isAfter(zoneB), 'isAfter should work with two moments with different offsets'); - assert.ok(zoneA.isAfter(zoneC), 'isAfter should work with two moments with different offsets'); - - assert.ok(zoneA.isAfter(zoneB, 'hour'), 'isAfter:hour should work with two moments with different offsets'); - assert.ok(zoneA.isAfter(zoneC, 'hour'), 'isAfter:hour should work with two moments with different offsets'); - - zoneA.subtract(2, 'hour'); - - assert.ok(zoneA.isBefore(zoneB), 'isBefore should work with two moments with different offsets'); - assert.ok(zoneA.isBefore(zoneC), 'isBefore should work with two moments with different offsets'); - - assert.ok(zoneA.isBefore(zoneB, 'hour'), 'isBefore:hour should work with two moments with different offsets'); - assert.ok(zoneA.isBefore(zoneC, 'hour'), 'isBefore:hour should work with two moments with different offsets'); - }); - - test('add / subtract over dst', function (assert) { - var oldOffset = moment.updateOffset, - m = moment.utc([2000, 2, 31, 3]); - - moment.updateOffset = function (mom, keepTime) { - if (mom.clone().utc().month() > 2) { - mom.zone(-60, keepTime); - } else { - mom.zone(0, keepTime); - } - }; - - assert.equal(m.hour(), 3, 'should start at 00:00'); - - m.add(24, 'hour'); - - assert.equal(m.hour(), 4, 'adding 24 hours should disregard dst'); - - m.subtract(24, 'hour'); - - assert.equal(m.hour(), 3, 'subtracting 24 hours should disregard dst'); - - m.add(1, 'day'); - - assert.equal(m.hour(), 3, 'adding 1 day should have the same hour'); - - m.subtract(1, 'day'); - - assert.equal(m.hour(), 3, 'subtracting 1 day should have the same hour'); - - m.add(1, 'month'); - - assert.equal(m.hour(), 3, 'adding 1 month should have the same hour'); - - m.subtract(1, 'month'); - - assert.equal(m.hour(), 3, 'subtracting 1 month should have the same hour'); - - moment.updateOffset = oldOffset; - }); - - test('isDST', function (assert) { - var oldOffset = moment.updateOffset; - - moment.updateOffset = function (mom, keepTime) { - if (mom.month() > 2 && mom.month() < 9) { - mom.zone(-60, keepTime); - } else { - mom.zone(0, keepTime); - } - }; - - assert.ok(!moment().month(0).isDST(), 'Jan should not be summer dst'); - assert.ok(moment().month(6).isDST(), 'Jul should be summer dst'); - assert.ok(!moment().month(11).isDST(), 'Dec should not be summer dst'); - - moment.updateOffset = function (mom) { - if (mom.month() > 2 && mom.month() < 9) { - mom.zone(0); - } else { - mom.zone(-60); - } - }; - - assert.ok(moment().month(0).isDST(), 'Jan should be winter dst'); - assert.ok(!moment().month(6).isDST(), 'Jul should not be winter dst'); - assert.ok(moment().month(11).isDST(), 'Dec should be winter dst'); - - moment.updateOffset = oldOffset; - }); - - test('zone names', function (assert) { - test.expectedDeprecations(); - assert.equal(moment().zoneAbbr(), '', 'Local zone abbr should be empty'); - assert.equal(moment().format('z'), '', 'Local zone formatted abbr should be empty'); - assert.equal(moment().zoneName(), '', 'Local zone name should be empty'); - assert.equal(moment().format('zz'), '', 'Local zone formatted name should be empty'); - - assert.equal(moment.utc().zoneAbbr(), 'UTC', 'UTC zone abbr should be UTC'); - assert.equal(moment.utc().format('z'), 'UTC', 'UTC zone formatted abbr should be UTC'); - assert.equal(moment.utc().zoneName(), 'Coordinated Universal Time', 'UTC zone abbr should be Coordinated Universal Time'); - assert.equal(moment.utc().format('zz'), 'Coordinated Universal Time', 'UTC zone formatted abbr should be Coordinated Universal Time'); - }); - - test('hours alignment with UTC', function (assert) { - assert.equal(moment().zone(120).hasAlignedHourOffset(), true); - assert.equal(moment().zone(-180).hasAlignedHourOffset(), true); - assert.equal(moment().zone(90).hasAlignedHourOffset(), false); - assert.equal(moment().zone(-90).hasAlignedHourOffset(), false); - }); - - test('hours alignment with other zone', function (assert) { - var m = moment().zone(120); - - assert.equal(m.hasAlignedHourOffset(moment().zone(180)), true); - assert.equal(m.hasAlignedHourOffset(moment().zone(-180)), true); - assert.equal(m.hasAlignedHourOffset(moment().zone(90)), false); - assert.equal(m.hasAlignedHourOffset(moment().zone(-90)), false); - - m = moment().zone(90); - - assert.equal(m.hasAlignedHourOffset(moment().zone(180)), false); - assert.equal(m.hasAlignedHourOffset(moment().zone(-180)), false); - assert.equal(m.hasAlignedHourOffset(moment().zone(30)), true); - assert.equal(m.hasAlignedHourOffset(moment().zone(-30)), true); - - m = moment().zone(-60); - - assert.equal(m.hasAlignedHourOffset(moment().zone(180)), true); - assert.equal(m.hasAlignedHourOffset(moment().zone(-180)), true); - assert.equal(m.hasAlignedHourOffset(moment().zone(90)), false); - assert.equal(m.hasAlignedHourOffset(moment().zone(-90)), false); - - m = moment().zone(25); - - assert.equal(m.hasAlignedHourOffset(moment().zone(-35)), true); - assert.equal(m.hasAlignedHourOffset(moment().zone(85)), true); - - assert.equal(m.hasAlignedHourOffset(moment().zone(35)), false); - assert.equal(m.hasAlignedHourOffset(moment().zone(-85)), false); - }); - - test('parse zone', function (assert) { - var m = moment('2013-01-01T00:00:00-13:00').parseZone(); - assert.equal(m.zone(), 13 * 60); - assert.equal(m.hours(), 0); - }); - - test('parse zone static', function (assert) { - var m = moment.parseZone('2013-01-01T00:00:00-13:00'); - assert.equal(m.zone(), 13 * 60); - assert.equal(m.hours(), 0); - }); - - test('parse zone with more arguments', function (assert) { - test.expectedDeprecations(); - var m; - m = moment.parseZone('2013 01 01 05 -13:00', 'YYYY MM DD HH ZZ'); - assert.equal(m.format(), '2013-01-01T05:00:00-13:00', 'accept input and format'); - m = moment.parseZone('2013-01-01-13:00', 'YYYY MM DD ZZ', true); - assert.equal(m.isValid(), false, 'accept input, format and strict flag'); - m = moment.parseZone('2013-01-01-13:00', ['DD MM YYYY ZZ', 'YYYY MM DD ZZ']); - assert.equal(m.format(), '2013-01-01T00:00:00-13:00', 'accept input and array of formats'); - }); - - test('parse zone with a timezone from the format string', function (assert) { - var m = moment('11-12-2013 -0400 +1100', 'DD-MM-YYYY ZZ #####').parseZone(); - - assert.equal(m.zone(), 4 * 60); - }); - - test('parse zone without a timezone included in the format string', function (assert) { - var m = moment('11-12-2013 -0400 +1100', 'DD-MM-YYYY').parseZone(); - - assert.equal(m.zone(), -11 * 60); - }); - - test('timezone format', function (assert) { - assert.equal(moment().zone(-60).format('ZZ'), '+0100', '-60 -> +0100'); - assert.equal(moment().zone(-90).format('ZZ'), '+0130', '-90 -> +0130'); - assert.equal(moment().zone(-120).format('ZZ'), '+0200', '-120 -> +0200'); - - assert.equal(moment().zone(+60).format('ZZ'), '-0100', '+60 -> -0100'); - assert.equal(moment().zone(+90).format('ZZ'), '-0130', '+90 -> -0130'); - assert.equal(moment().zone(+120).format('ZZ'), '-0200', '+120 -> -0200'); - }); - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.d.ts b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.d.ts deleted file mode 100644 index d6a26ede..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.d.ts +++ /dev/null @@ -1,512 +0,0 @@ -declare function moment(): moment.Moment; -declare function moment(date: number): moment.Moment; -declare function moment(date: number[]): moment.Moment; -declare function moment(date: string, format?: string, strict?: boolean): moment.Moment; -declare function moment(date: string, format?: string, language?: string, strict?: boolean): moment.Moment; -declare function moment(date: string, formats: string[], strict?: boolean): moment.Moment; -declare function moment(date: string, formats: string[], language?: string, strict?: boolean): moment.Moment; -declare function moment(date: string, specialFormat: () => void, strict?: boolean): moment.Moment; -declare function moment(date: string, specialFormat: () => void, language?: string, strict?: boolean): moment.Moment; -declare function moment(date: string, formatsIncludingSpecial: any[], strict?: boolean): moment.Moment; -declare function moment(date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): moment.Moment; -declare function moment(date: Date): moment.Moment; -declare function moment(date: moment.Moment): moment.Moment; -declare function moment(date: Object): moment.Moment; - -declare namespace moment { - type formatFunction = () => string; - - interface MomentDateObject { - years?: number; - /* One digit */ - months?: number; - /* Day of the month */ - date?: number; - hours?: number; - minutes?: number; - seconds?: number; - milliseconds?: number; - } - - interface MomentLanguageData extends BaseMomentLanguage { - /** - * @param formatType should be L, LL, LLL, LLLL. - */ - longDateFormat(formatType: string): string; - } - - interface Duration { - humanize(withSuffix?: boolean): string; - - as(units: string): number; - - milliseconds(): number; - asMilliseconds(): number; - - seconds(): number; - asSeconds(): number; - - minutes(): number; - asMinutes(): number; - - hours(): number; - asHours(): number; - - days(): number; - asDays(): number; - - months(): number; - asMonths(): number; - - years(): number; - asYears(): number; - - add(n: number, p: string): Duration; - add(n: number): Duration; - add(d: Duration): Duration; - - subtract(n: number, p: string): Duration; - subtract(n: number): Duration; - subtract(d: Duration): Duration; - - toISOString(): string; - toJSON(): string; - } - - interface MomentInput { - /** Year */ - years?: number; - /** Year */ - year?: number; - /** Year */ - y?: number; - - /** Month */ - months?: number; - /** Month */ - month?: number; - /** Month */ - M?: number; - - /** Week */ - weeks?: number; - /** Week */ - week?: number; - /** Week */ - w?: number; - - /** Day/Date */ - days?: number; - /** Day/Date */ - day?: number; - /** Day/Date */ - date?: number; - /** Day/Date */ - d?: number; - - /** Hour */ - hours?: number; - /** Hour */ - hour?: number; - /** Hour */ - h?: number; - - /** Minute */ - minutes?: number; - /** Minute */ - minute?: number; - /** Minute */ - m?: number; - - /** Second */ - seconds?: number; - /** Second */ - second?: number; - /** Second */ - s?: number; - - /** Millisecond */ - milliseconds?: number; - /** Millisecond */ - millisecond?: number; - /** Millisecond */ - ms?: number; - } - - interface MomentCalendar { - lastDay?: string | formatFunction; - sameDay?: string | formatFunction; - nextDay?: string | formatFunction; - lastWeek?: string | formatFunction; - nextWeek?: string | formatFunction; - sameElse?: string | formatFunction; - } - - interface MomentRelativeTime { - future: any; - past: any; - s: any; - m: any; - mm: any; - h: any; - hh: any; - d: any; - dd: any; - M: any; - MM: any; - y: any; - yy: any; - } - - interface MomentLongDateFormat { - L: string; - LL: string; - LLL: string; - LLLL: string; - LT: string; - LTS: string; - l?: string; - ll?: string; - lll?: string; - llll?: string; - lt?: string; - lts?: string; - } - - interface MomentParsingFlags { - empty: boolean; - unusedTokens: string[]; - unusedInput: string[]; - overflow: number; - charsLeftOver: number; - nullInput: boolean; - invalidMonth?: string; - invalidFormat: boolean; - userInvalidated: boolean; - iso: boolean; - parsedDateParts: any[]; - meridiem?: string; - } - - interface BaseMomentLanguage { - months?: any; - monthsShort?: any; - weekdays?: any; - weekdaysShort?: any; - weekdaysMin?: any; - relativeTime?: MomentRelativeTime; - meridiem?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar?: MomentCalendar; - ordinal?: (num: number) => string; - } - - interface MomentLanguage extends BaseMomentLanguage { - longDateFormat?: MomentLongDateFormat; - } - - interface Moment { - format(format: string): string; - format(): string; - - fromNow(withoutSuffix?: boolean): string; - - startOf(unitOfTime: string): Moment; - endOf(unitOfTime: string): Moment; - - /** - * Mutates the original moment by adding time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - * @param amount the amount you want to add - */ - add(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by adding time. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - add(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by adding time. - * - * @param duration a length of time - */ - add(duration: Duration): Moment; - - /** - * Mutates the original moment by subtracting time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - */ - subtract(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - subtract(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param duration a length of time - */ - subtract(duration: Duration): Moment; - - calendar(): string; - calendar(start: Moment): string; - calendar(start: Moment, formats: MomentCalendar): string; - - clone(): Moment; - - /** - * @return Unix timestamp, or milliseconds since the epoch. - */ - valueOf(): number; - - local(): Moment; // current date/time in local mode - - utc(): Moment; // current date/time in UTC mode - - isValid(): boolean; - invalidAt(): number; - - parsingFlags(): MomentParsingFlags; - - year(y: number): Moment; - year(): number; - quarter(): number; - quarter(q: number): Moment; - month(M: number): Moment; - month(M: string): Moment; - month(): number; - day(d: number): Moment; - day(d: string): Moment; - day(): number; - date(d: number): Moment; - date(): number; - hour(h: number): Moment; - hour(): number; - hours(h: number): Moment; - hours(): number; - minute(m: number): Moment; - minute(): number; - minutes(m: number): Moment; - minutes(): number; - second(s: number): Moment; - second(): number; - seconds(s: number): Moment; - seconds(): number; - millisecond(ms: number): Moment; - millisecond(): number; - milliseconds(ms: number): Moment; - milliseconds(): number; - weekday(): number; - weekday(d: number): Moment; - isoWeekday(): number; - isoWeekday(d: number): Moment; - weekYear(): number; - weekYear(d: number): Moment; - isoWeekYear(): number; - isoWeekYear(d: number): Moment; - week(): number; - week(d: number): Moment; - weeks(): number; - weeks(d: number): Moment; - isoWeek(): number; - isoWeek(d: number): Moment; - isoWeeks(): number; - isoWeeks(d: number): Moment; - weeksInYear(): number; - isoWeeksInYear(): number; - dayOfYear(): number; - dayOfYear(d: number): Moment; - - from(f: Moment | string | number | Date | number[], suffix?: boolean): string; - to(f: Moment | string | number | Date | number[], suffix?: boolean): string; - toNow(withoutPrefix?: boolean): string; - - diff(b: Moment): number; - diff(b: Moment, unitOfTime: string): number; - diff(b: Moment, unitOfTime: string, round: boolean): number; - - toArray(): number[]; - toDate(): Date; - toISOString(): string; - toJSON(): string; - unix(): number; - - isLeapYear(): boolean; - zone(): number; - zone(b: number): Moment; - zone(b: string): Moment; - utcOffset(): number; - utcOffset(b: number): Moment; - utcOffset(b: string): Moment; - daysInMonth(): number; - isDST(): boolean; - - isBefore(): boolean; - isBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; - - isAfter(): boolean; - isAfter(b: Moment | string | number | Date | number[], granularity?: string): boolean; - - isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; - isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string, inclusivity?: string): boolean; - - // Deprecated as of 2.8.0. - lang(language: string): Moment; - lang(reset: boolean): Moment; - lang(): MomentLanguage; - - locale(language: string): Moment; - locale(reset: boolean): Moment; - locale(): string; - - localeData(language: string): Moment; - localeData(reset: boolean): Moment; - localeData(): MomentLanguage; - - // Deprecated as of 2.7.0. - max(date: Moment | string | number | Date | any[]): Moment; - max(date: string, format: string): Moment; - - // Deprecated as of 2.7.0. - min(date: Moment | string | number | Date | any[]): Moment; - min(date: string, format: string): Moment; - - get(unit: string): number; - set(unit: string, value: number): Moment; - set(objectLiteral: MomentInput): Moment; - - /*This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.*/ - //Works with version 2.10.5+ - toObject(): MomentDateObject; - } - - export var version: string; - export var fn: Moment; - - export function utc(): Moment; - export function utc(date: number): Moment; - export function utc(date: number[]): Moment; - export function utc(date: string, format?: string, strict?: boolean): Moment; - export function utc(date: string, format?: string, language?: string, strict?: boolean): Moment; - export function utc(date: string, formats: string[], strict?: boolean): Moment; - export function utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; - export function utc(date: Date): Moment; - export function utc(date: Moment): Moment; - export function utc(date: Object): Moment; - - export function unix(timestamp: number): Moment; - - export function invalid(parsingFlags?: Object): Moment; - export function isMoment(): boolean; - export function isMoment(m: any): boolean; - export function isDate(m: any): boolean; - export function isDuration(): boolean; - export function isDuration(d: any): boolean; - - // Deprecated in 2.8.0. - export function lang(language?: string): string; - export function lang(language?: string, definition?: MomentLanguage): string; - - export function locale(language?: string): string; - export function locale(language?: string[]): string; - export function locale(language?: string, definition?: MomentLanguage): string; - - export function localeData(language?: string): MomentLanguageData; - - export var longDateFormat: any; - export var relativeTime: any; - export var meridiem: (hour: number, minute: number, isLowercase: boolean) => string; - export var calendar: any; - export var ordinal: (num: number) => string; - - export function duration(milliseconds: Number): Duration; - export function duration(num: Number, unitOfTime: string): Duration; - export function duration(input: MomentInput): Duration; - export function duration(object: any): Duration; - export function duration(): Duration; - - export function parseZone(date: string): Moment; - - export function months(): string[]; - export function months(index: number): string; - export function months(format: string): string[]; - export function months(format: string, index: number): string; - export function monthsShort(): string[]; - export function monthsShort(index: number): string; - export function monthsShort(format: string): string[]; - export function monthsShort(format: string, index: number): string; - - export function weekdays(): string[]; - export function weekdays(index: number): string; - export function weekdays(format: string): string[]; - export function weekdays(format: string, index: number): string; - export function weekdays(localeSorted: boolean): string[]; - export function weekdays(localeSorted: boolean, index: number): string; - export function weekdays(localeSorted: boolean, format: string): string[]; - export function weekdays(localeSorted: boolean, format: string, index: number): string; - export function weekdaysShort(): string[]; - export function weekdaysShort(index: number): string; - export function weekdaysShort(format: string): string[]; - export function weekdaysShort(format: string, index: number): string; - export function weekdaysShort(localeSorted: boolean): string[]; - export function weekdaysShort(localeSorted: boolean, index: number): string; - export function weekdaysShort(localeSorted: boolean, format: string): string[]; - export function weekdaysShort(localeSorted: boolean, format: string, index: number): string; - export function weekdaysMin(): string[]; - export function weekdaysMin(index: number): string; - export function weekdaysMin(format: string): string[]; - export function weekdaysMin(format: string, index: number): string; - export function weekdaysMin(localeSorted: boolean): string[]; - export function weekdaysMin(localeSorted: boolean, index: number): string; - export function weekdaysMin(localeSorted: boolean, format: string): string[]; - export function weekdaysMin(localeSorted: boolean, format: string, index: number): string; - - export function min(...moments: Moment[]): Moment; - export function max(...moments: Moment[]): Moment; - - export function normalizeUnits(unit: string): string; - export function relativeTimeThreshold(threshold: string): number | boolean; - export function relativeTimeThreshold(threshold: string, limit: number): boolean; - - /** - * Constant used to enable explicit ISO_8601 format parsing. - */ - export function ISO_8601(): void; - - export var defaultFormat: string; -} - -export = moment; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.js deleted file mode 100644 index ed94e44a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/moment.js +++ /dev/null @@ -1,4040 +0,0 @@ -//! moment.js -//! version : 2.13.0 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, function () { 'use strict'; - - var hookCallback; - - function utils_hooks__hooks () { - return hookCallback.apply(null, arguments); - } - - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback (callback) { - hookCallback = callback; - } - - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } - - function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; - } - - function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - return res; - } - - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - function create_utc__createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } - - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso : false, - parsedDateParts : [], - meridiem : null - }; - } - - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; - } - - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; - - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; - } - - function valid__isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }); - m._isValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); - - if (m._strict) { - m._isValid = m._isValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - } - return m._isValid; - } - - function valid__createInvalid (flags) { - var m = create_utc__createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } - - return m; - } - - function isUndefined(input) { - return input === void 0; - } - - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = utils_hooks__hooks.momentProperties = []; - - function copyConfig(to, from) { - var i, prop, val; - - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; - } - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - if (!isUndefined(from._offset)) { - to._offset = from._offset; - } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); - } - if (!isUndefined(from._locale)) { - to._locale = from._locale; - } - - if (momentProperties.length > 0) { - for (i in momentProperties) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; - } - - var updateInProgress = false; - - // Moment prototype object - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - utils_hooks__hooks.updateOffset(this); - updateInProgress = false; - } - } - - function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); - } - - function absFloor (number) { - if (number < 0) { - return Math.ceil(number); - } else { - return Math.floor(number); - } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } - - return value; - } - - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; - } - } - return diffs + lengthDiff; - } - - function warn(msg) { - if (utils_hooks__hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - - return extend(function () { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(null, msg); - } - if (firstTime) { - warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } - - var deprecations = {}; - - function deprecateSimple(name, msg) { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - utils_hooks__hooks.suppressDeprecationWarnings = false; - utils_hooks__hooks.deprecationHandler = null; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - function isObject(input) { - return Object.prototype.toString.call(input) === '[object Object]'; - } - - function locale_set__set (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _ordinalParseLenient. - this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); - } - - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - return res; - } - - function Locale(config) { - if (config != null) { - this.set(config); - } - } - - var keys; - - if (Object.keys) { - keys = Object.keys; - } else { - keys = function (obj) { - var i, res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; - } - - // internal storage for locale config files - var locales = {}; - var globalLocale; - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; - } - - function loadLocale(name) { - var oldLocale = null; - // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && (typeof module !== 'undefined') && - module && module.exports) { - try { - oldLocale = globalLocale._abbr; - require('./locale/' + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - locale_locales__getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; - } - - // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - function locale_locales__getSetGlobalLocale (key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = locale_locales__getLocale(key); - } - else { - data = defineLocale(key, values); - } - - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } - - return globalLocale._abbr; - } - - function defineLocale (name, config) { - if (config !== null) { - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale'); - config = mergeConfigs(locales[name]._config, config); - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - config = mergeConfigs(locales[config.parentLocale]._config, config); - } else { - // treat as if there is no base config - deprecateSimple('parentLocaleUndefined', - 'specified parentLocale is not defined yet'); - } - } - locales[name] = new Locale(config); - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } - - function updateLocale(name, config) { - if (config != null) { - var locale; - if (locales[name] != null) { - config = mergeConfigs(locales[name]._config, config); - } - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } - } - } - return locales[name]; - } - - // returns locale data - function locale_locales__getLocale (key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } - - return chooseLocale(key); - } - - function locale_locales__listLocales() { - return keys(locales); - } - - var aliases = {}; - - function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } - - function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; - } - - function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - get_set__set(this, unit, value); - utils_hooks__hooks.updateOffset(this, keepTime); - return this; - } else { - return get_set__get(this, unit); - } - }; - } - - function get_set__get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; - } - - function get_set__set (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } - } - - // MOMENTS - - function getSet (units, value) { - var unit; - if (typeof units === 'object') { - for (unit in units) { - this.set(unit, units[unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; - } - - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; - } - - var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; - - var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - - var formatFunctions = {}; - - var formatTokenFunctions = {}; - - // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - function addFormatToken (token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; - } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; - } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; - } - } - - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); - } - - function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; - - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } - - return function (mom) { - var output = '', i; - for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; - } - return output; - }; - } - - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } - - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - - return formatFunctions[format](m); - } - - function expandFormat(format, locale) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; - } - - var match1 = /\d/; // 0 - 9 - var match2 = /\d\d/; // 00 - 99 - var match3 = /\d{3}/; // 000 - 999 - var match4 = /\d{4}/; // 0000 - 9999 - var match6 = /[+-]?\d{6}/; // -999999 - 999999 - var match1to2 = /\d\d?/; // 0 - 99 - var match3to4 = /\d\d\d\d?/; // 999 - 9999 - var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 - var match1to3 = /\d{1,3}/; // 0 - 999 - var match1to4 = /\d{1,4}/; // 0 - 9999 - var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - - var matchUnsigned = /\d+/; // 0 - inf - var matchSigned = /[+-]?\d+/; // -inf - inf - - var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z - var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - - var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 - - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months - var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; - - - var regexes = {}; - - function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; - } - - function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } - - return regexes[token](config._strict, config._locale); - } - - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); - } - - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } - - var tokens = {}; - - function addParseToken (token, callback) { - var i, func = callback; - if (typeof token === 'string') { - token = [token]; - } - if (typeof callback === 'number') { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } - } - - function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } - - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } - - var YEAR = 0; - var MONTH = 1; - var DATE = 2; - var HOUR = 3; - var MINUTE = 4; - var SECOND = 5; - var MILLISECOND = 6; - var WEEK = 7; - var WEEKDAY = 8; - - var indexOf; - - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } - - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); - } - - // FORMATTING - - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); - - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); - - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); - - // ALIASES - - addUnitAlias('month', 'M'); - - // PARSING - - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); - - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; - }); - - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); - - // LOCALES - - var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; - var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); - function localeMonths (m, format) { - return isArray(this._months) ? this._months[m.month()] : - this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); - function localeMonthsShort (m, format) { - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : - this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - function units_month__handleStrictParse(monthName, format, strict) { - var i, ii, mom, llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = create_utc__createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return units_month__handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } - - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } - } - - // MOMENTS - - function setMonth (mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (typeof value !== 'number') { - return mom; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } - - function getSetMonth (value) { - if (value != null) { - setMonth(this, value); - utils_hooks__hooks.updateOffset(this, true); - return this; - } else { - return get_set__get(this, 'Month'); - } - } - - function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); - } - - var defaultMonthsShortRegex = matchWord; - function monthsShortRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - return this._monthsShortStrictRegex && isStrict ? - this._monthsShortStrictRegex : this._monthsShortRegex; - } - } - - var defaultMonthsRegex = matchWord; - function monthsRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - return this._monthsStrictRegex && isStrict ? - this._monthsStrictRegex : this._monthsRegex; - } - } - - function computeMonthsParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var shortPieces = [], longPieces = [], mixedPieces = [], - i, mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - } - - function checkOverflow (m) { - var overflow; - var a = m._a; - - if (a && getParsingFlags(m).overflow === -2) { - overflow = - a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : - a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : - a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : - a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : - a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : - a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : - -1; - - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } - - getParsingFlags(m).overflow = overflow; - } - - return m; - } - - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - - var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; - - var isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/] - ]; - - // iso time formats and regexes - var isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/] - ]; - - var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; - - // date from iso format - function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; - - if (match) { - getParsingFlags(config).iso = true; - - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - if (dateFormat == null) { - config._isValid = false; - return; - } - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - if (timeFormat == null) { - config._isValid = false; - return; - } - } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } - } - - // date from iso format or fallback - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - utils_hooks__hooks.createFromInputFallback(config); - } - } - - utils_hooks__hooks.createFromInputFallback = deprecate( - 'moment construction falls back to js Date. This is ' + - 'discouraged and will be removed in upcoming major ' + - 'release. Please refer to ' + - 'https://github.com/moment/moment/issues/1407 for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } - ); - - function createDate (y, m, d, h, M, s, ms) { - //can't just apply() to create a date: - //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var date = new Date(y, m, d, h, M, s, ms); - - //the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - return date; - } - - function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - - //the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; - } - - // FORMATTING - - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; - }); - - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); - - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - - // ALIASES - - addUnitAlias('year', 'y'); - - // PARSING - - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); - - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); - }); - - // HELPERS - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } - - // HOOKS - - utils_hooks__hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; - - // MOMENTS - - var getSetYear = makeGetSet('FullYear', true); - - function getIsLeapYear () { - return isLeapYear(this.year()); - } - - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - - return -fwdlw + fwd - 1; - } - - //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, resDayOfYear; - - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } - - return { - year: resYear, - dayOfYear: resDayOfYear - }; - } - - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, resYear; - - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } - - return { - week: resWeek, - year: resYear - }; - } - - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(utils_hooks__hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } - - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; - - if (config._d) { - return; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //if the day of the year is set, figure out what it is - if (config._dayOfYear) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse)) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } - } - - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - - weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); - week = defaults(w.w, 1); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } - } - - // constant that refers to the ISO standard - utils_hooks__hooks.ISO_8601 = function () {}; - - // date from string and format string - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === utils_hooks__hooks.ISO_8601) { - configFromISO(config); - return; - } - - config._a = []; - getParsingFlags(config).empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } - else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } - - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } - - // clear _12h flag if hour is <= 12 - if (getParsingFlags(config).bigHour === true && - config._a[HOUR] <= 12 && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } - - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - - configFromArray(config); - checkOverflow(config); - } - - - function meridiemFixWrap (locale, hour, meridiem) { - var isPm; - - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } - } - - // date from string and array of format strings - function configFromStringAndArray(config) { - var tempConfig, - bestMoment, - - scoreToBeat, - i, - currentScore; - - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - - if (!valid__isValid(tempConfig)) { - continue; - } - - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; - - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - - getParsingFlags(tempConfig).score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - - extend(config, bestMoment || tempConfig); - } - - function configFromObject(config) { - if (config._d) { - return; - } - - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - - configFromArray(config); - } - - function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; - } - - function prepareConfig (config) { - var input = config._i, - format = config._f; - - config._locale = config._locale || locale_locales__getLocale(config._l); - - if (input === null || (format === undefined && input === '')) { - return valid__createInvalid({nullInput: true}); - } - - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } - - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else if (isDate(input)) { - config._d = input; - } else { - configFromInput(config); - } - - if (!valid__isValid(config)) { - config._d = null; - } - - return config; - } - - function configFromInput(config) { - var input = config._i; - if (input === undefined) { - config._d = new Date(utils_hooks__hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (typeof(input) === 'object') { - configFromObject(config); - } else if (typeof(input) === 'number') { - // from milliseconds - config._d = new Date(input); - } else { - utils_hooks__hooks.createFromInputFallback(config); - } - } - - function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - - if (typeof(locale) === 'boolean') { - strict = locale; - locale = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - - return createFromConfig(c); - } - - function local__createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } - - var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - var prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return local__createLocal(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - return res; - } - - // TODO: Use [].sort instead? - function min () { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); - } - - function max () { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); - } - - var now = function () { - return Date.now ? Date.now() : +(new Date()); - }; - - function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - - this._data = {}; - - this._locale = locale_locales__getLocale(); - - this._bubble(); - } - - function isDuration (obj) { - return obj instanceof Duration; - } - - // FORMATTING - - function offset (token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); - }); - } - - offset('Z', ':'); - offset('ZZ', ''); - - // PARSING - - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); - - // HELPERS - - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; - - function offsetFromString(matcher, string) { - var matches = ((string || '').match(matcher) || []); - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); - - return parts[0] === '+' ? minutes : -minutes; - } - - // Return a moment from input, that is local/utc/zone equivalent to model. - function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - utils_hooks__hooks.updateOffset(res, false); - return res; - } else { - return local__createLocal(input).local(); - } - } - - function getDateOffset (m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; - } - - // HOOKS - - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - utils_hooks__hooks.updateOffset = function () {}; - - // MOMENTS - - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - function getSetOffset (input, keepLocalTime) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - } else if (Math.abs(input) < 16) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - utils_hooks__hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } - - function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } - } - - function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } - - function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; - - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; - } - - function setOffsetToParsedOffset () { - if (this._tzm) { - this.utcOffset(this._tzm); - } else if (typeof this._i === 'string') { - this.utcOffset(offsetFromString(matchOffset, this._i)); - } - return this; - } - - function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? local__createLocal(input).utcOffset() : 0; - - return (this.utcOffset() - input) % 60 === 0; - } - - function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); - } - - function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}; - - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; - } - - function isLocal () { - return this.isValid() ? !this._isUTC : false; - } - - function isUtcOffset () { - return this.isValid() ? this._isUTC : false; - } - - function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } - - // ASP.NET json date format regex - var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; - - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; - - function create__createDuration (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; - - if (isDuration(input)) { - duration = { - ms : input._milliseconds, - d : input._days, - M : input._months - }; - } else if (typeof input === 'number') { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : 0, - d : toInt(match[DATE]) * sign, - h : toInt(match[HOUR]) * sign, - m : toInt(match[MINUTE]) * sign, - s : toInt(match[SECOND]) * sign, - ms : toInt(match[MILLISECOND]) * sign - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : parseIso(match[2], sign), - M : parseIso(match[3], sign), - w : parseIso(match[4], sign), - d : parseIso(match[5], sign), - h : parseIso(match[6], sign), - m : parseIso(match[7], sign), - s : parseIso(match[8], sign) - }; - } else if (duration == null) {// checks for null or undefined - duration = {}; - } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); - - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } - - ret = new Duration(duration); - - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } - - return ret; - } - - create__createDuration.fn = Duration.prototype; - - function parseIso (inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - } - - function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; - - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } - - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); - - return res; - } - - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } - - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - - return res; - } - - function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } - - // TODO: remove 'name' arg after deprecation is removed - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); - tmp = val; val = period; period = tmp; - } - - val = typeof val === 'string' ? +val : val; - dur = create__createDuration(val, period); - add_subtract__addSubtract(this, dur, direction); - return this; - }; - } - - function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - updateOffset = updateOffset == null ? true : updateOffset; - - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - utils_hooks__hooks.updateOffset(mom, days || months); - } - } - - var add_subtract__add = createAdder(1, 'add'); - var add_subtract__subtract = createAdder(-1, 'subtract'); - - function moment_calendar__calendar (time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || local__createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - diff = this.diff(sod, 'days', true), - format = diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - - var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]); - - return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); - } - - function clone () { - return new Moment(this); - } - - function isAfter (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - - function isBefore (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } - - function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); - } - - function isSame (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units || 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } - } - - function isSameOrAfter (input, units) { - return this.isSame(input, units) || this.isAfter(input,units); - } - - function isSameOrBefore (input, units) { - return this.isSame(input, units) || this.isBefore(input,units); - } - - function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); - - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - return asFloat ? output : absFloor(output); - } - - function monthDiff (a, b) { - // difference in months - var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); - } - - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; - } - - utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString () { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } - - function moment_format__toISOString () { - var m = this.clone().utc(); - if (0 < m.year() && m.year() <= 9999) { - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } else { - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } else { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } - - function format (inputString) { - if (!inputString) { - inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat; - } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } - - function from (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function fromNow (withoutSuffix) { - return this.from(local__createLocal(), withoutSuffix); - } - - function to (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function toNow (withoutSuffix) { - return this.to(local__createLocal(), withoutSuffix); - } - - // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - function locale (key) { - var newLocaleData; - - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = locale_locales__getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } - } - - var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } - ); - - function localeData () { - return this._locale; - } - - function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; - } - - function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } - - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; - } - - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); - } - - function to_type__valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); - } - - function unix () { - return Math.floor(this.valueOf() / 1000); - } - - function toDate () { - return this._offset ? new Date(this.valueOf()) : this._d; - } - - function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; - } - - function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; - } - - function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } - - function moment_valid__isValid () { - return valid__isValid(this); - } - - function parsingFlags () { - return extend({}, getParsingFlags(this)); - } - - function invalidAt () { - return getParsingFlags(this).overflow; - } - - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; - } - - // FORMATTING - - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); - - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); - - function addWeekYearFormatToken (token, getter) { - addFormatToken(0, [token, token.length], 0, getter); - } - - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - - // ALIASES - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); - - // PARSING - - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); - - addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); - }); - - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - - // MOMENTS - - function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); - } - - function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); - } - - function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); - } - - function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } - - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } - } - - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; - } - - // FORMATTING - - addFormatToken('Q', 0, 'Qo', 'quarter'); - - // ALIASES - - addUnitAlias('quarter', 'Q'); - - // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); - - // MOMENTS - - function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - } - - // FORMATTING - - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - - // ALIASES - - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); - - // PARSING - - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); - - addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - }); - - // HELPERS - - // LOCALES - - function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } - - var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - }; - - function localeFirstDayOfWeek () { - return this._week.dow; - } - - function localeFirstDayOfYear () { - return this._week.doy; - } - - // MOMENTS - - function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - // FORMATTING - - addFormatToken('D', ['DD', 2], 'Do', 'date'); - - // ALIASES - - addUnitAlias('date', 'D'); - - // PARSING - - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; - }); - - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); - }); - - // MOMENTS - - var getSetDayOfMonth = makeGetSet('Date', true); - - // FORMATTING - - addFormatToken('d', 0, 'do', 'day'); - - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); - - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); - - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); - - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); - - // ALIASES - - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); - - // PARSING - - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); - - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } - }); - - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); - - // HELPERS - - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } - - return null; - } - - // LOCALES - - var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); - function localeWeekdays (m, format) { - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; - } - - var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); - function localeWeekdaysShort (m) { - return this._weekdaysShort[m.day()]; - } - - var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); - function localeWeekdaysMin (m) { - return this._weekdaysMin[m.day()]; - } - - function day_of_week__handleStrictParse(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; - - for (i = 0; i < 7; ++i) { - mom = create_utc__createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return day_of_week__handleStrictParse.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - - mom = create_utc__createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); - } - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - } - - // MOMENTS - - function getSetDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } - - function getSetLocaleDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } - - function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); - } - - var defaultWeekdaysRegex = matchWord; - function weekdaysRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - return this._weekdaysStrictRegex && isStrict ? - this._weekdaysStrictRegex : this._weekdaysRegex; - } - } - - var defaultWeekdaysShortRegex = matchWord; - function weekdaysShortRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - return this._weekdaysShortStrictRegex && isStrict ? - this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } - } - - var defaultWeekdaysMinRegex = matchWord; - function weekdaysMinRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - return this._weekdaysMinStrictRegex && isStrict ? - this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } - } - - - function computeWeekdaysParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], - i, mom, minp, shortp, longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); - } - - // FORMATTING - - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - - // ALIASES - - addUnitAlias('dayOfYear', 'DDD'); - - // PARSING - - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); - - // HELPERS - - // MOMENTS - - function getSetDayOfYear (input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); - } - - // FORMATTING - - function hFormat() { - return this.hours() % 12 || 12; - } - - function kFormat() { - return this.hours() || 24; - } - - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); - - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); - - addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); - - addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); - } - - meridiem('a', true); - meridiem('A', false); - - // ALIASES - - addUnitAlias('hour', 'h'); - - // PARSING - - function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; - } - - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); - - addParseToken(['H', 'HH'], HOUR); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); - - // LOCALES - - function localeIsPM (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); - } - - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; - function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - } - - - // MOMENTS - - // Setting the hour should keep the time, because the user explicitly - // specified which hour he wants. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - var getSetHour = makeGetSet('Hours', true); - - // FORMATTING - - addFormatToken('m', ['mm', 2], 0, 'minute'); - - // ALIASES - - addUnitAlias('minute', 'm'); - - // PARSING - - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); - - // MOMENTS - - var getSetMinute = makeGetSet('Minutes', false); - - // FORMATTING - - addFormatToken('s', ['ss', 2], 0, 'second'); - - // ALIASES - - addUnitAlias('second', 's'); - - // PARSING - - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); - - // MOMENTS - - var getSetSecond = makeGetSet('Seconds', false); - - // FORMATTING - - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); - - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); - - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); - - - // ALIASES - - addUnitAlias('millisecond', 'ms'); - - // PARSING - - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); - - var token; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } - - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } - - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } - // MOMENTS - - var getSetMillisecond = makeGetSet('Milliseconds', false); - - // FORMATTING - - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); - - // MOMENTS - - function getZoneAbbr () { - return this._isUTC ? 'UTC' : ''; - } - - function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } - - var momentPrototype__proto = Moment.prototype; - - momentPrototype__proto.add = add_subtract__add; - momentPrototype__proto.calendar = moment_calendar__calendar; - momentPrototype__proto.clone = clone; - momentPrototype__proto.diff = diff; - momentPrototype__proto.endOf = endOf; - momentPrototype__proto.format = format; - momentPrototype__proto.from = from; - momentPrototype__proto.fromNow = fromNow; - momentPrototype__proto.to = to; - momentPrototype__proto.toNow = toNow; - momentPrototype__proto.get = getSet; - momentPrototype__proto.invalidAt = invalidAt; - momentPrototype__proto.isAfter = isAfter; - momentPrototype__proto.isBefore = isBefore; - momentPrototype__proto.isBetween = isBetween; - momentPrototype__proto.isSame = isSame; - momentPrototype__proto.isSameOrAfter = isSameOrAfter; - momentPrototype__proto.isSameOrBefore = isSameOrBefore; - momentPrototype__proto.isValid = moment_valid__isValid; - momentPrototype__proto.lang = lang; - momentPrototype__proto.locale = locale; - momentPrototype__proto.localeData = localeData; - momentPrototype__proto.max = prototypeMax; - momentPrototype__proto.min = prototypeMin; - momentPrototype__proto.parsingFlags = parsingFlags; - momentPrototype__proto.set = getSet; - momentPrototype__proto.startOf = startOf; - momentPrototype__proto.subtract = add_subtract__subtract; - momentPrototype__proto.toArray = toArray; - momentPrototype__proto.toObject = toObject; - momentPrototype__proto.toDate = toDate; - momentPrototype__proto.toISOString = moment_format__toISOString; - momentPrototype__proto.toJSON = toJSON; - momentPrototype__proto.toString = toString; - momentPrototype__proto.unix = unix; - momentPrototype__proto.valueOf = to_type__valueOf; - momentPrototype__proto.creationData = creationData; - - // Year - momentPrototype__proto.year = getSetYear; - momentPrototype__proto.isLeapYear = getIsLeapYear; - - // Week Year - momentPrototype__proto.weekYear = getSetWeekYear; - momentPrototype__proto.isoWeekYear = getSetISOWeekYear; - - // Quarter - momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; - - // Month - momentPrototype__proto.month = getSetMonth; - momentPrototype__proto.daysInMonth = getDaysInMonth; - - // Week - momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; - momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; - momentPrototype__proto.weeksInYear = getWeeksInYear; - momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; - - // Day - momentPrototype__proto.date = getSetDayOfMonth; - momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; - momentPrototype__proto.weekday = getSetLocaleDayOfWeek; - momentPrototype__proto.isoWeekday = getSetISODayOfWeek; - momentPrototype__proto.dayOfYear = getSetDayOfYear; - - // Hour - momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; - - // Minute - momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; - - // Second - momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; - - // Millisecond - momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; - - // Offset - momentPrototype__proto.utcOffset = getSetOffset; - momentPrototype__proto.utc = setOffsetToUTC; - momentPrototype__proto.local = setOffsetToLocal; - momentPrototype__proto.parseZone = setOffsetToParsedOffset; - momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; - momentPrototype__proto.isDST = isDaylightSavingTime; - momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted; - momentPrototype__proto.isLocal = isLocal; - momentPrototype__proto.isUtcOffset = isUtcOffset; - momentPrototype__proto.isUtc = isUtc; - momentPrototype__proto.isUTC = isUtc; - - // Timezone - momentPrototype__proto.zoneAbbr = getZoneAbbr; - momentPrototype__proto.zoneName = getZoneName; - - // Deprecations - momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); - momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); - momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); - momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone); - - var momentPrototype = momentPrototype__proto; - - function moment__createUnix (input) { - return local__createLocal(input * 1000); - } - - function moment__createInZone () { - return local__createLocal.apply(null, arguments).parseZone(); - } - - var defaultCalendar = { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }; - - function locale_calendar__calendar (key, mom, now) { - var output = this._calendar[key]; - return isFunction(output) ? output.call(mom, now) : output; - } - - var defaultLongDateFormat = { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }; - - function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - - return this._longDateFormat[key]; - } - - var defaultInvalidDate = 'Invalid date'; - - function invalidDate () { - return this._invalidDate; - } - - var defaultOrdinal = '%d'; - var defaultOrdinalParse = /\d{1,2}/; - - function ordinal (number) { - return this._ordinal.replace('%d', number); - } - - function preParsePostFormat (string) { - return string; - } - - var defaultRelativeTime = { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }; - - function relative__relativeTime (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (isFunction(output)) ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); - } - - function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - - var prototype__proto = Locale.prototype; - - prototype__proto._calendar = defaultCalendar; - prototype__proto.calendar = locale_calendar__calendar; - prototype__proto._longDateFormat = defaultLongDateFormat; - prototype__proto.longDateFormat = longDateFormat; - prototype__proto._invalidDate = defaultInvalidDate; - prototype__proto.invalidDate = invalidDate; - prototype__proto._ordinal = defaultOrdinal; - prototype__proto.ordinal = ordinal; - prototype__proto._ordinalParse = defaultOrdinalParse; - prototype__proto.preparse = preParsePostFormat; - prototype__proto.postformat = preParsePostFormat; - prototype__proto._relativeTime = defaultRelativeTime; - prototype__proto.relativeTime = relative__relativeTime; - prototype__proto.pastFuture = pastFuture; - prototype__proto.set = locale_set__set; - - // Month - prototype__proto.months = localeMonths; - prototype__proto._months = defaultLocaleMonths; - prototype__proto.monthsShort = localeMonthsShort; - prototype__proto._monthsShort = defaultLocaleMonthsShort; - prototype__proto.monthsParse = localeMonthsParse; - prototype__proto._monthsRegex = defaultMonthsRegex; - prototype__proto.monthsRegex = monthsRegex; - prototype__proto._monthsShortRegex = defaultMonthsShortRegex; - prototype__proto.monthsShortRegex = monthsShortRegex; - - // Week - prototype__proto.week = localeWeek; - prototype__proto._week = defaultLocaleWeek; - prototype__proto.firstDayOfYear = localeFirstDayOfYear; - prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; - - // Day of Week - prototype__proto.weekdays = localeWeekdays; - prototype__proto._weekdays = defaultLocaleWeekdays; - prototype__proto.weekdaysMin = localeWeekdaysMin; - prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin; - prototype__proto.weekdaysShort = localeWeekdaysShort; - prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort; - prototype__proto.weekdaysParse = localeWeekdaysParse; - - prototype__proto._weekdaysRegex = defaultWeekdaysRegex; - prototype__proto.weekdaysRegex = weekdaysRegex; - prototype__proto._weekdaysShortRegex = defaultWeekdaysShortRegex; - prototype__proto.weekdaysShortRegex = weekdaysShortRegex; - prototype__proto._weekdaysMinRegex = defaultWeekdaysMinRegex; - prototype__proto.weekdaysMinRegex = weekdaysMinRegex; - - // Hours - prototype__proto.isPM = localeIsPM; - prototype__proto._meridiemParse = defaultLocaleMeridiemParse; - prototype__proto.meridiem = localeMeridiem; - - function lists__get (format, index, field, setter) { - var locale = locale_locales__getLocale(); - var utc = create_utc__createUTC().set(setter, index); - return locale[field](utc, format); - } - - function listMonthsImpl (format, index, field) { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return lists__get(format, index, field, 'month'); - } - - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = lists__get(format, i, field, 'month'); - } - return out; - } - - // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - function listWeekdaysImpl (localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } - - var locale = locale_locales__getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return lists__get(format, (index + shift) % 7, field, 'day'); - } - - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = lists__get(format, (i + shift) % 7, field, 'day'); - } - return out; - } - - function lists__listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); - } - - function lists__listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } - - function lists__listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } - - function lists__listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - - function lists__listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } - - locale_locales__getSetGlobalLocale('en', { - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - // Side effect imports - utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); - utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); - - var mathAbs = Math.abs; - - function duration_abs__abs () { - var data = this._data; - - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); - - return this; - } - - function duration_add_subtract__addSubtract (duration, input, value, direction) { - var other = create__createDuration(input, value); - - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - - return duration._bubble(); - } - - // supports only 2.0-style add(1, 's') or add(duration) - function duration_add_subtract__add (input, value) { - return duration_add_subtract__addSubtract(this, input, value, 1); - } - - // supports only 2.0-style subtract(1, 's') or subtract(duration) - function duration_add_subtract__subtract (input, value) { - return duration_add_subtract__addSubtract(this, input, value, -1); - } - - function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } - - function bubble () { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } - - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; - - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - - hours = absFloor(minutes / 60); - data.hours = hours % 24; - - days += absFloor(hours / 24); - - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - data.days = days; - data.months = months; - data.years = years; - - return this; - } - - function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; - } - - function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; - } - - function as (units) { - var days; - var months; - var milliseconds = this._milliseconds; - - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } - } - - // TODO: Use this.as('ms')? - function duration_as__valueOf () { - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); - } - - function makeAs (alias) { - return function () { - return this.as(alias); - }; - } - - var asMilliseconds = makeAs('ms'); - var asSeconds = makeAs('s'); - var asMinutes = makeAs('m'); - var asHours = makeAs('h'); - var asDays = makeAs('d'); - var asWeeks = makeAs('w'); - var asMonths = makeAs('M'); - var asYears = makeAs('y'); - - function duration_get__get (units) { - units = normalizeUnits(units); - return this[units + 's'](); - } - - function makeGetter(name) { - return function () { - return this._data[name]; - }; - } - - var milliseconds = makeGetter('milliseconds'); - var seconds = makeGetter('seconds'); - var minutes = makeGetter('minutes'); - var hours = makeGetter('hours'); - var days = makeGetter('days'); - var months = makeGetter('months'); - var years = makeGetter('years'); - - function weeks () { - return absFloor(this.days() / 7); - } - - var round = Math.round; - var thresholds = { - s: 45, // seconds to minute - m: 45, // minutes to hour - h: 22, // hours to day - d: 26, // days to month - M: 11 // months to year - }; - - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } - - function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { - var duration = create__createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - - var a = seconds < thresholds.s && ['s', seconds] || - minutes <= 1 && ['m'] || - minutes < thresholds.m && ['mm', minutes] || - hours <= 1 && ['h'] || - hours < thresholds.h && ['hh', hours] || - days <= 1 && ['d'] || - days < thresholds.d && ['dd', days] || - months <= 1 && ['M'] || - months < thresholds.M && ['MM', months] || - years <= 1 && ['y'] || ['yy', years]; - - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); - } - - // This function allows you to set a threshold for relative time strings - function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - return true; - } - - function humanize (withSuffix) { - var locale = this.localeData(); - var output = duration_humanize__relativeTime(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); - } - - var iso_string__abs = Math.abs; - - function iso_string__toISOString() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - var seconds = iso_string__abs(this._milliseconds) / 1000; - var days = iso_string__abs(this._days); - var months = iso_string__abs(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); - } - - var duration_prototype__proto = Duration.prototype; - - duration_prototype__proto.abs = duration_abs__abs; - duration_prototype__proto.add = duration_add_subtract__add; - duration_prototype__proto.subtract = duration_add_subtract__subtract; - duration_prototype__proto.as = as; - duration_prototype__proto.asMilliseconds = asMilliseconds; - duration_prototype__proto.asSeconds = asSeconds; - duration_prototype__proto.asMinutes = asMinutes; - duration_prototype__proto.asHours = asHours; - duration_prototype__proto.asDays = asDays; - duration_prototype__proto.asWeeks = asWeeks; - duration_prototype__proto.asMonths = asMonths; - duration_prototype__proto.asYears = asYears; - duration_prototype__proto.valueOf = duration_as__valueOf; - duration_prototype__proto._bubble = bubble; - duration_prototype__proto.get = duration_get__get; - duration_prototype__proto.milliseconds = milliseconds; - duration_prototype__proto.seconds = seconds; - duration_prototype__proto.minutes = minutes; - duration_prototype__proto.hours = hours; - duration_prototype__proto.days = days; - duration_prototype__proto.weeks = weeks; - duration_prototype__proto.months = months; - duration_prototype__proto.years = years; - duration_prototype__proto.humanize = humanize; - duration_prototype__proto.toISOString = iso_string__toISOString; - duration_prototype__proto.toString = iso_string__toISOString; - duration_prototype__proto.toJSON = iso_string__toISOString; - duration_prototype__proto.locale = locale; - duration_prototype__proto.localeData = localeData; - - // Deprecations - duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); - duration_prototype__proto.lang = lang; - - // Side effect imports - - // FORMATTING - - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); - - // PARSING - - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); - - // Side effect imports - - - utils_hooks__hooks.version = '2.13.0'; - - setHookCallback(local__createLocal); - - utils_hooks__hooks.fn = momentPrototype; - utils_hooks__hooks.min = min; - utils_hooks__hooks.max = max; - utils_hooks__hooks.now = now; - utils_hooks__hooks.utc = create_utc__createUTC; - utils_hooks__hooks.unix = moment__createUnix; - utils_hooks__hooks.months = lists__listMonths; - utils_hooks__hooks.isDate = isDate; - utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; - utils_hooks__hooks.invalid = valid__createInvalid; - utils_hooks__hooks.duration = create__createDuration; - utils_hooks__hooks.isMoment = isMoment; - utils_hooks__hooks.weekdays = lists__listWeekdays; - utils_hooks__hooks.parseZone = moment__createInZone; - utils_hooks__hooks.localeData = locale_locales__getLocale; - utils_hooks__hooks.isDuration = isDuration; - utils_hooks__hooks.monthsShort = lists__listMonthsShort; - utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; - utils_hooks__hooks.defineLocale = defineLocale; - utils_hooks__hooks.updateLocale = updateLocale; - utils_hooks__hooks.locales = locale_locales__listLocales; - utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; - utils_hooks__hooks.normalizeUnits = normalizeUnits; - utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; - utils_hooks__hooks.prototype = momentPrototype; - - var _moment = utils_hooks__hooks; - - return _moment; - -})); \ No newline at end of file diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/check-overflow.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/check-overflow.js deleted file mode 100644 index 08547e4b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/check-overflow.js +++ /dev/null @@ -1,34 +0,0 @@ -import { daysInMonth } from '../units/month'; -import { YEAR, MONTH, DATE, HOUR, MINUTE, SECOND, MILLISECOND, WEEK, WEEKDAY } from '../units/constants'; -import getParsingFlags from 'parsing-flags'; - -export default function checkOverflow (m) { - var overflow; - var a = m._a; - - if (a && getParsingFlags(m).overflow === -2) { - overflow = - a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : - a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : - a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : - a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : - a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : - a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : - -1; - - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } - - getParsingFlags(m).overflow = overflow; - } - - return m; -} - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/date-from-array.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/date-from-array.js deleted file mode 100644 index 180f55c7..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/date-from-array.js +++ /dev/null @@ -1,21 +0,0 @@ -export function createDate (y, m, d, h, M, s, ms) { - //can't just apply() to create a date: - //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var date = new Date(y, m, d, h, M, s, ms); - - //the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - return date; -} - -export function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - - //the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-anything.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-anything.js deleted file mode 100644 index 022c6eb1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-anything.js +++ /dev/null @@ -1,101 +0,0 @@ -import isArray from '../utils/is-array'; -import isDate from '../utils/is-date'; -import map from '../utils/map'; -import { createInvalid } from './valid'; -import { Moment, isMoment } from '../moment/constructor'; -import { getLocale } from '../locale/locales'; -import { hooks } from '../utils/hooks'; -import checkOverflow from './check-overflow'; -import { isValid } from './valid'; - -import { configFromStringAndArray } from './from-string-and-array'; -import { configFromStringAndFormat } from './from-string-and-format'; -import { configFromString } from './from-string'; -import { configFromArray } from './from-array'; -import { configFromObject } from './from-object'; - -function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; -} - -export function prepareConfig (config) { - var input = config._i, - format = config._f; - - config._locale = config._locale || getLocale(config._l); - - if (input === null || (format === undefined && input === '')) { - return createInvalid({nullInput: true}); - } - - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } - - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else if (isDate(input)) { - config._d = input; - } else { - configFromInput(config); - } - - if (!isValid(config)) { - config._d = null; - } - - return config; -} - -function configFromInput(config) { - var input = config._i; - if (input === undefined) { - config._d = new Date(hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (typeof(input) === 'object') { - configFromObject(config); - } else if (typeof(input) === 'number') { - // from milliseconds - config._d = new Date(input); - } else { - hooks.createFromInputFallback(config); - } -} - -export function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - - if (typeof(locale) === 'boolean') { - strict = locale; - locale = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - - return createFromConfig(c); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-array.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-array.js deleted file mode 100644 index 25dbc28f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-array.js +++ /dev/null @@ -1,136 +0,0 @@ -import { hooks } from '../utils/hooks'; -import { createDate, createUTCDate } from './date-from-array'; -import { daysInYear } from '../units/year'; -import { weekOfYear, weeksInYear, dayOfYearFromWeeks } from '../units/week-calendar-utils'; -import { YEAR, MONTH, DATE, HOUR, MINUTE, SECOND, MILLISECOND } from '../units/constants'; -import { createLocal } from './local'; -import defaults from '../utils/defaults'; -import getParsingFlags from './parsing-flags'; - -function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; -} - -// convert an array to a date. -// the array should mirror the parameters below -// note: all values past the year are optional and will default to the lowest possible value. -// [year, month, day , hour, minute, second, millisecond] -export function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; - - if (config._d) { - return; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //if the day of the year is set, figure out what it is - if (config._dayOfYear) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse)) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } -} - -function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - - weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(createLocal(), dow, doy).year); - week = defaults(w.w, 1); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-object.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-object.js deleted file mode 100644 index c0bfe9f8..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-object.js +++ /dev/null @@ -1,16 +0,0 @@ -import { normalizeObjectUnits } from '../units/aliases'; -import { configFromArray } from './from-array'; -import map from '../utils/map'; - -export function configFromObject(config) { - if (config._d) { - return; - } - - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - - configFromArray(config); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-array.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-array.js deleted file mode 100644 index 1d8a7a80..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-array.js +++ /dev/null @@ -1,50 +0,0 @@ -import { copyConfig } from '../moment/constructor'; -import { configFromStringAndFormat } from './from-string-and-format'; -import getParsingFlags from './parsing-flags'; -import { isValid } from './valid'; -import extend from '../utils/extend'; - -// date from string and array of format strings -export function configFromStringAndArray(config) { - var tempConfig, - bestMoment, - - scoreToBeat, - i, - currentScore; - - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - - if (!isValid(tempConfig)) { - continue; - } - - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; - - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - - getParsingFlags(tempConfig).score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - - extend(config, bestMoment || tempConfig); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-format.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-format.js deleted file mode 100644 index bbaab0de..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string-and-format.js +++ /dev/null @@ -1,107 +0,0 @@ -import { configFromISO } from './from-string'; -import { configFromArray } from './from-array'; -import { getParseRegexForToken } from '../parse/regex'; -import { addTimeToArrayFromToken } from '../parse/token'; -import { expandFormat, formatTokenFunctions, formattingTokens } from '../format/format'; -import checkOverflow from './check-overflow'; -import { HOUR } from '../units/constants'; -import { hooks } from '../utils/hooks'; -import getParsingFlags from './parsing-flags'; - -// constant that refers to the ISO standard -hooks.ISO_8601 = function () {}; - -// date from string and format string -export function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === hooks.ISO_8601) { - configFromISO(config); - return; - } - - config._a = []; - getParsingFlags(config).empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } - else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } - - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } - - // clear _12h flag if hour is <= 12 - if (getParsingFlags(config).bigHour === true && - config._a[HOUR] <= 12 && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } - - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - - configFromArray(config); - checkOverflow(config); -} - - -function meridiemFixWrap (locale, hour, meridiem) { - var isPm; - - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string.js deleted file mode 100644 index 6852049f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/from-string.js +++ /dev/null @@ -1,120 +0,0 @@ -import { configFromStringAndFormat } from './from-string-and-format'; -import { hooks } from '../utils/hooks'; -import { deprecate } from '../utils/deprecate'; -import getParsingFlags from './parsing-flags'; - -// iso 8601 regex -// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) -var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; -var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - -var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; - -var isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/] -]; - -// iso time formats and regexes -var isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/] -]; - -var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; - -// date from iso format -export function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; - - if (match) { - getParsingFlags(config).iso = true; - - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - if (dateFormat == null) { - config._isValid = false; - return; - } - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - if (timeFormat == null) { - config._isValid = false; - return; - } - } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } -} - -// date from iso format or fallback -export function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - hooks.createFromInputFallback(config); - } -} - -hooks.createFromInputFallback = deprecate( - 'moment construction falls back to js Date. This is ' + - 'discouraged and will be removed in upcoming major ' + - 'release. Please refer to ' + - 'https://github.com/moment/moment/issues/1407 for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } -); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/local.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/local.js deleted file mode 100644 index 88c1e269..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/local.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createLocalOrUTC } from './from-anything'; - -export function createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/parsing-flags.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/parsing-flags.js deleted file mode 100644 index 5a422001..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/parsing-flags.js +++ /dev/null @@ -1,24 +0,0 @@ -function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso : false, - parsedDateParts : [], - meridiem : null - }; -} - -export default function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/utc.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/utc.js deleted file mode 100644 index 96139530..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/utc.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createLocalOrUTC } from './from-anything'; - -export function createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/valid.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/valid.js deleted file mode 100644 index 2b1d45ee..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/create/valid.js +++ /dev/null @@ -1,42 +0,0 @@ -import extend from '../utils/extend'; -import { createUTC } from './utc'; -import getParsingFlags from 'parsing-flags'; -import some from '../utils/some'; - -export function isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }); - m._isValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); - - if (m._strict) { - m._isValid = m._isValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - } - return m._isValid; -} - -export function createInvalid (flags) { - var m = createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } - - return m; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/abs.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/abs.js deleted file mode 100644 index 103a4cf9..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/abs.js +++ /dev/null @@ -1,18 +0,0 @@ -var mathAbs = Math.abs; - -export function abs () { - var data = this._data; - - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); - - return this; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/add-subtract.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/add-subtract.js deleted file mode 100644 index 3b44e186..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/add-subtract.js +++ /dev/null @@ -1,21 +0,0 @@ -import { createDuration } from './create'; - -function addSubtract (duration, input, value, direction) { - var other = createDuration(input, value); - - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - - return duration._bubble(); -} - -// supports only 2.0-style add(1, 's') or add(duration) -export function add (input, value) { - return addSubtract(this, input, value, 1); -} - -// supports only 2.0-style subtract(1, 's') or subtract(duration) -export function subtract (input, value) { - return addSubtract(this, input, value, -1); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/as.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/as.js deleted file mode 100644 index 03ecd6da..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/as.js +++ /dev/null @@ -1,55 +0,0 @@ -import { daysToMonths, monthsToDays } from './bubble'; -import { normalizeUnits } from '../units/aliases'; -import toInt from '../utils/to-int'; - -export function as (units) { - var days; - var months; - var milliseconds = this._milliseconds; - - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } -} - -// TODO: Use this.as('ms')? -export function valueOf () { - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); -} - -function makeAs (alias) { - return function () { - return this.as(alias); - }; -} - -export var asMilliseconds = makeAs('ms'); -export var asSeconds = makeAs('s'); -export var asMinutes = makeAs('m'); -export var asHours = makeAs('h'); -export var asDays = makeAs('d'); -export var asWeeks = makeAs('w'); -export var asMonths = makeAs('M'); -export var asYears = makeAs('y'); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/bubble.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/bubble.js deleted file mode 100644 index 0c4a336e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/bubble.js +++ /dev/null @@ -1,61 +0,0 @@ -import absFloor from '../utils/abs-floor'; -import absCeil from '../utils/abs-ceil'; -import { createUTCDate } from '../create/date-from-array'; - -export function bubble () { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } - - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; - - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - - hours = absFloor(minutes / 60); - data.hours = hours % 24; - - days += absFloor(hours / 24); - - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - data.days = days; - data.months = months; - data.years = years; - - return this; -} - -export function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; -} - -export function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/constructor.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/constructor.js deleted file mode 100644 index fb01c704..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/constructor.js +++ /dev/null @@ -1,41 +0,0 @@ -import { normalizeObjectUnits } from '../units/aliases'; -import { getLocale } from '../locale/locales'; - -export function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - - this._data = {}; - - this._locale = getLocale(); - - this._bubble(); -} - -export function isDuration (obj) { - return obj instanceof Duration; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/create.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/create.js deleted file mode 100644 index 24275d68..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/create.js +++ /dev/null @@ -1,118 +0,0 @@ -import { Duration, isDuration } from './constructor'; -import toInt from '../utils/to-int'; -import hasOwnProp from '../utils/has-own-prop'; -import { DATE, HOUR, MINUTE, SECOND, MILLISECOND } from '../units/constants'; -import { cloneWithOffset } from '../units/offset'; -import { createLocal } from '../create/local'; - -// ASP.NET json date format regex -var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; - -// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html -// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere -// and further modified to allow for strings containing both week and day -var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; - -export function createDuration (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; - - if (isDuration(input)) { - duration = { - ms : input._milliseconds, - d : input._days, - M : input._months - }; - } else if (typeof input === 'number') { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : 0, - d : toInt(match[DATE]) * sign, - h : toInt(match[HOUR]) * sign, - m : toInt(match[MINUTE]) * sign, - s : toInt(match[SECOND]) * sign, - ms : toInt(match[MILLISECOND]) * sign - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : parseIso(match[2], sign), - M : parseIso(match[3], sign), - w : parseIso(match[4], sign), - d : parseIso(match[5], sign), - h : parseIso(match[6], sign), - m : parseIso(match[7], sign), - s : parseIso(match[8], sign) - }; - } else if (duration == null) {// checks for null or undefined - duration = {}; - } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); - - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } - - ret = new Duration(duration); - - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } - - return ret; -} - -createDuration.fn = Duration.prototype; - -function parseIso (inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; -} - -function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; - - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } - - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); - - return res; -} - -function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } - - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - - return res; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/duration.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/duration.js deleted file mode 100644 index 24440bb2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/duration.js +++ /dev/null @@ -1,12 +0,0 @@ -// Side effect imports -import './prototype'; - -import { createDuration } from './create'; -import { isDuration } from './constructor'; -import { getSetRelativeTimeThreshold } from './humanize'; - -export { - createDuration, - isDuration, - getSetRelativeTimeThreshold -}; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/get.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/get.js deleted file mode 100644 index 6dafacdd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/get.js +++ /dev/null @@ -1,25 +0,0 @@ -import { normalizeUnits } from '../units/aliases'; -import absFloor from '../utils/abs-floor'; - -export function get (units) { - units = normalizeUnits(units); - return this[units + 's'](); -} - -function makeGetter(name) { - return function () { - return this._data[name]; - }; -} - -export var milliseconds = makeGetter('milliseconds'); -export var seconds = makeGetter('seconds'); -export var minutes = makeGetter('minutes'); -export var hours = makeGetter('hours'); -export var days = makeGetter('days'); -export var months = makeGetter('months'); -export var years = makeGetter('years'); - -export function weeks () { - return absFloor(this.days() / 7); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/humanize.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/humanize.js deleted file mode 100644 index eb03311d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/humanize.js +++ /dev/null @@ -1,64 +0,0 @@ -import { createDuration } from './create'; - -var round = Math.round; -var thresholds = { - s: 45, // seconds to minute - m: 45, // minutes to hour - h: 22, // hours to day - d: 26, // days to month - M: 11 // months to year -}; - -// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize -function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); -} - -function relativeTime (posNegDuration, withoutSuffix, locale) { - var duration = createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - - var a = seconds < thresholds.s && ['s', seconds] || - minutes <= 1 && ['m'] || - minutes < thresholds.m && ['mm', minutes] || - hours <= 1 && ['h'] || - hours < thresholds.h && ['hh', hours] || - days <= 1 && ['d'] || - days < thresholds.d && ['dd', days] || - months <= 1 && ['M'] || - months < thresholds.M && ['MM', months] || - years <= 1 && ['y'] || ['yy', years]; - - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); -} - -// This function allows you to set a threshold for relative time strings -export function getSetRelativeTimeThreshold (threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - return true; -} - -export function humanize (withSuffix) { - var locale = this.localeData(); - var output = relativeTime(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/iso-string.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/iso-string.js deleted file mode 100644 index f33a968d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/iso-string.js +++ /dev/null @@ -1,52 +0,0 @@ -import absFloor from '../utils/abs-floor'; -var abs = Math.abs; - -export function toISOString() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - var seconds = abs(this._milliseconds) / 1000; - var days = abs(this._days); - var months = abs(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/prototype.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/prototype.js deleted file mode 100644 index 0257ff9b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/duration/prototype.js +++ /dev/null @@ -1,48 +0,0 @@ -import { Duration } from './constructor'; - -var proto = Duration.prototype; - -import { abs } from './abs'; -import { add, subtract } from './add-subtract'; -import { as, asMilliseconds, asSeconds, asMinutes, asHours, asDays, asWeeks, asMonths, asYears, valueOf } from './as'; -import { bubble } from './bubble'; -import { get, milliseconds, seconds, minutes, hours, days, months, years, weeks } from './get'; -import { humanize } from './humanize'; -import { toISOString } from './iso-string'; -import { lang, locale, localeData } from '../moment/locale'; - -proto.abs = abs; -proto.add = add; -proto.subtract = subtract; -proto.as = as; -proto.asMilliseconds = asMilliseconds; -proto.asSeconds = asSeconds; -proto.asMinutes = asMinutes; -proto.asHours = asHours; -proto.asDays = asDays; -proto.asWeeks = asWeeks; -proto.asMonths = asMonths; -proto.asYears = asYears; -proto.valueOf = valueOf; -proto._bubble = bubble; -proto.get = get; -proto.milliseconds = milliseconds; -proto.seconds = seconds; -proto.minutes = minutes; -proto.hours = hours; -proto.days = days; -proto.weeks = weeks; -proto.months = months; -proto.years = years; -proto.humanize = humanize; -proto.toISOString = toISOString; -proto.toString = toISOString; -proto.toJSON = toISOString; -proto.locale = locale; -proto.localeData = localeData; - -// Deprecations -import { deprecate } from '../utils/deprecate'; - -proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString); -proto.lang = lang; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/format/format.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/format/format.js deleted file mode 100644 index 33486f1d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/format/format.js +++ /dev/null @@ -1,91 +0,0 @@ -import zeroFill from '../utils/zero-fill'; - -export var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; - -var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - -var formatFunctions = {}; - -export var formatTokenFunctions = {}; - -// token: 'M' -// padded: ['MM', 2] -// ordinal: 'Mo' -// callback: function () { this.month() + 1 } -export function addFormatToken (token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; - } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; - } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; - } -} - -function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); -} - -function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; - - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } - - return function (mom) { - var output = '', i; - for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; - } - return output; - }; -} - -// format date using native date object -export function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } - - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - - return formatFunctions[format](m); -} - -export function expandFormat(format, locale) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/calendar.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/calendar.js deleted file mode 100644 index e9cad6d1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/calendar.js +++ /dev/null @@ -1,15 +0,0 @@ -export var defaultCalendar = { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' -}; - -import isFunction from '../utils/is-function'; - -export function calendar (key, mom, now) { - var output = this._calendar[key]; - return isFunction(output) ? output.call(mom, now) : output; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/constructor.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/constructor.js deleted file mode 100644 index c32b73ee..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/constructor.js +++ /dev/null @@ -1,5 +0,0 @@ -export function Locale(config) { - if (config != null) { - this.set(config); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/en.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/en.js deleted file mode 100644 index 20964cd9..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/en.js +++ /dev/null @@ -1,15 +0,0 @@ -import './prototype'; -import { getSetGlobalLocale } from './locales'; -import toInt from '../utils/to-int'; - -getSetGlobalLocale('en', { - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/formats.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/formats.js deleted file mode 100644 index 6d83b039..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/formats.js +++ /dev/null @@ -1,23 +0,0 @@ -export var defaultLongDateFormat = { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' -}; - -export function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - - return this._longDateFormat[key]; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/invalid.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/invalid.js deleted file mode 100644 index e9096339..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/invalid.js +++ /dev/null @@ -1,5 +0,0 @@ -export var defaultInvalidDate = 'Invalid date'; - -export function invalidDate () { - return this._invalidDate; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/lists.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/lists.js deleted file mode 100644 index 4fced6ec..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/lists.js +++ /dev/null @@ -1,92 +0,0 @@ -import { getLocale } from './locales'; -import { createUTC } from '../create/utc'; - -function get (format, index, field, setter) { - var locale = getLocale(); - var utc = createUTC().set(setter, index); - return locale[field](utc, format); -} - -function listMonthsImpl (format, index, field) { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return get(format, index, field, 'month'); - } - - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = get(format, i, field, 'month'); - } - return out; -} - -// () -// (5) -// (fmt, 5) -// (fmt) -// (true) -// (true, 5) -// (true, fmt, 5) -// (true, fmt) -function listWeekdaysImpl (localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } - - var locale = getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return get(format, (index + shift) % 7, field, 'day'); - } - - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = get(format, (i + shift) % 7, field, 'day'); - } - return out; -} - -export function listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); -} - -export function listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); -} - -export function listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); -} - -export function listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); -} - -export function listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locale.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locale.js deleted file mode 100644 index ac9cebfb..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locale.js +++ /dev/null @@ -1,39 +0,0 @@ -// Side effect imports -import './prototype'; - -import { - getSetGlobalLocale, - defineLocale, - updateLocale, - getLocale, - listLocales -} from './locales'; - -import { - listMonths, - listMonthsShort, - listWeekdays, - listWeekdaysShort, - listWeekdaysMin -} from './lists'; - -export { - getSetGlobalLocale, - defineLocale, - updateLocale, - getLocale, - listLocales, - listMonths, - listMonthsShort, - listWeekdays, - listWeekdaysShort, - listWeekdaysMin -}; - -import { deprecate } from '../utils/deprecate'; -import { hooks } from '../utils/hooks'; - -hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); -hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); - -import './en'; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locales.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locales.js deleted file mode 100644 index 9cf6ef4f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/locales.js +++ /dev/null @@ -1,164 +0,0 @@ -import isArray from '../utils/is-array'; -import isUndefined from '../utils/is-undefined'; -import compareArrays from '../utils/compare-arrays'; -import { deprecateSimple } from '../utils/deprecate'; -import { mergeConfigs } from './set'; -import { Locale } from './constructor'; -import keys from '../utils/keys'; - -// internal storage for locale config files -var locales = {}; -var globalLocale; - -function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; -} - -// pick the locale from the array -// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each -// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root -function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; -} - -function loadLocale(name) { - var oldLocale = null; - // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && (typeof module !== 'undefined') && - module && module.exports) { - try { - oldLocale = globalLocale._abbr; - require('./locale/' + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; -} - -// This function will load locale and then set the global locale. If -// no arguments are passed in, it will simply return the current global -// locale key. -export function getSetGlobalLocale (key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = getLocale(key); - } - else { - data = defineLocale(key, values); - } - - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } - - return globalLocale._abbr; -} - -export function defineLocale (name, config) { - if (config !== null) { - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale'); - config = mergeConfigs(locales[name]._config, config); - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - config = mergeConfigs(locales[config.parentLocale]._config, config); - } else { - // treat as if there is no base config - deprecateSimple('parentLocaleUndefined', - 'specified parentLocale is not defined yet'); - } - } - locales[name] = new Locale(config); - - // backwards compat for now: also set the locale - getSetGlobalLocale(name); - - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } -} - -export function updateLocale(name, config) { - if (config != null) { - var locale; - if (locales[name] != null) { - config = mergeConfigs(locales[name]._config, config); - } - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; - - // backwards compat for now: also set the locale - getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } - } - } - return locales[name]; -} - -// returns locale data -export function getLocale (key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } - - return chooseLocale(key); -} - -export function listLocales() { - return keys(locales); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/ordinal.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/ordinal.js deleted file mode 100644 index 0028aca0..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/ordinal.js +++ /dev/null @@ -1,7 +0,0 @@ -export var defaultOrdinal = '%d'; -export var defaultOrdinalParse = /\d{1,2}/; - -export function ordinal (number) { - return this._ordinal.replace('%d', number); -} - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/pre-post-format.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/pre-post-format.js deleted file mode 100644 index 10ed2058..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/pre-post-format.js +++ /dev/null @@ -1,3 +0,0 @@ -export function preParsePostFormat (string) { - return string; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/prototype.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/prototype.js deleted file mode 100644 index fd134586..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/prototype.js +++ /dev/null @@ -1,87 +0,0 @@ -import { Locale } from './constructor'; - -var proto = Locale.prototype; - -import { defaultCalendar, calendar } from './calendar'; -import { defaultLongDateFormat, longDateFormat } from './formats'; -import { defaultInvalidDate, invalidDate } from './invalid'; -import { defaultOrdinal, ordinal, defaultOrdinalParse } from './ordinal'; -import { preParsePostFormat } from './pre-post-format'; -import { defaultRelativeTime, relativeTime, pastFuture } from './relative'; -import { set } from './set'; - -proto._calendar = defaultCalendar; -proto.calendar = calendar; -proto._longDateFormat = defaultLongDateFormat; -proto.longDateFormat = longDateFormat; -proto._invalidDate = defaultInvalidDate; -proto.invalidDate = invalidDate; -proto._ordinal = defaultOrdinal; -proto.ordinal = ordinal; -proto._ordinalParse = defaultOrdinalParse; -proto.preparse = preParsePostFormat; -proto.postformat = preParsePostFormat; -proto._relativeTime = defaultRelativeTime; -proto.relativeTime = relativeTime; -proto.pastFuture = pastFuture; -proto.set = set; - -// Month -import { - localeMonthsParse, - defaultLocaleMonths, localeMonths, - defaultLocaleMonthsShort, localeMonthsShort, - defaultMonthsRegex, monthsRegex, - defaultMonthsShortRegex, monthsShortRegex -} from '../units/month'; - -proto.months = localeMonths; -proto._months = defaultLocaleMonths; -proto.monthsShort = localeMonthsShort; -proto._monthsShort = defaultLocaleMonthsShort; -proto.monthsParse = localeMonthsParse; -proto._monthsRegex = defaultMonthsRegex; -proto.monthsRegex = monthsRegex; -proto._monthsShortRegex = defaultMonthsShortRegex; -proto.monthsShortRegex = monthsShortRegex; - -// Week -import { localeWeek, defaultLocaleWeek, localeFirstDayOfYear, localeFirstDayOfWeek } from '../units/week'; -proto.week = localeWeek; -proto._week = defaultLocaleWeek; -proto.firstDayOfYear = localeFirstDayOfYear; -proto.firstDayOfWeek = localeFirstDayOfWeek; - -// Day of Week -import { - localeWeekdaysParse, - defaultLocaleWeekdays, localeWeekdays, - defaultLocaleWeekdaysMin, localeWeekdaysMin, - defaultLocaleWeekdaysShort, localeWeekdaysShort, - - defaultWeekdaysRegex, weekdaysRegex, - defaultWeekdaysShortRegex, weekdaysShortRegex, - defaultWeekdaysMinRegex, weekdaysMinRegex -} from '../units/day-of-week'; - -proto.weekdays = localeWeekdays; -proto._weekdays = defaultLocaleWeekdays; -proto.weekdaysMin = localeWeekdaysMin; -proto._weekdaysMin = defaultLocaleWeekdaysMin; -proto.weekdaysShort = localeWeekdaysShort; -proto._weekdaysShort = defaultLocaleWeekdaysShort; -proto.weekdaysParse = localeWeekdaysParse; - -proto._weekdaysRegex = defaultWeekdaysRegex; -proto.weekdaysRegex = weekdaysRegex; -proto._weekdaysShortRegex = defaultWeekdaysShortRegex; -proto.weekdaysShortRegex = weekdaysShortRegex; -proto._weekdaysMinRegex = defaultWeekdaysMinRegex; -proto.weekdaysMinRegex = weekdaysMinRegex; - -// Hours -import { localeIsPM, defaultLocaleMeridiemParse, localeMeridiem } from '../units/hour'; - -proto.isPM = localeIsPM; -proto._meridiemParse = defaultLocaleMeridiemParse; -proto.meridiem = localeMeridiem; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/relative.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/relative.js deleted file mode 100644 index 4c485ea2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/relative.js +++ /dev/null @@ -1,29 +0,0 @@ -export var defaultRelativeTime = { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' -}; - -import isFunction from '../utils/is-function'; - -export function relativeTime (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (isFunction(output)) ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); -} - -export function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/set.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/set.js deleted file mode 100644 index 1fd13890..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/locale/set.js +++ /dev/null @@ -1,38 +0,0 @@ -import isFunction from '../utils/is-function'; -import extend from '../utils/extend'; -import isObject from '../utils/is-object'; -import hasOwnProp from '../utils/has-own-prop'; - -export function set (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _ordinalParseLenient. - this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); -} - -export function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - return res; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/add-subtract.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/add-subtract.js deleted file mode 100644 index 588153bb..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/add-subtract.js +++ /dev/null @@ -1,54 +0,0 @@ -import { get, set } from './get-set'; -import { setMonth } from '../units/month'; -import { createDuration } from '../duration/create'; -import { deprecateSimple } from '../utils/deprecate'; -import { hooks } from '../utils/hooks'; -import absRound from '../utils/abs-round'; - - -// TODO: remove 'name' arg after deprecation is removed -function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); - tmp = val; val = period; period = tmp; - } - - val = typeof val === 'string' ? +val : val; - dur = createDuration(val, period); - addSubtract(this, dur, direction); - return this; - }; -} - -export function addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - updateOffset = updateOffset == null ? true : updateOffset; - - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - set(mom, 'Date', get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - hooks.updateOffset(mom, days || months); - } -} - -export var add = createAdder(1, 'add'); -export var subtract = createAdder(-1, 'subtract'); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/calendar.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/calendar.js deleted file mode 100644 index bc5092ca..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/calendar.js +++ /dev/null @@ -1,21 +0,0 @@ -import { createLocal } from '../create/local'; -import { cloneWithOffset } from '../units/offset'; -import isFunction from '../utils/is-function'; - -export function calendar (time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - diff = this.diff(sod, 'days', true), - format = diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - - var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]); - - return this.format(output || this.localeData().calendar(format, this, createLocal(now))); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/clone.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/clone.js deleted file mode 100644 index d96b328b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/clone.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Moment } from './constructor'; - -export function clone () { - return new Moment(this); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/compare.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/compare.js deleted file mode 100644 index b26bac63..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/compare.js +++ /dev/null @@ -1,59 +0,0 @@ -import { isMoment } from './constructor'; -import { normalizeUnits } from '../units/aliases'; -import { createLocal } from '../create/local'; -import isUndefined from '../utils/is-undefined'; - -export function isAfter (input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } -} - -export function isBefore (input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } -} - -export function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); -} - -export function isSame (input, units) { - var localInput = isMoment(input) ? input : createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units || 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } -} - -export function isSameOrAfter (input, units) { - return this.isSame(input, units) || this.isAfter(input,units); -} - -export function isSameOrBefore (input, units) { - return this.isSame(input, units) || this.isBefore(input,units); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/constructor.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/constructor.js deleted file mode 100644 index 964c0aef..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/constructor.js +++ /dev/null @@ -1,74 +0,0 @@ -import { hooks } from '../utils/hooks'; -import hasOwnProp from '../utils/has-own-prop'; -import isUndefined from '../utils/is-undefined'; -import getParsingFlags from '../create/parsing-flags'; - -// Plugins that add properties should also add the key here (null value), -// so we can properly clone ourselves. -var momentProperties = hooks.momentProperties = []; - -export function copyConfig(to, from) { - var i, prop, val; - - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; - } - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - if (!isUndefined(from._offset)) { - to._offset = from._offset; - } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); - } - if (!isUndefined(from._locale)) { - to._locale = from._locale; - } - - if (momentProperties.length > 0) { - for (i in momentProperties) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; -} - -var updateInProgress = false; - -// Moment prototype object -export function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - hooks.updateOffset(this); - updateInProgress = false; - } -} - -export function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/creation-data.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/creation-data.js deleted file mode 100644 index 7e2d69aa..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/creation-data.js +++ /dev/null @@ -1,9 +0,0 @@ -export function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/diff.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/diff.js deleted file mode 100644 index 9f439081..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/diff.js +++ /dev/null @@ -1,62 +0,0 @@ -import absFloor from '../utils/abs-floor'; -import { cloneWithOffset } from '../units/offset'; -import { normalizeUnits } from '../units/aliases'; - -export function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); - - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - return asFloat ? output : absFloor(output); -} - -function monthDiff (a, b) { - // difference in months - var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); - } - - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/format.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/format.js deleted file mode 100644 index c7150e4f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/format.js +++ /dev/null @@ -1,32 +0,0 @@ -import { formatMoment } from '../format/format'; -import { hooks } from '../utils/hooks'; -import isFunction from '../utils/is-function'; - -hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; -hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - -export function toString () { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); -} - -export function toISOString () { - var m = this.clone().utc(); - if (0 < m.year() && m.year() <= 9999) { - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } else { - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } else { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } -} - -export function format (inputString) { - if (!inputString) { - inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; - } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/from.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/from.js deleted file mode 100644 index a1b25119..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/from.js +++ /dev/null @@ -1,17 +0,0 @@ -import { createDuration } from '../duration/create'; -import { createLocal } from '../create/local'; -import { isMoment } from 'constructor'; - -export function from (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - createLocal(time).isValid())) { - return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } -} - -export function fromNow (withoutSuffix) { - return this.from(createLocal(), withoutSuffix); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/get-set.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/get-set.js deleted file mode 100644 index ef43f391..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/get-set.js +++ /dev/null @@ -1,43 +0,0 @@ -import { normalizeUnits } from '../units/aliases'; -import { hooks } from '../utils/hooks'; -import isFunction from '../utils/is-function'; - -export function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - set(this, unit, value); - hooks.updateOffset(this, keepTime); - return this; - } else { - return get(this, unit); - } - }; -} - -export function get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; -} - -export function set (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } -} - -// MOMENTS - -export function getSet (units, value) { - var unit; - if (typeof units === 'object') { - for (unit in units) { - this.set(unit, units[unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/locale.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/locale.js deleted file mode 100644 index fb46e656..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/locale.js +++ /dev/null @@ -1,34 +0,0 @@ -import { getLocale } from '../locale/locales'; -import { deprecate } from '../utils/deprecate'; - -// If passed a locale key, it will set the locale for this -// instance. Otherwise, it will return the locale configuration -// variables for this instance. -export function locale (key) { - var newLocaleData; - - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } -} - -export var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } -); - -export function localeData () { - return this._locale; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/min-max.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/min-max.js deleted file mode 100644 index aad6f6f3..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/min-max.js +++ /dev/null @@ -1,63 +0,0 @@ -import { deprecate } from '../utils/deprecate'; -import isArray from '../utils/is-array'; -import { createLocal } from '../create/local'; -import { createInvalid } from '../create/valid'; - -export var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548', - function () { - var other = createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return createInvalid(); - } - } - ); - -export var prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548', - function () { - var other = createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return createInvalid(); - } - } -); - -// Pick a moment m from moments so that m[fn](other) is true for all -// other. This relies on the function fn to be transitive. -// -// moments should either be an array of moment objects or an array, whose -// first element is an array of moment objects. -function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return createLocal(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - return res; -} - -// TODO: Use [].sort instead? -export function min () { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); -} - -export function max () { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/moment.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/moment.js deleted file mode 100644 index 12eb5f15..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/moment.js +++ /dev/null @@ -1,28 +0,0 @@ -import { createLocal } from '../create/local'; -import { createUTC } from '../create/utc'; -import { createInvalid } from '../create/valid'; -import { isMoment } from './constructor'; -import { min, max } from './min-max'; -import { now } from './now'; -import momentPrototype from './prototype'; - -function createUnix (input) { - return createLocal(input * 1000); -} - -function createInZone () { - return createLocal.apply(null, arguments).parseZone(); -} - -export { - now, - min, - max, - isMoment, - createUTC, - createUnix, - createLocal, - createInZone, - createInvalid, - momentPrototype -}; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/now.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/now.js deleted file mode 100644 index 0f4d0aef..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/now.js +++ /dev/null @@ -1,3 +0,0 @@ -export var now = function () { - return Date.now ? Date.now() : +(new Date()); -}; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/prototype.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/prototype.js deleted file mode 100644 index 39775880..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/prototype.js +++ /dev/null @@ -1,149 +0,0 @@ -import { Moment } from './constructor'; - -var proto = Moment.prototype; - -import { add, subtract } from './add-subtract'; -import { calendar } from './calendar'; -import { clone } from './clone'; -import { isBefore, isBetween, isSame, isAfter, isSameOrAfter, isSameOrBefore } from './compare'; -import { diff } from './diff'; -import { format, toString, toISOString } from './format'; -import { from, fromNow } from './from'; -import { to, toNow } from './to'; -import { getSet } from './get-set'; -import { locale, localeData, lang } from './locale'; -import { prototypeMin, prototypeMax } from './min-max'; -import { startOf, endOf } from './start-end-of'; -import { valueOf, toDate, toArray, toObject, toJSON, unix } from './to-type'; -import { isValid, parsingFlags, invalidAt } from './valid'; -import { creationData } from './creation-data'; - -proto.add = add; -proto.calendar = calendar; -proto.clone = clone; -proto.diff = diff; -proto.endOf = endOf; -proto.format = format; -proto.from = from; -proto.fromNow = fromNow; -proto.to = to; -proto.toNow = toNow; -proto.get = getSet; -proto.invalidAt = invalidAt; -proto.isAfter = isAfter; -proto.isBefore = isBefore; -proto.isBetween = isBetween; -proto.isSame = isSame; -proto.isSameOrAfter = isSameOrAfter; -proto.isSameOrBefore = isSameOrBefore; -proto.isValid = isValid; -proto.lang = lang; -proto.locale = locale; -proto.localeData = localeData; -proto.max = prototypeMax; -proto.min = prototypeMin; -proto.parsingFlags = parsingFlags; -proto.set = getSet; -proto.startOf = startOf; -proto.subtract = subtract; -proto.toArray = toArray; -proto.toObject = toObject; -proto.toDate = toDate; -proto.toISOString = toISOString; -proto.toJSON = toJSON; -proto.toString = toString; -proto.unix = unix; -proto.valueOf = valueOf; -proto.creationData = creationData; - -// Year -import { getSetYear, getIsLeapYear } from '../units/year'; -proto.year = getSetYear; -proto.isLeapYear = getIsLeapYear; - -// Week Year -import { getSetWeekYear, getSetISOWeekYear, getWeeksInYear, getISOWeeksInYear } from '../units/week-year'; -proto.weekYear = getSetWeekYear; -proto.isoWeekYear = getSetISOWeekYear; - -// Quarter -import { getSetQuarter } from '../units/quarter'; -proto.quarter = proto.quarters = getSetQuarter; - -// Month -import { getSetMonth, getDaysInMonth } from '../units/month'; -proto.month = getSetMonth; -proto.daysInMonth = getDaysInMonth; - -// Week -import { getSetWeek, getSetISOWeek } from '../units/week'; -proto.week = proto.weeks = getSetWeek; -proto.isoWeek = proto.isoWeeks = getSetISOWeek; -proto.weeksInYear = getWeeksInYear; -proto.isoWeeksInYear = getISOWeeksInYear; - -// Day -import { getSetDayOfMonth } from '../units/day-of-month'; -import { getSetDayOfWeek, getSetISODayOfWeek, getSetLocaleDayOfWeek } from '../units/day-of-week'; -import { getSetDayOfYear } from '../units/day-of-year'; -proto.date = getSetDayOfMonth; -proto.day = proto.days = getSetDayOfWeek; -proto.weekday = getSetLocaleDayOfWeek; -proto.isoWeekday = getSetISODayOfWeek; -proto.dayOfYear = getSetDayOfYear; - -// Hour -import { getSetHour } from '../units/hour'; -proto.hour = proto.hours = getSetHour; - -// Minute -import { getSetMinute } from '../units/minute'; -proto.minute = proto.minutes = getSetMinute; - -// Second -import { getSetSecond } from '../units/second'; -proto.second = proto.seconds = getSetSecond; - -// Millisecond -import { getSetMillisecond } from '../units/millisecond'; -proto.millisecond = proto.milliseconds = getSetMillisecond; - -// Offset -import { - getSetOffset, - setOffsetToUTC, - setOffsetToLocal, - setOffsetToParsedOffset, - hasAlignedHourOffset, - isDaylightSavingTime, - isDaylightSavingTimeShifted, - getSetZone, - isLocal, - isUtcOffset, - isUtc -} from '../units/offset'; -proto.utcOffset = getSetOffset; -proto.utc = setOffsetToUTC; -proto.local = setOffsetToLocal; -proto.parseZone = setOffsetToParsedOffset; -proto.hasAlignedHourOffset = hasAlignedHourOffset; -proto.isDST = isDaylightSavingTime; -proto.isDSTShifted = isDaylightSavingTimeShifted; -proto.isLocal = isLocal; -proto.isUtcOffset = isUtcOffset; -proto.isUtc = isUtc; -proto.isUTC = isUtc; - -// Timezone -import { getZoneAbbr, getZoneName } from '../units/timezone'; -proto.zoneAbbr = getZoneAbbr; -proto.zoneName = getZoneName; - -// Deprecations -import { deprecate } from '../utils/deprecate'; -proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); -proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); -proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); -proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone); - -export default proto; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/start-end-of.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/start-end-of.js deleted file mode 100644 index c8a68ac6..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/start-end-of.js +++ /dev/null @@ -1,59 +0,0 @@ -import { normalizeUnits } from '../units/aliases'; - -export function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; -} - -export function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } - - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; - } - - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to-type.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to-type.js deleted file mode 100644 index 584348da..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to-type.js +++ /dev/null @@ -1,34 +0,0 @@ -export function valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); -} - -export function unix () { - return Math.floor(this.valueOf() / 1000); -} - -export function toDate () { - return this._offset ? new Date(this.valueOf()) : this._d; -} - -export function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; -} - -export function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; -} - -export function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to.js deleted file mode 100644 index fd9c93d5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/to.js +++ /dev/null @@ -1,17 +0,0 @@ -import { createDuration } from '../duration/create'; -import { createLocal } from '../create/local'; -import { isMoment } from 'constructor'; - -export function to (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - createLocal(time).isValid())) { - return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } -} - -export function toNow (withoutSuffix) { - return this.to(createLocal(), withoutSuffix); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/valid.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/valid.js deleted file mode 100644 index 6c007429..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/moment/valid.js +++ /dev/null @@ -1,15 +0,0 @@ -import { isValid as _isValid } from '../create/valid'; -import extend from '../utils/extend'; -import getParsingFlags from '../create/parsing-flags'; - -export function isValid () { - return _isValid(this); -} - -export function parsingFlags () { - return extend({}, getParsingFlags(this)); -} - -export function invalidAt () { - return getParsingFlags(this).overflow; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/regex.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/regex.js deleted file mode 100644 index b1dc7529..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/regex.js +++ /dev/null @@ -1,54 +0,0 @@ -export var match1 = /\d/; // 0 - 9 -export var match2 = /\d\d/; // 00 - 99 -export var match3 = /\d{3}/; // 000 - 999 -export var match4 = /\d{4}/; // 0000 - 9999 -export var match6 = /[+-]?\d{6}/; // -999999 - 999999 -export var match1to2 = /\d\d?/; // 0 - 99 -export var match3to4 = /\d\d\d\d?/; // 999 - 9999 -export var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 -export var match1to3 = /\d{1,3}/; // 0 - 999 -export var match1to4 = /\d{1,4}/; // 0 - 9999 -export var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - -export var matchUnsigned = /\d+/; // 0 - inf -export var matchSigned = /[+-]?\d+/; // -inf - inf - -export var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z -export var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - -export var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 - -// any word (or two) characters or numbers including two/three word month in arabic. -// includes scottish gaelic two word and hyphenated months -export var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; - - -import hasOwnProp from '../utils/has-own-prop'; -import isFunction from '../utils/is-function'; - -var regexes = {}; - -export function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; -} - -export function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } - - return regexes[token](config._strict, config._locale); -} - -// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript -function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); -} - -export function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/token.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/token.js deleted file mode 100644 index 781b9cf3..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/parse/token.js +++ /dev/null @@ -1,32 +0,0 @@ -import hasOwnProp from '../utils/has-own-prop'; -import toInt from '../utils/to-int'; - -var tokens = {}; - -export function addParseToken (token, callback) { - var i, func = callback; - if (typeof token === 'string') { - token = [token]; - } - if (typeof callback === 'number') { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } -} - -export function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); -} - -export function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/aliases.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/aliases.js deleted file mode 100644 index 4ad51338..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/aliases.js +++ /dev/null @@ -1,29 +0,0 @@ -import hasOwnProp from '../utils/has-own-prop'; - -var aliases = {}; - -export function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; -} - -export function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; -} - -export function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/constants.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/constants.js deleted file mode 100644 index 70bf1b26..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/constants.js +++ /dev/null @@ -1,9 +0,0 @@ -export var YEAR = 0; -export var MONTH = 1; -export var DATE = 2; -export var HOUR = 3; -export var MINUTE = 4; -export var SECOND = 5; -export var MILLISECOND = 6; -export var WEEK = 7; -export var WEEKDAY = 8; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-month.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-month.js deleted file mode 100644 index dc32acc2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-month.js +++ /dev/null @@ -1,32 +0,0 @@ -import { makeGetSet } from '../moment/get-set'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match2 } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { DATE } from './constants'; -import toInt from '../utils/to-int'; - -// FORMATTING - -addFormatToken('D', ['DD', 2], 'Do', 'date'); - -// ALIASES - -addUnitAlias('date', 'D'); - -// PARSING - -addRegexToken('D', match1to2); -addRegexToken('DD', match1to2, match2); -addRegexToken('Do', function (isStrict, locale) { - return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; -}); - -addParseToken(['D', 'DD'], DATE); -addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); -}); - -// MOMENTS - -export var getSetDayOfMonth = makeGetSet('Date', true); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-week.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-week.js deleted file mode 100644 index 18e2a42b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-week.js +++ /dev/null @@ -1,331 +0,0 @@ -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, matchWord, regexEscape } from '../parse/regex'; -import { addWeekParseToken } from '../parse/token'; -import toInt from '../utils/to-int'; -import isArray from '../utils/is-array'; -import indexOf from '../utils/index-of'; -import hasOwnProp from '../utils/has-own-prop'; -import { createUTC } from '../create/utc'; -import getParsingFlags from '../create/parsing-flags'; - -// FORMATTING - -addFormatToken('d', 0, 'do', 'day'); - -addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); -}); - -addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); -}); - -addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); -}); - -addFormatToken('e', 0, 0, 'weekday'); -addFormatToken('E', 0, 0, 'isoWeekday'); - -// ALIASES - -addUnitAlias('day', 'd'); -addUnitAlias('weekday', 'e'); -addUnitAlias('isoWeekday', 'E'); - -// PARSING - -addRegexToken('d', match1to2); -addRegexToken('e', match1to2); -addRegexToken('E', match1to2); -addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); -}); -addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); -}); -addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); -}); - -addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } -}); - -addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); -}); - -// HELPERS - -function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } - - return null; -} - -// LOCALES - -export var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); -export function localeWeekdays (m, format) { - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; -} - -export var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); -export function localeWeekdaysShort (m) { - return this._weekdaysShort[m.day()]; -} - -export var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); -export function localeWeekdaysMin (m) { - return this._weekdaysMin[m.day()]; -} - -function handleStrictParse(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; - - for (i = 0; i < 7; ++i) { - mom = createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } -} - -export function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return handleStrictParse.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - - mom = createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); - } - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } -} - -// MOMENTS - -export function getSetDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } -} - -export function getSetLocaleDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); -} - -export function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); -} - -export var defaultWeekdaysRegex = matchWord; -export function weekdaysRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - return this._weekdaysStrictRegex && isStrict ? - this._weekdaysStrictRegex : this._weekdaysRegex; - } -} - -export var defaultWeekdaysShortRegex = matchWord; -export function weekdaysShortRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - return this._weekdaysShortStrictRegex && isStrict ? - this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } -} - -export var defaultWeekdaysMinRegex = matchWord; -export function weekdaysMinRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - return this._weekdaysMinStrictRegex && isStrict ? - this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } -} - - -function computeWeekdaysParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], - i, mom, minp, shortp, longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-year.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-year.js deleted file mode 100644 index 62d4de8b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/day-of-year.js +++ /dev/null @@ -1,32 +0,0 @@ -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match3, match1to3 } from '../parse/regex'; -import { daysInYear } from './year'; -import { createUTCDate } from '../create/date-from-array'; -import { addParseToken } from '../parse/token'; -import toInt from '../utils/to-int'; - -// FORMATTING - -addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - -// ALIASES - -addUnitAlias('dayOfYear', 'DDD'); - -// PARSING - -addRegexToken('DDD', match1to3); -addRegexToken('DDDD', match3); -addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); -}); - -// HELPERS - -// MOMENTS - -export function getSetDayOfYear (input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/hour.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/hour.js deleted file mode 100644 index 86f18abe..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/hour.js +++ /dev/null @@ -1,134 +0,0 @@ -import { makeGetSet } from '../moment/get-set'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match2, match3to4, match5to6 } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { HOUR, MINUTE, SECOND } from './constants'; -import toInt from '../utils/to-int'; -import zeroFill from '../utils/zero-fill'; -import getParsingFlags from '../create/parsing-flags'; - -// FORMATTING - -function hFormat() { - return this.hours() % 12 || 12; -} - -function kFormat() { - return this.hours() || 24; -} - -addFormatToken('H', ['HH', 2], 0, 'hour'); -addFormatToken('h', ['hh', 2], 0, hFormat); -addFormatToken('k', ['kk', 2], 0, kFormat); - -addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); -}); - -addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); -}); - -addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); -}); - -addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); -}); - -function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); -} - -meridiem('a', true); -meridiem('A', false); - -// ALIASES - -addUnitAlias('hour', 'h'); - -// PARSING - -function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; -} - -addRegexToken('a', matchMeridiem); -addRegexToken('A', matchMeridiem); -addRegexToken('H', match1to2); -addRegexToken('h', match1to2); -addRegexToken('HH', match1to2, match2); -addRegexToken('hh', match1to2, match2); - -addRegexToken('hmm', match3to4); -addRegexToken('hmmss', match5to6); -addRegexToken('Hmm', match3to4); -addRegexToken('Hmmss', match5to6); - -addParseToken(['H', 'HH'], HOUR); -addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; -}); -addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; -}); -addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; -}); -addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; -}); -addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); -}); -addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); -}); - -// LOCALES - -export function localeIsPM (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); -} - -export var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; -export function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } -} - - -// MOMENTS - -// Setting the hour should keep the time, because the user explicitly -// specified which hour he wants. So trying to maintain the same hour (in -// a new timezone) makes sense. Adding/subtracting hours does not follow -// this rule. -export var getSetHour = makeGetSet('Hours', true); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/millisecond.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/millisecond.js deleted file mode 100644 index 134d88ee..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/millisecond.js +++ /dev/null @@ -1,64 +0,0 @@ -import { makeGetSet } from '../moment/get-set'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1, match2, match3, match1to3, matchUnsigned } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { MILLISECOND } from './constants'; -import toInt from '../utils/to-int'; - -// FORMATTING - -addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); -}); - -addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); -}); - -addFormatToken(0, ['SSS', 3], 0, 'millisecond'); -addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; -}); -addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; -}); -addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; -}); -addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; -}); -addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; -}); -addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; -}); - - -// ALIASES - -addUnitAlias('millisecond', 'ms'); - -// PARSING - -addRegexToken('S', match1to3, match1); -addRegexToken('SS', match1to3, match2); -addRegexToken('SSS', match1to3, match3); - -var token; -for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); -} - -function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); -} - -for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); -} -// MOMENTS - -export var getSetMillisecond = makeGetSet('Milliseconds', false); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/minute.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/minute.js deleted file mode 100644 index e9473b86..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/minute.js +++ /dev/null @@ -1,24 +0,0 @@ -import { makeGetSet } from '../moment/get-set'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match2 } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { MINUTE } from './constants'; - -// FORMATTING - -addFormatToken('m', ['mm', 2], 0, 'minute'); - -// ALIASES - -addUnitAlias('minute', 'm'); - -// PARSING - -addRegexToken('m', match1to2); -addRegexToken('mm', match1to2, match2); -addParseToken(['m', 'mm'], MINUTE); - -// MOMENTS - -export var getSetMinute = makeGetSet('Minutes', false); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/month.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/month.js deleted file mode 100644 index f1cef155..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/month.js +++ /dev/null @@ -1,261 +0,0 @@ -import { get } from '../moment/get-set'; -import hasOwnProp from '../utils/has-own-prop'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match2, matchWord, regexEscape } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { hooks } from '../utils/hooks'; -import { MONTH } from './constants'; -import toInt from '../utils/to-int'; -import isArray from '../utils/is-array'; -import indexOf from '../utils/index-of'; -import { createUTC } from '../create/utc'; -import getParsingFlags from '../create/parsing-flags'; - -export function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); -} - -// FORMATTING - -addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; -}); - -addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); -}); - -addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); -}); - -// ALIASES - -addUnitAlias('month', 'M'); - -// PARSING - -addRegexToken('M', match1to2); -addRegexToken('MM', match1to2, match2); -addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); -}); -addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); -}); - -addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; -}); - -addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } -}); - -// LOCALES - -var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; -export var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); -export function localeMonths (m, format) { - return isArray(this._months) ? this._months[m.month()] : - this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; -} - -export var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); -export function localeMonthsShort (m, format) { - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : - this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; -} - -function handleStrictParse(monthName, format, strict) { - var i, ii, mom, llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } -} - -export function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } - - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } -} - -// MOMENTS - -export function setMonth (mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (typeof value !== 'number') { - return mom; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; -} - -export function getSetMonth (value) { - if (value != null) { - setMonth(this, value); - hooks.updateOffset(this, true); - return this; - } else { - return get(this, 'Month'); - } -} - -export function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); -} - -export var defaultMonthsShortRegex = matchWord; -export function monthsShortRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - return this._monthsShortStrictRegex && isStrict ? - this._monthsShortStrictRegex : this._monthsShortRegex; - } -} - -export var defaultMonthsRegex = matchWord; -export function monthsRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - return this._monthsStrictRegex && isStrict ? - this._monthsStrictRegex : this._monthsRegex; - } -} - -function computeMonthsParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var shortPieces = [], longPieces = [], mixedPieces = [], - i, mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/offset.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/offset.js deleted file mode 100644 index 22305d17..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/offset.js +++ /dev/null @@ -1,219 +0,0 @@ -import zeroFill from '../utils/zero-fill'; -import { createDuration } from '../duration/create'; -import { addSubtract } from '../moment/add-subtract'; -import { isMoment, copyConfig } from '../moment/constructor'; -import { addFormatToken } from '../format/format'; -import { addRegexToken, matchOffset, matchShortOffset } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { createLocal } from '../create/local'; -import { prepareConfig } from '../create/from-anything'; -import { createUTC } from '../create/utc'; -import isDate from '../utils/is-date'; -import toInt from '../utils/to-int'; -import isUndefined from '../utils/is-undefined'; -import compareArrays from '../utils/compare-arrays'; -import { hooks } from '../utils/hooks'; - -// FORMATTING - -function offset (token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); - }); -} - -offset('Z', ':'); -offset('ZZ', ''); - -// PARSING - -addRegexToken('Z', matchShortOffset); -addRegexToken('ZZ', matchShortOffset); -addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); -}); - -// HELPERS - -// timezone chunker -// '+10:00' > ['10', '00'] -// '-1530' > ['-15', '30'] -var chunkOffset = /([\+\-]|\d\d)/gi; - -function offsetFromString(matcher, string) { - var matches = ((string || '').match(matcher) || []); - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); - - return parts[0] === '+' ? minutes : -minutes; -} - -// Return a moment from input, that is local/utc/zone equivalent to model. -export function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - hooks.updateOffset(res, false); - return res; - } else { - return createLocal(input).local(); - } -} - -function getDateOffset (m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; -} - -// HOOKS - -// This function will be called whenever a moment is mutated. -// It is intended to keep the offset in sync with the timezone. -hooks.updateOffset = function () {}; - -// MOMENTS - -// keepLocalTime = true means only change the timezone, without -// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> -// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset -// +0200, so we adjust the time as needed, to be valid. -// -// Keeping the time actually adds/subtracts (one hour) -// from the actual represented time. That is why we call updateOffset -// a second time. In case it wants us to change the offset again -// _changeInProgress == true case, then we have to adjust, because -// there is no such time in the given timezone. -export function getSetOffset (input, keepLocalTime) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - } else if (Math.abs(input) < 16) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - addSubtract(this, createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } -} - -export function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } -} - -export function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); -} - -export function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; - - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; -} - -export function setOffsetToParsedOffset () { - if (this._tzm) { - this.utcOffset(this._tzm); - } else if (typeof this._i === 'string') { - this.utcOffset(offsetFromString(matchOffset, this._i)); - } - return this; -} - -export function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? createLocal(input).utcOffset() : 0; - - return (this.utcOffset() - input) % 60 === 0; -} - -export function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); -} - -export function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}; - - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; -} - -export function isLocal () { - return this.isValid() ? !this._isUTC : false; -} - -export function isUtcOffset () { - return this.isValid() ? this._isUTC : false; -} - -export function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/quarter.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/quarter.js deleted file mode 100644 index 78543a68..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/quarter.js +++ /dev/null @@ -1,27 +0,0 @@ -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1 } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { MONTH } from './constants'; -import toInt from '../utils/to-int'; - -// FORMATTING - -addFormatToken('Q', 0, 'Qo', 'quarter'); - -// ALIASES - -addUnitAlias('quarter', 'Q'); - -// PARSING - -addRegexToken('Q', match1); -addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; -}); - -// MOMENTS - -export function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/second.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/second.js deleted file mode 100644 index 118fe308..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/second.js +++ /dev/null @@ -1,24 +0,0 @@ -import { makeGetSet } from '../moment/get-set'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match2 } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { SECOND } from './constants'; - -// FORMATTING - -addFormatToken('s', ['ss', 2], 0, 'second'); - -// ALIASES - -addUnitAlias('second', 's'); - -// PARSING - -addRegexToken('s', match1to2); -addRegexToken('ss', match1to2, match2); -addParseToken(['s', 'ss'], SECOND); - -// MOMENTS - -export var getSetSecond = makeGetSet('Seconds', false); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timestamp.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timestamp.js deleted file mode 100644 index a49e1e4b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timestamp.js +++ /dev/null @@ -1,20 +0,0 @@ -import { addFormatToken } from '../format/format'; -import { addRegexToken, matchTimestamp, matchSigned } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import toInt from '../utils/to-int'; - -// FORMATTING - -addFormatToken('X', 0, 0, 'unix'); -addFormatToken('x', 0, 0, 'valueOf'); - -// PARSING - -addRegexToken('x', matchSigned); -addRegexToken('X', matchTimestamp); -addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); -}); -addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timezone.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timezone.js deleted file mode 100644 index 20c81cd2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/timezone.js +++ /dev/null @@ -1,16 +0,0 @@ -import { addFormatToken } from '../format/format'; - -// FORMATTING - -addFormatToken('z', 0, 0, 'zoneAbbr'); -addFormatToken('zz', 0, 0, 'zoneName'); - -// MOMENTS - -export function getZoneAbbr () { - return this._isUTC ? 'UTC' : ''; -} - -export function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/units.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/units.js deleted file mode 100644 index 6f45f1c0..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/units.js +++ /dev/null @@ -1,20 +0,0 @@ -// Side effect imports -import './day-of-month'; -import './day-of-week'; -import './day-of-year'; -import './hour'; -import './millisecond'; -import './minute'; -import './month'; -import './offset'; -import './quarter'; -import './second'; -import './timestamp'; -import './timezone'; -import './week-year'; -import './week'; -import './year'; - -import { normalizeUnits } from './aliases'; - -export { normalizeUnits }; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-calendar-utils.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-calendar-utils.js deleted file mode 100644 index b89810c7..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-calendar-utils.js +++ /dev/null @@ -1,65 +0,0 @@ -import { daysInYear } from './year'; -import { createLocal } from '../create/local'; -import { createUTCDate } from '../create/date-from-array'; - -// start-of-first-week - start-of-year -function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - - return -fwdlw + fwd - 1; -} - -//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday -export function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, resDayOfYear; - - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } - - return { - year: resYear, - dayOfYear: resDayOfYear - }; -} - -export function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, resYear; - - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } - - return { - week: resWeek, - year: resYear - }; -} - -export function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-year.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-year.js deleted file mode 100644 index 29d1fec5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week-year.js +++ /dev/null @@ -1,100 +0,0 @@ -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex'; -import { addWeekParseToken } from '../parse/token'; -import { weekOfYear, weeksInYear, dayOfYearFromWeeks } from './week-calendar-utils'; -import toInt from '../utils/to-int'; -import { hooks } from '../utils/hooks'; -import { createLocal } from '../create/local'; -import { createUTCDate } from '../create/date-from-array'; - -// FORMATTING - -addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; -}); - -addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; -}); - -function addWeekYearFormatToken (token, getter) { - addFormatToken(0, [token, token.length], 0, getter); -} - -addWeekYearFormatToken('gggg', 'weekYear'); -addWeekYearFormatToken('ggggg', 'weekYear'); -addWeekYearFormatToken('GGGG', 'isoWeekYear'); -addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - -// ALIASES - -addUnitAlias('weekYear', 'gg'); -addUnitAlias('isoWeekYear', 'GG'); - -// PARSING - -addRegexToken('G', matchSigned); -addRegexToken('g', matchSigned); -addRegexToken('GG', match1to2, match2); -addRegexToken('gg', match1to2, match2); -addRegexToken('GGGG', match1to4, match4); -addRegexToken('gggg', match1to4, match4); -addRegexToken('GGGGG', match1to6, match6); -addRegexToken('ggggg', match1to6, match6); - -addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); -}); - -addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = hooks.parseTwoDigitYear(input); -}); - -// MOMENTS - -export function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); -} - -export function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); -} - -export function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); -} - -export function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); -} - -function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } -} - -function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week.js deleted file mode 100644 index 7ea3201e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/week.js +++ /dev/null @@ -1,61 +0,0 @@ -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match2 } from '../parse/regex'; -import { addWeekParseToken } from '../parse/token'; -import toInt from '../utils/to-int'; -import { createLocal } from '../create/local'; -import { weekOfYear } from './week-calendar-utils'; - -// FORMATTING - -addFormatToken('w', ['ww', 2], 'wo', 'week'); -addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - -// ALIASES - -addUnitAlias('week', 'w'); -addUnitAlias('isoWeek', 'W'); - -// PARSING - -addRegexToken('w', match1to2); -addRegexToken('ww', match1to2, match2); -addRegexToken('W', match1to2); -addRegexToken('WW', match1to2, match2); - -addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); -}); - -// HELPERS - -// LOCALES - -export function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; -} - -export var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. -}; - -export function localeFirstDayOfWeek () { - return this._week.dow; -} - -export function localeFirstDayOfYear () { - return this._week.doy; -} - -// MOMENTS - -export function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); -} - -export function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/year.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/year.js deleted file mode 100644 index b86df29b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/units/year.js +++ /dev/null @@ -1,70 +0,0 @@ -import { makeGetSet } from '../moment/get-set'; -import { addFormatToken } from '../format/format'; -import { addUnitAlias } from './aliases'; -import { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex'; -import { addParseToken } from '../parse/token'; -import { hooks } from '../utils/hooks'; -import { YEAR } from './constants'; -import toInt from '../utils/to-int'; - -// FORMATTING - -addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; -}); - -addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; -}); - -addFormatToken(0, ['YYYY', 4], 0, 'year'); -addFormatToken(0, ['YYYYY', 5], 0, 'year'); -addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - -// ALIASES - -addUnitAlias('year', 'y'); - -// PARSING - -addRegexToken('Y', matchSigned); -addRegexToken('YY', match1to2, match2); -addRegexToken('YYYY', match1to4, match4); -addRegexToken('YYYYY', match1to6, match6); -addRegexToken('YYYYYY', match1to6, match6); - -addParseToken(['YYYYY', 'YYYYYY'], YEAR); -addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); -}); -addParseToken('YY', function (input, array) { - array[YEAR] = hooks.parseTwoDigitYear(input); -}); -addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); -}); - -// HELPERS - -export function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; -} - -function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -} - -// HOOKS - -hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); -}; - -// MOMENTS - -export var getSetYear = makeGetSet('FullYear', true); - -export function getIsLeapYear () { - return isLeapYear(this.year()); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-ceil.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-ceil.js deleted file mode 100644 index 7cf93290..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-ceil.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-floor.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-floor.js deleted file mode 100644 index 8ba13183..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-floor.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function absFloor (number) { - if (number < 0) { - return Math.ceil(number); - } else { - return Math.floor(number); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-round.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-round.js deleted file mode 100644 index 98f54bc6..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/abs-round.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/compare-arrays.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/compare-arrays.js deleted file mode 100644 index 2eb274be..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/compare-arrays.js +++ /dev/null @@ -1,16 +0,0 @@ -import toInt from './to-int'; - -// compare two arrays, return the number of differences -export default function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; - } - } - return diffs + lengthDiff; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/defaults.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/defaults.js deleted file mode 100644 index 45c5e879..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/defaults.js +++ /dev/null @@ -1,10 +0,0 @@ -// Pick the first defined of two or three arguments. -export default function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/deprecate.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/deprecate.js deleted file mode 100644 index 8ed45e5a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/deprecate.js +++ /dev/null @@ -1,40 +0,0 @@ -import extend from './extend'; -import { hooks } from './hooks'; -import isUndefined from './is-undefined'; - -function warn(msg) { - if (hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } -} - -export function deprecate(msg, fn) { - var firstTime = true; - - return extend(function () { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(null, msg); - } - if (firstTime) { - warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); -} - -var deprecations = {}; - -export function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } -} - -hooks.suppressDeprecationWarnings = false; -hooks.deprecationHandler = null; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/extend.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/extend.js deleted file mode 100644 index ba74a0bf..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/extend.js +++ /dev/null @@ -1,19 +0,0 @@ -import hasOwnProp from './has-own-prop'; - -export default function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/has-own-prop.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/has-own-prop.js deleted file mode 100644 index 4d2403cc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/has-own-prop.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/hooks.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/hooks.js deleted file mode 100644 index 02a5bd3d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/hooks.js +++ /dev/null @@ -1,13 +0,0 @@ -export { hooks, setHookCallback }; - -var hookCallback; - -function hooks () { - return hookCallback.apply(null, arguments); -} - -// This is done to register the method called with moment() -// without creating circular dependencies. -function setHookCallback (callback) { - hookCallback = callback; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/index-of.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/index-of.js deleted file mode 100644 index 92298cff..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/index-of.js +++ /dev/null @@ -1,18 +0,0 @@ -var indexOf; - -if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; -} else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; -} - -export { indexOf as default }; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-array.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-array.js deleted file mode 100644 index 2d0e0f3d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-array.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-date.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-date.js deleted file mode 100644 index 69c4d0e9..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-date.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-function.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-function.js deleted file mode 100644 index 12304b1b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-function.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-object.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-object.js deleted file mode 100644 index 6018e12d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-object.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function isObject(input) { - return Object.prototype.toString.call(input) === '[object Object]'; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-undefined.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-undefined.js deleted file mode 100644 index de57a8b2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/is-undefined.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function isUndefined(input) { - return input === void 0; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/keys.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/keys.js deleted file mode 100644 index 2da4e322..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/keys.js +++ /dev/null @@ -1,19 +0,0 @@ -import hasOwnProp from './has-own-prop'; - -var keys; - -if (Object.keys) { - keys = Object.keys; -} else { - keys = function (obj) { - var i, res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; -} - -export { keys as default }; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/map.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/map.js deleted file mode 100644 index 1cbc5639..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/map.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - return res; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/some.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/some.js deleted file mode 100644 index 1bd31867..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/some.js +++ /dev/null @@ -1,19 +0,0 @@ -var some; -if (Array.prototype.some) { - some = Array.prototype.some; -} else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; - - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; -} - -export { some as default }; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/to-int.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/to-int.js deleted file mode 100644 index fb489416..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/to-int.js +++ /dev/null @@ -1,12 +0,0 @@ -import absFloor from './abs-floor'; - -export default function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } - - return value; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/zero-fill.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/zero-fill.js deleted file mode 100644 index 7009ec90..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/lib/utils/zero-fill.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/af.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/af.js deleted file mode 100644 index 13b8d7b1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/af.js +++ /dev/null @@ -1,63 +0,0 @@ -//! moment.js locale configuration -//! locale : afrikaans (af) -//! author : Werner Mollentze : https://github.com/wernerm - -import moment from '../moment'; - -export default moment.defineLocale('af', { - months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'), - weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), - weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), - meridiemParse: /vm|nm/i, - isPM : function (input) { - return /^nm$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'vm' : 'VM'; - } else { - return isLower ? 'nm' : 'NM'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Vandag om] LT', - nextDay : '[Môre om] LT', - nextWeek : 'dddd [om] LT', - lastDay : '[Gister om] LT', - lastWeek : '[Laas] dddd [om] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'oor %s', - past : '%s gelede', - s : '\'n paar sekondes', - m : '\'n minuut', - mm : '%d minute', - h : '\'n uur', - hh : '%d ure', - d : '\'n dag', - dd : '%d dae', - M : '\'n maand', - MM : '%d maande', - y : '\'n jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter - }, - week : { - dow : 1, // Maandag is die eerste dag van die week. - doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-ma.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-ma.js deleted file mode 100644 index efd39b46..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-ma.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Moroccan Arabic (ar-ma) -//! author : ElFadili Yassine : https://github.com/ElFadiliY -//! author : Abdel Said : https://github.com/abdelsaid - -import moment from '../moment'; - -export default moment.defineLocale('ar-ma', { - months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'), - weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-sa.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-sa.js deleted file mode 100644 index 201b264f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-sa.js +++ /dev/null @@ -1,95 +0,0 @@ -//! moment.js locale configuration -//! locale : Arabic Saudi Arabia (ar-sa) -//! author : Suhail Alkowaileet : https://github.com/xsoh - -import moment from '../moment'; - -var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' -}, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' -}; - -export default moment.defineLocale('ar-sa', { - months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'في %s', - past : 'منذ %s', - s : 'ثوان', - m : 'دقيقة', - mm : '%d دقائق', - h : 'ساعة', - hh : '%d ساعات', - d : 'يوم', - dd : '%d أيام', - M : 'شهر', - MM : '%d أشهر', - y : 'سنة', - yy : '%d سنوات' - }, - preparse: function (string) { - return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-tn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-tn.js deleted file mode 100644 index 98709c6f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar-tn.js +++ /dev/null @@ -1,49 +0,0 @@ -//! moment.js locale configuration -//! locale : Tunisian Arabic (ar-tn) - -import moment from '../moment'; - -export default moment.defineLocale('ar-tn', { - months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), - weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[اليوم على الساعة] LT', - nextDay: '[غدا على الساعة] LT', - nextWeek: 'dddd [على الساعة] LT', - lastDay: '[أمس على الساعة] LT', - lastWeek: 'dddd [على الساعة] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'في %s', - past: 'منذ %s', - s: 'ثوان', - m: 'دقيقة', - mm: '%d دقائق', - h: 'ساعة', - hh: '%d ساعات', - d: 'يوم', - dd: '%d أيام', - M: 'شهر', - MM: '%d أشهر', - y: 'سنة', - yy: '%d سنوات' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar.js deleted file mode 100644 index 4cdcdc26..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ar.js +++ /dev/null @@ -1,128 +0,0 @@ -//! moment.js locale configuration -//! Locale: Arabic (ar) -//! Author: Abdel Said: https://github.com/abdelsaid -//! Changes in months, weekdays: Ahmed Elkhatib -//! Native plural forms: forabi https://github.com/forabi - -import moment from '../moment'; - -var symbolMap = { - '1': '١', - '2': '٢', - '3': '٣', - '4': '٤', - '5': '٥', - '6': '٦', - '7': '٧', - '8': '٨', - '9': '٩', - '0': '٠' -}, numberMap = { - '١': '1', - '٢': '2', - '٣': '3', - '٤': '4', - '٥': '5', - '٦': '6', - '٧': '7', - '٨': '8', - '٩': '9', - '٠': '0' -}, pluralForm = function (n) { - return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5; -}, plurals = { - s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'], - m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'], - h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'], - d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'], - M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'], - y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام'] -}, pluralize = function (u) { - return function (number, withoutSuffix, string, isFuture) { - var f = pluralForm(number), - str = plurals[u][pluralForm(number)]; - if (f === 2) { - str = str[withoutSuffix ? 0 : 1]; - } - return str.replace(/%d/i, number); - }; -}, months = [ - 'كانون الثاني يناير', - 'شباط فبراير', - 'آذار مارس', - 'نيسان أبريل', - 'أيار مايو', - 'حزيران يونيو', - 'تموز يوليو', - 'آب أغسطس', - 'أيلول سبتمبر', - 'تشرين الأول أكتوبر', - 'تشرين الثاني نوفمبر', - 'كانون الأول ديسمبر' -]; - -export default moment.defineLocale('ar', { - months : months, - monthsShort : months, - weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), - weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/\u200FM/\u200FYYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ص|م/, - isPM : function (input) { - return 'م' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ص'; - } else { - return 'م'; - } - }, - calendar : { - sameDay: '[اليوم عند الساعة] LT', - nextDay: '[غدًا عند الساعة] LT', - nextWeek: 'dddd [عند الساعة] LT', - lastDay: '[أمس عند الساعة] LT', - lastWeek: 'dddd [عند الساعة] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'بعد %s', - past : 'منذ %s', - s : pluralize('s'), - m : pluralize('m'), - mm : pluralize('m'), - h : pluralize('h'), - hh : pluralize('h'), - d : pluralize('d'), - dd : pluralize('d'), - M : pluralize('M'), - MM : pluralize('M'), - y : pluralize('y'), - yy : pluralize('y') - }, - preparse: function (string) { - return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/az.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/az.js deleted file mode 100644 index d26ade9a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/az.js +++ /dev/null @@ -1,96 +0,0 @@ -//! moment.js locale configuration -//! locale : azerbaijani (az) -//! author : topchiyev : https://github.com/topchiyev - -import moment from '../moment'; - -var suffixes = { - 1: '-inci', - 5: '-inci', - 8: '-inci', - 70: '-inci', - 80: '-inci', - 2: '-nci', - 7: '-nci', - 20: '-nci', - 50: '-nci', - 3: '-üncü', - 4: '-üncü', - 100: '-üncü', - 6: '-ncı', - 9: '-uncu', - 10: '-uncu', - 30: '-uncu', - 60: '-ıncı', - 90: '-ıncı' -}; - -export default moment.defineLocale('az', { - months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'), - monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'), - weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'), - weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), - weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[sabah saat] LT', - nextWeek : '[gələn həftə] dddd [saat] LT', - lastDay : '[dünən] LT', - lastWeek : '[keçən həftə] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s əvvəl', - s : 'birneçə saniyyə', - m : 'bir dəqiqə', - mm : '%d dəqiqə', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir il', - yy : '%d il' - }, - meridiemParse: /gecə|səhər|gündüz|axşam/, - isPM : function (input) { - return /^(gündüz|axşam)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'gecə'; - } else if (hour < 12) { - return 'səhər'; - } else if (hour < 17) { - return 'gündüz'; - } else { - return 'axşam'; - } - }, - ordinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '-ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/be.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/be.js deleted file mode 100644 index cfdd99f1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/be.js +++ /dev/null @@ -1,125 +0,0 @@ -//! moment.js locale configuration -//! locale : belarusian (be) -//! author : Dmitry Demidov : https://github.com/demidov91 -//! author: Praleska: http://praleska.pro/ -//! Author : Menelion Elensúle : https://github.com/Oire - -import moment from '../moment'; - -function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', - 'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', - 'dd': 'дзень_дні_дзён', - 'MM': 'месяц_месяцы_месяцаў', - 'yy': 'год_гады_гадоў' - }; - if (key === 'm') { - return withoutSuffix ? 'хвіліна' : 'хвіліну'; - } - else if (key === 'h') { - return withoutSuffix ? 'гадзіна' : 'гадзіну'; - } - else { - return number + ' ' + plural(format[key], +number); - } -} - -export default moment.defineLocale('be', { - months : { - format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'), - standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_') - }, - monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'), - weekdays : { - format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'), - standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'), - isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/ - }, - weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сёння ў] LT', - nextDay: '[Заўтра ў] LT', - lastDay: '[Учора ў] LT', - nextWeek: function () { - return '[У] dddd [ў] LT'; - }, - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return '[У мінулую] dddd [ў] LT'; - case 1: - case 2: - case 4: - return '[У мінулы] dddd [ў] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'праз %s', - past : '%s таму', - s : 'некалькі секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : relativeTimeWithPlural, - hh : relativeTimeWithPlural, - d : 'дзень', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночы|раніцы|дня|вечара/, - isPM : function (input) { - return /^(дня|вечара)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночы'; - } else if (hour < 12) { - return 'раніцы'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечара'; - } - }, - ordinalParse: /\d{1,2}-(і|ы|га)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы'; - case 'D': - return number + '-га'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bg.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bg.js deleted file mode 100644 index d017ae56..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bg.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : bulgarian (bg) -//! author : Krasen Borisov : https://github.com/kraz - -import moment from '../moment'; - -export default moment.defineLocale('bg', { - months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'), - weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Днес в] LT', - nextDay : '[Утре в] LT', - nextWeek : 'dddd [в] LT', - lastDay : '[Вчера в] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[В изминалата] dddd [в] LT'; - case 1: - case 2: - case 4: - case 5: - return '[В изминалия] dddd [в] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'след %s', - past : 'преди %s', - s : 'няколко секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дни', - M : 'месец', - MM : '%d месеца', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bn.js deleted file mode 100644 index 6d2f59d6..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bn.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Bengali (bn) -//! author : Kaushik Gandhi : https://github.com/kaushikgandhi - -import moment from '../moment'; - -var symbolMap = { - '1': '১', - '2': '২', - '3': '৩', - '4': '৪', - '5': '৫', - '6': '৬', - '7': '৭', - '8': '৮', - '9': '৯', - '0': '০' -}, -numberMap = { - '১': '1', - '২': '2', - '৩': '3', - '৪': '4', - '৫': '5', - '৬': '6', - '৭': '7', - '৮': '8', - '৯': '9', - '০': '0' -}; - -export default moment.defineLocale('bn', { - months : 'জানুয়ারী_ফেবুয়ারী_মার্চ_এপ্রিল_মে_জুন_জুলাই_অগাস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'), - monthsShort : 'জানু_ফেব_মার্চ_এপর_মে_জুন_জুল_অগ_সেপ্ট_অক্টো_নভ_ডিসেম্'.split('_'), - weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পত্তিবার_শুক্রবার_শনিবার'.split('_'), - weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পত্তি_শুক্র_শনি'.split('_'), - weekdaysMin : 'রব_সম_মঙ্গ_বু_ব্রিহ_শু_শনি'.split('_'), - longDateFormat : { - LT : 'A h:mm সময়', - LTS : 'A h:mm:ss সময়', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm সময়', - LLLL : 'dddd, D MMMM YYYY, A h:mm সময়' - }, - calendar : { - sameDay : '[আজ] LT', - nextDay : '[আগামীকাল] LT', - nextWeek : 'dddd, LT', - lastDay : '[গতকাল] LT', - lastWeek : '[গত] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s পরে', - past : '%s আগে', - s : 'কয়েক সেকেন্ড', - m : 'এক মিনিট', - mm : '%d মিনিট', - h : 'এক ঘন্টা', - hh : '%d ঘন্টা', - d : 'এক দিন', - dd : '%d দিন', - M : 'এক মাস', - MM : '%d মাস', - y : 'এক বছর', - yy : '%d বছর' - }, - preparse: function (string) { - return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'রাত' && hour >= 4) || - (meridiem === 'দুপুর' && hour < 5) || - meridiem === 'বিকাল') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'রাত'; - } else if (hour < 10) { - return 'সকাল'; - } else if (hour < 17) { - return 'দুপুর'; - } else if (hour < 20) { - return 'বিকাল'; - } else { - return 'রাত'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bo.js deleted file mode 100644 index 05b1fdc5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bo.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : tibetan (bo) -//! author : Thupten N. Chakrishar : https://github.com/vajradog - -import moment from '../moment'; - -var symbolMap = { - '1': '༡', - '2': '༢', - '3': '༣', - '4': '༤', - '5': '༥', - '6': '༦', - '7': '༧', - '8': '༨', - '9': '༩', - '0': '༠' -}, -numberMap = { - '༡': '1', - '༢': '2', - '༣': '3', - '༤': '4', - '༥': '5', - '༦': '6', - '༧': '7', - '༨': '8', - '༩': '9', - '༠': '0' -}; - -export default moment.defineLocale('bo', { - months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'), - weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'), - weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[དི་རིང] LT', - nextDay : '[སང་ཉིན] LT', - nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT', - lastDay : '[ཁ་སང] LT', - lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ལ་', - past : '%s སྔན་ལ', - s : 'ལམ་སང', - m : 'སྐར་མ་གཅིག', - mm : '%d སྐར་མ', - h : 'ཆུ་ཚོད་གཅིག', - hh : '%d ཆུ་ཚོད', - d : 'ཉིན་གཅིག', - dd : '%d ཉིན་', - M : 'ཟླ་བ་གཅིག', - MM : '%d ཟླ་བ', - y : 'ལོ་གཅིག', - yy : '%d ལོ' - }, - preparse: function (string) { - return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'མཚན་མོ' && hour >= 4) || - (meridiem === 'ཉིན་གུང' && hour < 5) || - meridiem === 'དགོང་དག') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'མཚན་མོ'; - } else if (hour < 10) { - return 'ཞོགས་ཀས'; - } else if (hour < 17) { - return 'ཉིན་གུང'; - } else if (hour < 20) { - return 'དགོང་དག'; - } else { - return 'མཚན་མོ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/br.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/br.js deleted file mode 100644 index 36d1e006..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/br.js +++ /dev/null @@ -1,99 +0,0 @@ -//! moment.js locale configuration -//! locale : breton (br) -//! author : Jean-Baptiste Le Duigou : https://github.com/jbleduigou - -import moment from '../moment'; - -function relativeTimeWithMutation(number, withoutSuffix, key) { - var format = { - 'mm': 'munutenn', - 'MM': 'miz', - 'dd': 'devezh' - }; - return number + ' ' + mutation(format[key], number); -} -function specialMutationForYears(number) { - switch (lastNumber(number)) { - case 1: - case 3: - case 4: - case 5: - case 9: - return number + ' bloaz'; - default: - return number + ' vloaz'; - } -} -function lastNumber(number) { - if (number > 9) { - return lastNumber(number % 10); - } - return number; -} -function mutation(text, number) { - if (number === 2) { - return softMutation(text); - } - return text; -} -function softMutation(text) { - var mutationTable = { - 'm': 'v', - 'b': 'v', - 'd': 'z' - }; - if (mutationTable[text.charAt(0)] === undefined) { - return text; - } - return mutationTable[text.charAt(0)] + text.substring(1); -} - -export default moment.defineLocale('br', { - months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'), - monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'), - weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'), - weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), - weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h[e]mm A', - LTS : 'h[e]mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D [a viz] MMMM YYYY', - LLL : 'D [a viz] MMMM YYYY h[e]mm A', - LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A' - }, - calendar : { - sameDay : '[Hiziv da] LT', - nextDay : '[Warc\'hoazh da] LT', - nextWeek : 'dddd [da] LT', - lastDay : '[Dec\'h da] LT', - lastWeek : 'dddd [paset da] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'a-benn %s', - past : '%s \'zo', - s : 'un nebeud segondennoù', - m : 'ur vunutenn', - mm : relativeTimeWithMutation, - h : 'un eur', - hh : '%d eur', - d : 'un devezh', - dd : relativeTimeWithMutation, - M : 'ur miz', - MM : relativeTimeWithMutation, - y : 'ur bloaz', - yy : specialMutationForYears - }, - ordinalParse: /\d{1,2}(añ|vet)/, - ordinal : function (number) { - var output = (number === 1) ? 'añ' : 'vet'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bs.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bs.js deleted file mode 100644 index c1abbe9c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/bs.js +++ /dev/null @@ -1,134 +0,0 @@ -//! moment.js locale configuration -//! locale : bosnian (bs) -//! author : Nedim Cholich : https://github.com/frontyard -//! based on (hr) translation by Bojan Marković - -import moment from '../moment'; - -function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } -} - -export default moment.defineLocale('bs', { - months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ca.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ca.js deleted file mode 100644 index 6e5a793d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ca.js +++ /dev/null @@ -1,72 +0,0 @@ -//! moment.js locale configuration -//! locale : catalan (ca) -//! author : Juan G. Hurtado : https://github.com/juanghurtado - -import moment from '../moment'; - -export default moment.defineLocale('ca', { - months : 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'), - monthsShort : 'gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'), - weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), - weekdaysMin : 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextDay : function () { - return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastDay : function () { - return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'fa %s', - s : 'uns segons', - m : 'un minut', - mm : '%d minuts', - h : 'una hora', - hh : '%d hores', - d : 'un dia', - dd : '%d dies', - M : 'un mes', - MM : '%d mesos', - y : 'un any', - yy : '%d anys' - }, - ordinalParse: /\d{1,2}(r|n|t|è|a)/, - ordinal : function (number, period) { - var output = (number === 1) ? 'r' : - (number === 2) ? 'n' : - (number === 3) ? 'r' : - (number === 4) ? 't' : 'è'; - if (period === 'w' || period === 'W') { - output = 'a'; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cs.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cs.js deleted file mode 100644 index 3f31fde5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cs.js +++ /dev/null @@ -1,162 +0,0 @@ -//! moment.js locale configuration -//! locale : czech (cs) -//! author : petrbela : https://github.com/petrbela - -import moment from '../moment'; - -var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), - monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'); -function plural(n) { - return (n > 1) && (n < 5) && (~~(n / 10) !== 1); -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minuty' : 'minut'); - } else { - return result + 'minutami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodin'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'den' : 'dnem'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dny' : 'dní'); - } else { - return result + 'dny'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'měsíce' : 'měsíců'); - } else { - return result + 'měsíci'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokem'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'let'); - } else { - return result + 'lety'; - } - break; - } -} - -export default moment.defineLocale('cs', { - months : months, - monthsShort : monthsShort, - monthsParse : (function (months, monthsShort) { - var i, _monthsParse = []; - for (i = 0; i < 12; i++) { - // use custom parser to solve problem with July (červenec) - _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i'); - } - return _monthsParse; - }(months, monthsShort)), - shortMonthsParse : (function (monthsShort) { - var i, _shortMonthsParse = []; - for (i = 0; i < 12; i++) { - _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i'); - } - return _shortMonthsParse; - }(monthsShort)), - longMonthsParse : (function (months) { - var i, _longMonthsParse = []; - for (i = 0; i < 12; i++) { - _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i'); - } - return _longMonthsParse; - }(months)), - weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), - weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'), - weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes v] LT', - nextDay: '[zítra v] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v neděli v] LT'; - case 1: - case 2: - return '[v] dddd [v] LT'; - case 3: - return '[ve středu v] LT'; - case 4: - return '[ve čtvrtek v] LT'; - case 5: - return '[v pátek v] LT'; - case 6: - return '[v sobotu v] LT'; - } - }, - lastDay: '[včera v] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulou neděli v] LT'; - case 1: - case 2: - return '[minulé] dddd [v] LT'; - case 3: - return '[minulou středu v] LT'; - case 4: - case 5: - return '[minulý] dddd [v] LT'; - case 6: - return '[minulou sobotu v] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'před %s', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse : /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cv.js deleted file mode 100644 index f1cafe14..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cv.js +++ /dev/null @@ -1,53 +0,0 @@ -//! moment.js locale configuration -//! locale : chuvash (cv) -//! author : Anatoly Mironov : https://github.com/mirontoli - -import moment from '../moment'; - -export default moment.defineLocale('cv', { - months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'), - monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), - weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'), - weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), - weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', - LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', - LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm' - }, - calendar : { - sameDay: '[Паян] LT [сехетре]', - nextDay: '[Ыран] LT [сехетре]', - lastDay: '[Ӗнер] LT [сехетре]', - nextWeek: '[Ҫитес] dddd LT [сехетре]', - lastWeek: '[Иртнӗ] dddd LT [сехетре]', - sameElse: 'L' - }, - relativeTime : { - future : function (output) { - var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран'; - return output + affix; - }, - past : '%s каялла', - s : 'пӗр-ик ҫеккунт', - m : 'пӗр минут', - mm : '%d минут', - h : 'пӗр сехет', - hh : '%d сехет', - d : 'пӗр кун', - dd : '%d кун', - M : 'пӗр уйӑх', - MM : '%d уйӑх', - y : 'пӗр ҫул', - yy : '%d ҫул' - }, - ordinalParse: /\d{1,2}-мӗш/, - ordinal : '%d-мӗш', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cy.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cy.js deleted file mode 100644 index 93c8c853..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/cy.js +++ /dev/null @@ -1,71 +0,0 @@ -//! moment.js locale configuration -//! locale : Welsh (cy) -//! author : Robert Allen - -import moment from '../moment'; - -export default moment.defineLocale('cy', { - months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), - monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), - weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'), - weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), - weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), - weekdaysParseExact : true, - // time formats are the same as en-gb - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[Heddiw am] LT', - nextDay: '[Yfory am] LT', - nextWeek: 'dddd [am] LT', - lastDay: '[Ddoe am] LT', - lastWeek: 'dddd [diwethaf am] LT', - sameElse: 'L' - }, - relativeTime: { - future: 'mewn %s', - past: '%s yn ôl', - s: 'ychydig eiliadau', - m: 'munud', - mm: '%d munud', - h: 'awr', - hh: '%d awr', - d: 'diwrnod', - dd: '%d diwrnod', - M: 'mis', - MM: '%d mis', - y: 'blwyddyn', - yy: '%d flynedd' - }, - ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, - // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh - ordinal: function (number) { - var b = number, - output = '', - lookup = [ - '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed - 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed - ]; - if (b > 20) { - if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { - output = 'fed'; // not 30ain, 70ain or 90ain - } else { - output = 'ain'; - } - } else if (b > 0) { - output = lookup[b]; - } - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/da.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/da.js deleted file mode 100644 index a98c4bcd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/da.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : danish (da) -//! author : Ulrik Nielsen : https://github.com/mrbase - -import moment from '../moment'; - -export default moment.defineLocale('da', { - months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd [d.] D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[I dag kl.] LT', - nextDay : '[I morgen kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[I går kl.] LT', - lastWeek : '[sidste] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'få sekunder', - m : 'et minut', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dage', - M : 'en måned', - MM : '%d måneder', - y : 'et år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de-at.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de-at.js deleted file mode 100644 index 5207b796..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de-at.js +++ /dev/null @@ -1,69 +0,0 @@ -//! moment.js locale configuration -//! locale : austrian german (de-at) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Martin Groller : https://github.com/MadMG -//! author : Mikolaj Dadela : https://github.com/mik01aj - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('de-at', { - months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de.js deleted file mode 100644 index 9230536d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/de.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : german (de) -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Mikolaj Dadela : https://github.com/mik01aj - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eine Minute', 'einer Minute'], - 'h': ['eine Stunde', 'einer Stunde'], - 'd': ['ein Tag', 'einem Tag'], - 'dd': [number + ' Tage', number + ' Tagen'], - 'M': ['ein Monat', 'einem Monat'], - 'MM': [number + ' Monate', number + ' Monaten'], - 'y': ['ein Jahr', 'einem Jahr'], - 'yy': [number + ' Jahre', number + ' Jahren'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('de', { - months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort : 'Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), - weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY HH:mm', - LLLL : 'dddd, D. MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]' - }, - relativeTime : { - future : 'in %s', - past : 'vor %s', - s : 'ein paar Sekunden', - m : processRelativeTime, - mm : '%d Minuten', - h : processRelativeTime, - hh : '%d Stunden', - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/dv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/dv.js deleted file mode 100644 index 6e7a42dd..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/dv.js +++ /dev/null @@ -1,89 +0,0 @@ -//! moment.js locale configuration -//! locale : dhivehi (dv) -//! author : Jawish Hameed : https://github.com/jawish - -import moment from '../moment'; - -var months = [ - 'ޖެނުއަރީ', - 'ފެބްރުއަރީ', - 'މާރިޗު', - 'އޭޕްރީލު', - 'މޭ', - 'ޖޫން', - 'ޖުލައި', - 'އޯގަސްޓު', - 'ސެޕްޓެމްބަރު', - 'އޮކްޓޯބަރު', - 'ނޮވެމްބަރު', - 'ޑިސެމްބަރު' -], weekdays = [ - 'އާދިއްތަ', - 'ހޯމަ', - 'އަންގާރަ', - 'ބުދަ', - 'ބުރާސްފަތި', - 'ހުކުރު', - 'ހޮނިހިރު' -]; - -export default moment.defineLocale('dv', { - months : months, - monthsShort : months, - weekdays : weekdays, - weekdaysShort : weekdays, - weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), - longDateFormat : { - - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'D/M/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - meridiemParse: /މކ|މފ/, - isPM : function (input) { - return 'މފ' === input; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'މކ'; - } else { - return 'މފ'; - } - }, - calendar : { - sameDay : '[މިއަދު] LT', - nextDay : '[މާދަމާ] LT', - nextWeek : 'dddd LT', - lastDay : '[އިއްޔެ] LT', - lastWeek : '[ފާއިތުވި] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ތެރޭގައި %s', - past : 'ކުރިން %s', - s : 'ސިކުންތުކޮޅެއް', - m : 'މިނިޓެއް', - mm : 'މިނިޓު %d', - h : 'ގަޑިއިރެއް', - hh : 'ގަޑިއިރު %d', - d : 'ދުވަހެއް', - dd : 'ދުވަސް %d', - M : 'މަހެއް', - MM : 'މަސް %d', - y : 'އަހަރެއް', - yy : 'އަހަރު %d' - }, - preparse: function (string) { - return string.replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/,/g, '،'); - }, - week : { - dow : 7, // Sunday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/el.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/el.js deleted file mode 100644 index 2722062f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/el.js +++ /dev/null @@ -1,86 +0,0 @@ -//! moment.js locale configuration -//! locale : modern greek (el) -//! author : Aggelos Karalias : https://github.com/mehiel - -import moment from '../moment'; -import isFunction from '../lib/utils/is-function'; - -export default moment.defineLocale('el', { - monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), - monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'), - months : function (momentToFormat, format) { - if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM' - return this._monthsGenitiveEl[momentToFormat.month()]; - } else { - return this._monthsNominativeEl[momentToFormat.month()]; - } - }, - monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), - weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), - weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), - weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'μμ' : 'ΜΜ'; - } else { - return isLower ? 'πμ' : 'ΠΜ'; - } - }, - isPM : function (input) { - return ((input + '').toLowerCase()[0] === 'μ'); - }, - meridiemParse : /[ΠΜ]\.?Μ?\.?/i, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendarEl : { - sameDay : '[Σήμερα {}] LT', - nextDay : '[Αύριο {}] LT', - nextWeek : 'dddd [{}] LT', - lastDay : '[Χθες {}] LT', - lastWeek : function () { - switch (this.day()) { - case 6: - return '[το προηγούμενο] dddd [{}] LT'; - default: - return '[την προηγούμενη] dddd [{}] LT'; - } - }, - sameElse : 'L' - }, - calendar : function (key, mom) { - var output = this._calendarEl[key], - hours = mom && mom.hours(); - if (isFunction(output)) { - output = output.apply(mom); - } - return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις')); - }, - relativeTime : { - future : 'σε %s', - past : '%s πριν', - s : 'λίγα δευτερόλεπτα', - m : 'ένα λεπτό', - mm : '%d λεπτά', - h : 'μία ώρα', - hh : '%d ώρες', - d : 'μία μέρα', - dd : '%d μέρες', - M : 'ένας μήνας', - MM : '%d μήνες', - y : 'ένας χρόνος', - yy : '%d χρόνια' - }, - ordinalParse: /\d{1,2}η/, - ordinal: '%dη', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-au.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-au.js deleted file mode 100644 index 13c4702d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-au.js +++ /dev/null @@ -1,57 +0,0 @@ -//! moment.js locale configuration -//! locale : australian english (en-au) - -import moment from '../moment'; - -export default moment.defineLocale('en-au', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ca.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ca.js deleted file mode 100644 index 54b49812..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ca.js +++ /dev/null @@ -1,53 +0,0 @@ -//! moment.js locale configuration -//! locale : canadian english (en-ca) -//! author : Jonathan Abourbih : https://github.com/jonbca - -import moment from '../moment'; - -export default moment.defineLocale('en-ca', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'YYYY-MM-DD', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-gb.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-gb.js deleted file mode 100644 index 82a643fc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-gb.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : great britain english (en-gb) -//! author : Chris Gedrim : https://github.com/chrisgedrim - -import moment from '../moment'; - -export default moment.defineLocale('en-gb', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ie.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ie.js deleted file mode 100644 index cb3ae8fa..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-ie.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : Irish english (en-ie) -//! author : Chris Cartlidge : https://github.com/chriscartlidge - -import moment from '../moment'; - -export default moment.defineLocale('en-ie', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-nz.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-nz.js deleted file mode 100644 index c6e9f18a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/en-nz.js +++ /dev/null @@ -1,56 +0,0 @@ -//! moment.js locale configuration -//! locale : New Zealand english (en-nz) - -import moment from '../moment'; - -export default moment.defineLocale('en-nz', { - months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }, - ordinalParse: /\d{1,2}(st|nd|rd|th)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eo.js deleted file mode 100644 index d36d5700..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eo.js +++ /dev/null @@ -1,64 +0,0 @@ -//! moment.js locale configuration -//! locale : esperanto (eo) -//! author : Colin Dean : https://github.com/colindean -//! komento: Mi estas malcerta se mi korekte traktis akuzativojn en tiu traduko. -//! Se ne, bonvolu korekti kaj avizi min por ke mi povas lerni! - -import moment from '../moment'; - -export default moment.defineLocale('eo', { - months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'), - weekdays : 'Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato'.split('_'), - weekdaysShort : 'Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Ĵa_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D[-an de] MMMM, YYYY', - LLL : 'D[-an de] MMMM, YYYY HH:mm', - LLLL : 'dddd, [la] D[-an de] MMMM, YYYY HH:mm' - }, - meridiemParse: /[ap]\.t\.m/i, - isPM: function (input) { - return input.charAt(0).toLowerCase() === 'p'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'p.t.m.' : 'P.T.M.'; - } else { - return isLower ? 'a.t.m.' : 'A.T.M.'; - } - }, - calendar : { - sameDay : '[Hodiaŭ je] LT', - nextDay : '[Morgaŭ je] LT', - nextWeek : 'dddd [je] LT', - lastDay : '[Hieraŭ je] LT', - lastWeek : '[pasinta] dddd [je] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'je %s', - past : 'antaŭ %s', - s : 'sekundoj', - m : 'minuto', - mm : '%d minutoj', - h : 'horo', - hh : '%d horoj', - d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo - dd : '%d tagoj', - M : 'monato', - MM : '%d monatoj', - y : 'jaro', - yy : '%d jaroj' - }, - ordinalParse: /\d{1,2}a/, - ordinal : '%da', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/es.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/es.js deleted file mode 100644 index 6a5fe480..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/es.js +++ /dev/null @@ -1,72 +0,0 @@ -//! moment.js locale configuration -//! locale : spanish (es) -//! author : Julio Napurí : https://github.com/julionc - -import moment from '../moment'; - -var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), - monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); - -export default moment.defineLocale('es', { - months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return monthsShort[m.month()]; - } else { - return monthsShortDot[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), - weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), - weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY H:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextDay : function () { - return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - nextWeek : function () { - return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastDay : function () { - return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - lastWeek : function () { - return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'en %s', - past : 'hace %s', - s : 'unos segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'una hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un año', - yy : '%d años' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/et.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/et.js deleted file mode 100644 index 401ab574..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/et.js +++ /dev/null @@ -1,71 +0,0 @@ -//! moment.js locale configuration -//! locale : estonian (et) -//! author : Henry Kehlmann : https://github.com/madhenry -//! improvements : Illimar Tambek : https://github.com/ragulka - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'], - 'm' : ['ühe minuti', 'üks minut'], - 'mm': [number + ' minuti', number + ' minutit'], - 'h' : ['ühe tunni', 'tund aega', 'üks tund'], - 'hh': [number + ' tunni', number + ' tundi'], - 'd' : ['ühe päeva', 'üks päev'], - 'M' : ['kuu aja', 'kuu aega', 'üks kuu'], - 'MM': [number + ' kuu', number + ' kuud'], - 'y' : ['ühe aasta', 'aasta', 'üks aasta'], - 'yy': [number + ' aasta', number + ' aastat'] - }; - if (withoutSuffix) { - return format[key][2] ? format[key][2] : format[key][1]; - } - return isFuture ? format[key][0] : format[key][1]; -} - -export default moment.defineLocale('et', { - months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'), - monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'), - weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'), - weekdaysShort : 'P_E_T_K_N_R_L'.split('_'), - weekdaysMin : 'P_E_T_K_N_R_L'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Täna,] LT', - nextDay : '[Homme,] LT', - nextWeek : '[Järgmine] dddd LT', - lastDay : '[Eile,] LT', - lastWeek : '[Eelmine] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s pärast', - past : '%s tagasi', - s : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : '%d päeva', - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eu.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eu.js deleted file mode 100644 index 0302f2d9..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/eu.js +++ /dev/null @@ -1,57 +0,0 @@ -//! moment.js locale configuration -//! locale : euskara (eu) -//! author : Eneko Illarramendi : https://github.com/eillarra - -import moment from '../moment'; - -export default moment.defineLocale('eu', { - months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'), - monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'), - monthsParseExact : true, - weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'), - weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'), - weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY[ko] MMMM[ren] D[a]', - LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm', - LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', - l : 'YYYY-M-D', - ll : 'YYYY[ko] MMM D[a]', - lll : 'YYYY[ko] MMM D[a] HH:mm', - llll : 'ddd, YYYY[ko] MMM D[a] HH:mm' - }, - calendar : { - sameDay : '[gaur] LT[etan]', - nextDay : '[bihar] LT[etan]', - nextWeek : 'dddd LT[etan]', - lastDay : '[atzo] LT[etan]', - lastWeek : '[aurreko] dddd LT[etan]', - sameElse : 'L' - }, - relativeTime : { - future : '%s barru', - past : 'duela %s', - s : 'segundo batzuk', - m : 'minutu bat', - mm : '%d minutu', - h : 'ordu bat', - hh : '%d ordu', - d : 'egun bat', - dd : '%d egun', - M : 'hilabete bat', - MM : '%d hilabete', - y : 'urte bat', - yy : '%d urte' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fa.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fa.js deleted file mode 100644 index 0a9d92cc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fa.js +++ /dev/null @@ -1,97 +0,0 @@ -//! moment.js locale configuration -//! locale : Persian (fa) -//! author : Ebrahim Byagowi : https://github.com/ebraminio - -import moment from '../moment'; - -var symbolMap = { - '1': '۱', - '2': '۲', - '3': '۳', - '4': '۴', - '5': '۵', - '6': '۶', - '7': '۷', - '8': '۸', - '9': '۹', - '0': '۰' -}, numberMap = { - '۱': '1', - '۲': '2', - '۳': '3', - '۴': '4', - '۵': '5', - '۶': '6', - '۷': '7', - '۸': '8', - '۹': '9', - '۰': '0' -}; - -export default moment.defineLocale('fa', { - months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), - weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), - weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - meridiemParse: /قبل از ظهر|بعد از ظهر/, - isPM: function (input) { - return /بعد از ظهر/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'قبل از ظهر'; - } else { - return 'بعد از ظهر'; - } - }, - calendar : { - sameDay : '[امروز ساعت] LT', - nextDay : '[فردا ساعت] LT', - nextWeek : 'dddd [ساعت] LT', - lastDay : '[دیروز ساعت] LT', - lastWeek : 'dddd [پیش] [ساعت] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'در %s', - past : '%s پیش', - s : 'چندین ثانیه', - m : 'یک دقیقه', - mm : '%d دقیقه', - h : 'یک ساعت', - hh : '%d ساعت', - d : 'یک روز', - dd : '%d روز', - M : 'یک ماه', - MM : '%d ماه', - y : 'یک سال', - yy : '%d سال' - }, - preparse: function (string) { - return string.replace(/[۰-۹]/g, function (match) { - return numberMap[match]; - }).replace(/،/g, ','); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }).replace(/,/g, '،'); - }, - ordinalParse: /\d{1,2}م/, - ordinal : '%dم', - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fi.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fi.js deleted file mode 100644 index ed929409..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fi.js +++ /dev/null @@ -1,98 +0,0 @@ -//! moment.js locale configuration -//! locale : finnish (fi) -//! author : Tarmo Aidantausta : https://github.com/bleadof - -import moment from '../moment'; - -var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '), - numbersFuture = [ - 'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden', - numbersPast[7], numbersPast[8], numbersPast[9] - ]; -function translate(number, withoutSuffix, key, isFuture) { - var result = ''; - switch (key) { - case 's': - return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; - case 'm': - return isFuture ? 'minuutin' : 'minuutti'; - case 'mm': - result = isFuture ? 'minuutin' : 'minuuttia'; - break; - case 'h': - return isFuture ? 'tunnin' : 'tunti'; - case 'hh': - result = isFuture ? 'tunnin' : 'tuntia'; - break; - case 'd': - return isFuture ? 'päivän' : 'päivä'; - case 'dd': - result = isFuture ? 'päivän' : 'päivää'; - break; - case 'M': - return isFuture ? 'kuukauden' : 'kuukausi'; - case 'MM': - result = isFuture ? 'kuukauden' : 'kuukautta'; - break; - case 'y': - return isFuture ? 'vuoden' : 'vuosi'; - case 'yy': - result = isFuture ? 'vuoden' : 'vuotta'; - break; - } - result = verbalNumber(number, isFuture) + ' ' + result; - return result; -} -function verbalNumber(number, isFuture) { - return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number; -} - -export default moment.defineLocale('fi', { - months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'), - monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'), - weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), - weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'), - weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'Do MMMM[ta] YYYY', - LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm', - LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', - l : 'D.M.YYYY', - ll : 'Do MMM YYYY', - lll : 'Do MMM YYYY, [klo] HH.mm', - llll : 'ddd, Do MMM YYYY, [klo] HH.mm' - }, - calendar : { - sameDay : '[tänään] [klo] LT', - nextDay : '[huomenna] [klo] LT', - nextWeek : 'dddd [klo] LT', - lastDay : '[eilen] [klo] LT', - lastWeek : '[viime] dddd[na] [klo] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s päästä', - past : '%s sitten', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fo.js deleted file mode 100644 index 2425fc95..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fo.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : faroese (fo) -//! author : Ragnar Johannesen : https://github.com/ragnar123 - -import moment from '../moment'; - -export default moment.defineLocale('fo', { - months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'), - weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D. MMMM, YYYY HH:mm' - }, - calendar : { - sameDay : '[Í dag kl.] LT', - nextDay : '[Í morgin kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[Í gjár kl.] LT', - lastWeek : '[síðstu] dddd [kl] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'um %s', - past : '%s síðani', - s : 'fá sekund', - m : 'ein minutt', - mm : '%d minuttir', - h : 'ein tími', - hh : '%d tímar', - d : 'ein dagur', - dd : '%d dagar', - M : 'ein mánaði', - MM : '%d mánaðir', - y : 'eitt ár', - yy : '%d ár' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ca.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ca.js deleted file mode 100644 index 518081ec..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ca.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : canadian french (fr-ca) -//! author : Jonathan Abourbih : https://github.com/jonbca - -import moment from '../moment'; - -export default moment.defineLocale('fr-ca', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ch.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ch.js deleted file mode 100644 index f4991589..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr-ch.js +++ /dev/null @@ -1,55 +0,0 @@ -//! moment.js locale configuration -//! locale : swiss french (fr) -//! author : Gaspard Bucher : https://github.com/gaspard - -import moment from '../moment'; - -export default moment.defineLocale('fr-ch', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|e)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : 'e'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr.js deleted file mode 100644 index 3ff1c4b5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fr.js +++ /dev/null @@ -1,55 +0,0 @@ -//! moment.js locale configuration -//! locale : french (fr) -//! author : John Fischer : https://github.com/jfroffice - -import moment from '../moment'; - -export default moment.defineLocale('fr', { - months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), - monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'), - monthsParseExact : true, - weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), - weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), - weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Aujourd\'hui à] LT', - nextDay: '[Demain à] LT', - nextWeek: 'dddd [à] LT', - lastDay: '[Hier à] LT', - lastWeek: 'dddd [dernier à] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dans %s', - past : 'il y a %s', - s : 'quelques secondes', - m : 'une minute', - mm : '%d minutes', - h : 'une heure', - hh : '%d heures', - d : 'un jour', - dd : '%d jours', - M : 'un mois', - MM : '%d mois', - y : 'un an', - yy : '%d ans' - }, - ordinalParse: /\d{1,2}(er|)/, - ordinal : function (number) { - return number + (number === 1 ? 'er' : ''); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fy.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fy.js deleted file mode 100644 index b84dbbe7..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/fy.js +++ /dev/null @@ -1,64 +0,0 @@ -//! moment.js locale configuration -//! locale : frisian (fy) -//! author : Robin van der Vliet : https://github.com/robin0van0der0v - -import moment from '../moment'; - -var monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'); - -export default moment.defineLocale('fy', { - months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), - weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'), - weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[hjoed om] LT', - nextDay: '[moarn om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[juster om] LT', - lastWeek: '[ôfrûne] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'oer %s', - past : '%s lyn', - s : 'in pear sekonden', - m : 'ien minút', - mm : '%d minuten', - h : 'ien oere', - hh : '%d oeren', - d : 'ien dei', - dd : '%d dagen', - M : 'ien moanne', - MM : '%d moannen', - y : 'ien jier', - yy : '%d jierren' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gd.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gd.js deleted file mode 100644 index b7689f98..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gd.js +++ /dev/null @@ -1,67 +0,0 @@ -//! moment.js locale configuration -//! locale : great britain scottish gealic (gd) -//! author : Jon Ashdown : https://github.com/jonashdown - -import moment from '../moment'; - -var months = [ - 'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd' -]; - -var monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh']; - -var weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne']; - -var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis']; - -var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; - -export default moment.defineLocale('gd', { - months : months, - monthsShort : monthsShort, - monthsParseExact : true, - weekdays : weekdays, - weekdaysShort : weekdaysShort, - weekdaysMin : weekdaysMin, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[An-diugh aig] LT', - nextDay : '[A-màireach aig] LT', - nextWeek : 'dddd [aig] LT', - lastDay : '[An-dè aig] LT', - lastWeek : 'dddd [seo chaidh] [aig] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ann an %s', - past : 'bho chionn %s', - s : 'beagan diogan', - m : 'mionaid', - mm : '%d mionaidean', - h : 'uair', - hh : '%d uairean', - d : 'latha', - dd : '%d latha', - M : 'mìos', - MM : '%d mìosan', - y : 'bliadhna', - yy : '%d bliadhna' - }, - ordinalParse : /\d{1,2}(d|na|mh)/, - ordinal : function (number) { - var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gl.js deleted file mode 100644 index bdccae92..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/gl.js +++ /dev/null @@ -1,68 +0,0 @@ -//! moment.js locale configuration -//! locale : galician (gl) -//! author : Juan G. Hurtado : https://github.com/juanghurtado - -import moment from '../moment'; - -export default moment.defineLocale('gl', { - months : 'Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro'.split('_'), - monthsShort : 'Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.'.split('_'), - monthsParseExact: true, - weekdays : 'Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado'.split('_'), - weekdaysShort : 'Dom._Lun._Mar._Mér._Xov._Ven._Sáb.'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Mé_Xo_Ve_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd D MMMM YYYY H:mm' - }, - calendar : { - sameDay : function () { - return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextDay : function () { - return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT'; - }, - nextWeek : function () { - return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - lastDay : function () { - return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT'; - }, - lastWeek : function () { - return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT'; - }, - sameElse : 'L' - }, - relativeTime : { - future : function (str) { - if (str === 'uns segundos') { - return 'nuns segundos'; - } - return 'en ' + str; - }, - past : 'hai %s', - s : 'uns segundos', - m : 'un minuto', - mm : '%d minutos', - h : 'unha hora', - hh : '%d horas', - d : 'un día', - dd : '%d días', - M : 'un mes', - MM : '%d meses', - y : 'un ano', - yy : '%d anos' - }, - ordinalParse : /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/he.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/he.js deleted file mode 100644 index 9f4be802..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/he.js +++ /dev/null @@ -1,90 +0,0 @@ -//! moment.js locale configuration -//! locale : Hebrew (he) -//! author : Tomer Cohen : https://github.com/tomer -//! author : Moshe Simantov : https://github.com/DevelopmentIL -//! author : Tal Ater : https://github.com/TalAter - -import moment from '../moment'; - -export default moment.defineLocale('he', { - months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'), - monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'), - weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), - weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), - weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [ב]MMMM YYYY', - LLL : 'D [ב]MMMM YYYY HH:mm', - LLLL : 'dddd, D [ב]MMMM YYYY HH:mm', - l : 'D/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay : '[היום ב־]LT', - nextDay : '[מחר ב־]LT', - nextWeek : 'dddd [בשעה] LT', - lastDay : '[אתמול ב־]LT', - lastWeek : '[ביום] dddd [האחרון בשעה] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'בעוד %s', - past : 'לפני %s', - s : 'מספר שניות', - m : 'דקה', - mm : '%d דקות', - h : 'שעה', - hh : function (number) { - if (number === 2) { - return 'שעתיים'; - } - return number + ' שעות'; - }, - d : 'יום', - dd : function (number) { - if (number === 2) { - return 'יומיים'; - } - return number + ' ימים'; - }, - M : 'חודש', - MM : function (number) { - if (number === 2) { - return 'חודשיים'; - } - return number + ' חודשים'; - }, - y : 'שנה', - yy : function (number) { - if (number === 2) { - return 'שנתיים'; - } else if (number % 10 === 0 && number !== 10) { - return number + ' שנה'; - } - return number + ' שנים'; - } - }, - meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, - isPM : function (input) { - return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 5) { - return 'לפנות בוקר'; - } else if (hour < 10) { - return 'בבוקר'; - } else if (hour < 12) { - return isLower ? 'לפנה"צ' : 'לפני הצהריים'; - } else if (hour < 18) { - return isLower ? 'אחה"צ' : 'אחרי הצהריים'; - } else { - return 'בערב'; - } - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hi.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hi.js deleted file mode 100644 index fdbf292d..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hi.js +++ /dev/null @@ -1,115 +0,0 @@ -//! moment.js locale configuration -//! locale : hindi (hi) -//! author : Mayank Singhal : https://github.com/mayanksinghal - -import moment from '../moment'; - -var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' -}, -numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' -}; - -export default moment.defineLocale('hi', { - months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'), - monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'), - monthsParseExact: true, - weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm बजे', - LTS : 'A h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, A h:mm बजे' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[कल] LT', - nextWeek : 'dddd, LT', - lastDay : '[कल] LT', - lastWeek : '[पिछले] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s में', - past : '%s पहले', - s : 'कुछ ही क्षण', - m : 'एक मिनट', - mm : '%d मिनट', - h : 'एक घंटा', - hh : '%d घंटे', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महीने', - MM : '%d महीने', - y : 'एक वर्ष', - yy : '%d वर्ष' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Hindi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. - meridiemParse: /रात|सुबह|दोपहर|शाम/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सुबह') { - return hour; - } else if (meridiem === 'दोपहर') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'शाम') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'रात'; - } else if (hour < 10) { - return 'सुबह'; - } else if (hour < 17) { - return 'दोपहर'; - } else if (hour < 20) { - return 'शाम'; - } else { - return 'रात'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hr.js deleted file mode 100644 index 7c41712c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hr.js +++ /dev/null @@ -1,136 +0,0 @@ -//! moment.js locale configuration -//! locale : hrvatski (hr) -//! author : Bojan Marković : https://github.com/bmarkovic - -import moment from '../moment'; - -function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'jedna minuta' : 'jedne minute'; - case 'mm': - if (number === 1) { - result += 'minuta'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'minute'; - } else { - result += 'minuta'; - } - return result; - case 'h': - return withoutSuffix ? 'jedan sat' : 'jednog sata'; - case 'hh': - if (number === 1) { - result += 'sat'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'sata'; - } else { - result += 'sati'; - } - return result; - case 'dd': - if (number === 1) { - result += 'dan'; - } else { - result += 'dana'; - } - return result; - case 'MM': - if (number === 1) { - result += 'mjesec'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'mjeseca'; - } else { - result += 'mjeseci'; - } - return result; - case 'yy': - if (number === 1) { - result += 'godina'; - } else if (number === 2 || number === 3 || number === 4) { - result += 'godine'; - } else { - result += 'godina'; - } - return result; - } -} - -export default moment.defineLocale('hr', { - months : { - format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'), - standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_') - }, - monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'), - monthsParseExact: true, - weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danas u] LT', - nextDay : '[sutra u] LT', - nextWeek : function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[jučer u] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - return '[prošlu] dddd [u] LT'; - case 6: - return '[prošle] [subote] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prošli] dddd [u] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'par sekundi', - m : translate, - mm : translate, - h : translate, - hh : translate, - d : 'dan', - dd : translate, - M : 'mjesec', - MM : translate, - y : 'godinu', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hu.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hu.js deleted file mode 100644 index bc135092..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hu.js +++ /dev/null @@ -1,100 +0,0 @@ -//! moment.js locale configuration -//! locale : hungarian (hu) -//! author : Adam Brunner : https://github.com/adambrunner - -import moment from '../moment'; - -var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' '); -function translate(number, withoutSuffix, key, isFuture) { - var num = number, - suffix; - switch (key) { - case 's': - return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce'; - case 'm': - return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'mm': - return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); - case 'h': - return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'hh': - return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); - case 'd': - return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'dd': - return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); - case 'M': - return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'MM': - return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); - case 'y': - return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); - case 'yy': - return num + (isFuture || withoutSuffix ? ' év' : ' éve'); - } - return ''; -} -function week(isFuture) { - return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]'; -} - -export default moment.defineLocale('hu', { - months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'), - monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'), - weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), - weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), - weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'YYYY.MM.DD.', - LL : 'YYYY. MMMM D.', - LLL : 'YYYY. MMMM D. H:mm', - LLLL : 'YYYY. MMMM D., dddd H:mm' - }, - meridiemParse: /de|du/i, - isPM: function (input) { - return input.charAt(1).toLowerCase() === 'u'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower === true ? 'de' : 'DE'; - } else { - return isLower === true ? 'du' : 'DU'; - } - }, - calendar : { - sameDay : '[ma] LT[-kor]', - nextDay : '[holnap] LT[-kor]', - nextWeek : function () { - return week.call(this, true); - }, - lastDay : '[tegnap] LT[-kor]', - lastWeek : function () { - return week.call(this, false); - }, - sameElse : 'L' - }, - relativeTime : { - future : '%s múlva', - past : '%s', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hy-am.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hy-am.js deleted file mode 100644 index 7b5cc2bc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/hy-am.js +++ /dev/null @@ -1,86 +0,0 @@ -//! moment.js locale configuration -//! locale : Armenian (hy-am) -//! author : Armendarabyan : https://github.com/armendarabyan - -import moment from '../moment'; - -export default moment.defineLocale('hy-am', { - months : { - format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'), - standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_') - }, - monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), - weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'), - weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY թ.', - LLL : 'D MMMM YYYY թ., HH:mm', - LLLL : 'dddd, D MMMM YYYY թ., HH:mm' - }, - calendar : { - sameDay: '[այսօր] LT', - nextDay: '[վաղը] LT', - lastDay: '[երեկ] LT', - nextWeek: function () { - return 'dddd [օրը ժամը] LT'; - }, - lastWeek: function () { - return '[անցած] dddd [օրը ժամը] LT'; - }, - sameElse: 'L' - }, - relativeTime : { - future : '%s հետո', - past : '%s առաջ', - s : 'մի քանի վայրկյան', - m : 'րոպե', - mm : '%d րոպե', - h : 'ժամ', - hh : '%d ժամ', - d : 'օր', - dd : '%d օր', - M : 'ամիս', - MM : '%d ամիս', - y : 'տարի', - yy : '%d տարի' - }, - meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, - isPM: function (input) { - return /^(ցերեկվա|երեկոյան)$/.test(input); - }, - meridiem : function (hour) { - if (hour < 4) { - return 'գիշերվա'; - } else if (hour < 12) { - return 'առավոտվա'; - } else if (hour < 17) { - return 'ցերեկվա'; - } else { - return 'երեկոյան'; - } - }, - ordinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, - ordinal: function (number, period) { - switch (period) { - case 'DDD': - case 'w': - case 'W': - case 'DDDo': - if (number === 1) { - return number + '-ին'; - } - return number + '-րդ'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/id.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/id.js deleted file mode 100644 index 7bf359f4..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/id.js +++ /dev/null @@ -1,74 +0,0 @@ -//! moment.js locale configuration -//! locale : Bahasa Indonesia (id) -//! author : Mohammad Satrio Utomo : https://github.com/tyok -//! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan - -import moment from '../moment'; - -export default moment.defineLocale('id', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|siang|sore|malam/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'siang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sore' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'siang'; - } else if (hours < 19) { - return 'sore'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Besok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kemarin pukul] LT', - lastWeek : 'dddd [lalu pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lalu', - s : 'beberapa detik', - m : 'semenit', - mm : '%d menit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/is.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/is.js deleted file mode 100644 index 5a452bd2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/is.js +++ /dev/null @@ -1,118 +0,0 @@ -//! moment.js locale configuration -//! locale : icelandic (is) -//! author : Hinrik Örn Sigurðsson : https://github.com/hinrik - -import moment from '../moment'; - -function plural(n) { - if (n % 100 === 11) { - return true; - } else if (n % 10 === 1) { - return false; - } - return true; -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum'; - case 'm': - return withoutSuffix ? 'mínúta' : 'mínútu'; - case 'mm': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum'); - } else if (withoutSuffix) { - return result + 'mínúta'; - } - return result + 'mínútu'; - case 'hh': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum'); - } - return result + 'klukkustund'; - case 'd': - if (withoutSuffix) { - return 'dagur'; - } - return isFuture ? 'dag' : 'degi'; - case 'dd': - if (plural(number)) { - if (withoutSuffix) { - return result + 'dagar'; - } - return result + (isFuture ? 'daga' : 'dögum'); - } else if (withoutSuffix) { - return result + 'dagur'; - } - return result + (isFuture ? 'dag' : 'degi'); - case 'M': - if (withoutSuffix) { - return 'mánuður'; - } - return isFuture ? 'mánuð' : 'mánuði'; - case 'MM': - if (plural(number)) { - if (withoutSuffix) { - return result + 'mánuðir'; - } - return result + (isFuture ? 'mánuði' : 'mánuðum'); - } else if (withoutSuffix) { - return result + 'mánuður'; - } - return result + (isFuture ? 'mánuð' : 'mánuði'); - case 'y': - return withoutSuffix || isFuture ? 'ár' : 'ári'; - case 'yy': - if (plural(number)) { - return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); - } - return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); - } -} - -export default moment.defineLocale('is', { - months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), - weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'), - weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'), - weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm' - }, - calendar : { - sameDay : '[í dag kl.] LT', - nextDay : '[á morgun kl.] LT', - nextWeek : 'dddd [kl.] LT', - lastDay : '[í gær kl.] LT', - lastWeek : '[síðasta] dddd [kl.] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'eftir %s', - past : 'fyrir %s síðan', - s : translate, - m : translate, - mm : translate, - h : 'klukkustund', - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/it.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/it.js deleted file mode 100644 index 4875112f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/it.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : italian (it) -//! author : Lorenzo : https://github.com/aliem -//! author: Mattia Larentis: https://github.com/nostalgiaz - -import moment from '../moment'; - -export default moment.defineLocale('it', { - months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'), - monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), - weekdays : 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'), - weekdaysShort : 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'), - weekdaysMin : 'Do_Lu_Ma_Me_Gi_Ve_Sa'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Oggi alle] LT', - nextDay: '[Domani alle] LT', - nextWeek: 'dddd [alle] LT', - lastDay: '[Ieri alle] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[la scorsa] dddd [alle] LT'; - default: - return '[lo scorso] dddd [alle] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : function (s) { - return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s; - }, - past : '%s fa', - s : 'alcuni secondi', - m : 'un minuto', - mm : '%d minuti', - h : 'un\'ora', - hh : '%d ore', - d : 'un giorno', - dd : '%d giorni', - M : 'un mese', - MM : '%d mesi', - y : 'un anno', - yy : '%d anni' - }, - ordinalParse : /\d{1,2}º/, - ordinal: '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ja.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ja.js deleted file mode 100644 index 13944e46..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ja.js +++ /dev/null @@ -1,67 +0,0 @@ -//! moment.js locale configuration -//! locale : japanese (ja) -//! author : LI Long : https://github.com/baryon - -import moment from '../moment'; - -export default moment.defineLocale('ja', { - months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), - weekdaysShort : '日_月_火_水_木_金_土'.split('_'), - weekdaysMin : '日_月_火_水_木_金_土'.split('_'), - longDateFormat : { - LT : 'Ah時m分', - LTS : 'Ah時m分s秒', - L : 'YYYY/MM/DD', - LL : 'YYYY年M月D日', - LLL : 'YYYY年M月D日Ah時m分', - LLLL : 'YYYY年M月D日Ah時m分 dddd' - }, - meridiemParse: /午前|午後/i, - isPM : function (input) { - return input === '午後'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return '午前'; - } else { - return '午後'; - } - }, - calendar : { - sameDay : '[今日] LT', - nextDay : '[明日] LT', - nextWeek : '[来週]dddd LT', - lastDay : '[昨日] LT', - lastWeek : '[前週]dddd LT', - sameElse : 'L' - }, - ordinalParse : /\d{1,2}日/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - default: - return number; - } - }, - relativeTime : { - future : '%s後', - past : '%s前', - s : '数秒', - m : '1分', - mm : '%d分', - h : '1時間', - hh : '%d時間', - d : '1日', - dd : '%d日', - M : '1ヶ月', - MM : '%dヶ月', - y : '1年', - yy : '%d年' - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/jv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/jv.js deleted file mode 100644 index 8596944f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/jv.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : Boso Jowo (jv) -//! author : Rony Lantip : https://github.com/lantip -//! reference: http://jv.wikipedia.org/wiki/Basa_Jawa - -import moment from '../moment'; - -export default moment.defineLocale('jv', { - months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'), - monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), - weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), - weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), - weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /enjing|siyang|sonten|ndalu/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'enjing') { - return hour; - } else if (meridiem === 'siyang') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'sonten' || meridiem === 'ndalu') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'enjing'; - } else if (hours < 15) { - return 'siyang'; - } else if (hours < 19) { - return 'sonten'; - } else { - return 'ndalu'; - } - }, - calendar : { - sameDay : '[Dinten puniko pukul] LT', - nextDay : '[Mbenjang pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kala wingi pukul] LT', - lastWeek : 'dddd [kepengker pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'wonten ing %s', - past : '%s ingkang kepengker', - s : 'sawetawis detik', - m : 'setunggal menit', - mm : '%d menit', - h : 'setunggal jam', - hh : '%d jam', - d : 'sedinten', - dd : '%d dinten', - M : 'sewulan', - MM : '%d wulan', - y : 'setaun', - yy : '%d taun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ka.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ka.js deleted file mode 100644 index a540f30a..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ka.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : Georgian (ka) -//! author : Irakli Janiashvili : https://github.com/irakli-janiashvili - -import moment from '../moment'; - -export default moment.defineLocale('ka', { - months : { - standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), - format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_') - }, - monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), - weekdays : { - standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'), - format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'), - isFormat: /(წინა|შემდეგ)/ - }, - weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), - weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[დღეს] LT[-ზე]', - nextDay : '[ხვალ] LT[-ზე]', - lastDay : '[გუშინ] LT[-ზე]', - nextWeek : '[შემდეგ] dddd LT[-ზე]', - lastWeek : '[წინა] dddd LT-ზე', - sameElse : 'L' - }, - relativeTime : { - future : function (s) { - return (/(წამი|წუთი|საათი|წელი)/).test(s) ? - s.replace(/ი$/, 'ში') : - s + 'ში'; - }, - past : function (s) { - if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) { - return s.replace(/(ი|ე)$/, 'ის წინ'); - } - if ((/წელი/).test(s)) { - return s.replace(/წელი$/, 'წლის წინ'); - } - }, - s : 'რამდენიმე წამი', - m : 'წუთი', - mm : '%d წუთი', - h : 'საათი', - hh : '%d საათი', - d : 'დღე', - dd : '%d დღე', - M : 'თვე', - MM : '%d თვე', - y : 'წელი', - yy : '%d წელი' - }, - ordinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, - ordinal : function (number) { - if (number === 0) { - return number; - } - if (number === 1) { - return number + '-ლი'; - } - if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) { - return 'მე-' + number; - } - return number + '-ე'; - }, - week : { - dow : 1, - doy : 7 - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/kk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/kk.js deleted file mode 100644 index 85e7f9e3..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/kk.js +++ /dev/null @@ -1,77 +0,0 @@ -//! moment.js locale configuration -//! locale : kazakh (kk) -//! authors : Nurlan Rakhimzhanov : https://github.com/nurlan - -import moment from '../moment'; - -var suffixes = { - 0: '-ші', - 1: '-ші', - 2: '-ші', - 3: '-ші', - 4: '-ші', - 5: '-ші', - 6: '-шы', - 7: '-ші', - 8: '-ші', - 9: '-шы', - 10: '-шы', - 20: '-шы', - 30: '-шы', - 40: '-шы', - 50: '-ші', - 60: '-шы', - 70: '-ші', - 80: '-ші', - 90: '-шы', - 100: '-ші' -}; - -export default moment.defineLocale('kk', { - months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'), - monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), - weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'), - weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), - weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгін сағат] LT', - nextDay : '[Ертең сағат] LT', - nextWeek : 'dddd [сағат] LT', - lastDay : '[Кеше сағат] LT', - lastWeek : '[Өткен аптаның] dddd [сағат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ішінде', - past : '%s бұрын', - s : 'бірнеше секунд', - m : 'бір минут', - mm : '%d минут', - h : 'бір сағат', - hh : '%d сағат', - d : 'бір күн', - dd : '%d күн', - M : 'бір ай', - MM : '%d ай', - y : 'бір жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(ші|шы)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/km.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/km.js deleted file mode 100644 index c7cfbe81..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/km.js +++ /dev/null @@ -1,49 +0,0 @@ -//! moment.js locale configuration -//! locale : khmer (km) -//! author : Kruy Vanna : https://github.com/kruyvanna - -import moment from '../moment'; - -export default moment.defineLocale('km', { - months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split('_'), - weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysShort: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - weekdaysMin: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS : 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd, D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', - nextDay: '[ស្អែក ម៉ោង] LT', - nextWeek: 'dddd [ម៉ោង] LT', - lastDay: '[ម្សិលមិញ ម៉ោង] LT', - lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', - sameElse: 'L' - }, - relativeTime: { - future: '%sទៀត', - past: '%sមុន', - s: 'ប៉ុន្មានវិនាទី', - m: 'មួយនាទី', - mm: '%d នាទី', - h: 'មួយម៉ោង', - hh: '%d ម៉ោង', - d: 'មួយថ្ងៃ', - dd: '%d ថ្ងៃ', - M: 'មួយខែ', - MM: '%d ខែ', - y: 'មួយឆ្នាំ', - yy: '%d ឆ្នាំ' - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ko.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ko.js deleted file mode 100644 index c6b4a630..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ko.js +++ /dev/null @@ -1,59 +0,0 @@ -//! moment.js locale configuration -//! locale : korean (ko) -//! -//! authors -//! -//! - Kyungwook, Park : https://github.com/kyungw00k -//! - Jeeeyul Lee - -import moment from '../moment'; - -export default moment.defineLocale('ko', { - months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), - weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), - weekdaysShort : '일_월_화_수_목_금_토'.split('_'), - weekdaysMin : '일_월_화_수_목_금_토'.split('_'), - longDateFormat : { - LT : 'A h시 m분', - LTS : 'A h시 m분 s초', - L : 'YYYY.MM.DD', - LL : 'YYYY년 MMMM D일', - LLL : 'YYYY년 MMMM D일 A h시 m분', - LLLL : 'YYYY년 MMMM D일 dddd A h시 m분' - }, - calendar : { - sameDay : '오늘 LT', - nextDay : '내일 LT', - nextWeek : 'dddd LT', - lastDay : '어제 LT', - lastWeek : '지난주 dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s 후', - past : '%s 전', - s : '몇 초', - ss : '%d초', - m : '일분', - mm : '%d분', - h : '한 시간', - hh : '%d시간', - d : '하루', - dd : '%d일', - M : '한 달', - MM : '%d달', - y : '일 년', - yy : '%d년' - }, - ordinalParse : /\d{1,2}일/, - ordinal : '%d일', - meridiemParse : /오전|오후/, - isPM : function (token) { - return token === '오후'; - }, - meridiem : function (hour, minute, isUpper) { - return hour < 12 ? '오전' : '오후'; - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ky.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ky.js deleted file mode 100644 index 4ecb53ca..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ky.js +++ /dev/null @@ -1,78 +0,0 @@ -//! moment.js locale configuration -//! locale : kyrgyz (ky) -//! author : Chyngyz Arystan uulu : https://github.com/chyngyz - - -import moment from '../moment'; - -var suffixes = { - 0: '-чү', - 1: '-чи', - 2: '-чи', - 3: '-чү', - 4: '-чү', - 5: '-чи', - 6: '-чы', - 7: '-чи', - 8: '-чи', - 9: '-чу', - 10: '-чу', - 20: '-чы', - 30: '-чу', - 40: '-чы', - 50: '-чү', - 60: '-чы', - 70: '-чи', - 80: '-чи', - 90: '-чу', - 100: '-чү' -}; - -export default moment.defineLocale('ky', { - months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'), - monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'), - weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), - weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Бүгүн саат] LT', - nextDay : '[Эртең саат] LT', - nextWeek : 'dddd [саат] LT', - lastDay : '[Кече саат] LT', - lastWeek : '[Өткен аптанын] dddd [күнү] [саат] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ичинде', - past : '%s мурун', - s : 'бирнече секунд', - m : 'бир мүнөт', - mm : '%d мүнөт', - h : 'бир саат', - hh : '%d саат', - d : 'бир күн', - dd : '%d күн', - M : 'бир ай', - MM : '%d ай', - y : 'бир жыл', - yy : '%d жыл' - }, - ordinalParse: /\d{1,2}-(чи|чы|чү|чу)/, - ordinal : function (number) { - var a = number % 10, - b = number >= 100 ? 100 : null; - return number + (suffixes[number] || suffixes[a] || suffixes[b]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lb.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lb.js deleted file mode 100644 index 55676e79..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lb.js +++ /dev/null @@ -1,127 +0,0 @@ -//! moment.js locale configuration -//! locale : Luxembourgish (lb) -//! author : mweimerskirch : https://github.com/mweimerskirch, David Raison : https://github.com/kwisatz - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 'm': ['eng Minutt', 'enger Minutt'], - 'h': ['eng Stonn', 'enger Stonn'], - 'd': ['een Dag', 'engem Dag'], - 'M': ['ee Mount', 'engem Mount'], - 'y': ['ee Joer', 'engem Joer'] - }; - return withoutSuffix ? format[key][0] : format[key][1]; -} -function processFutureTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'a ' + string; - } - return 'an ' + string; -} -function processPastTime(string) { - var number = string.substr(0, string.indexOf(' ')); - if (eifelerRegelAppliesToNumber(number)) { - return 'viru ' + string; - } - return 'virun ' + string; -} -/** - * Returns true if the word before the given number loses the '-n' ending. - * e.g. 'an 10 Deeg' but 'a 5 Deeg' - * - * @param number {integer} - * @returns {boolean} - */ -function eifelerRegelAppliesToNumber(number) { - number = parseInt(number, 10); - if (isNaN(number)) { - return false; - } - if (number < 0) { - // Negative Number --> always true - return true; - } else if (number < 10) { - // Only 1 digit - if (4 <= number && number <= 7) { - return true; - } - return false; - } else if (number < 100) { - // 2 digits - var lastDigit = number % 10, firstDigit = number / 10; - if (lastDigit === 0) { - return eifelerRegelAppliesToNumber(firstDigit); - } - return eifelerRegelAppliesToNumber(lastDigit); - } else if (number < 10000) { - // 3 or 4 digits --> recursively check first digit - while (number >= 10) { - number = number / 10; - } - return eifelerRegelAppliesToNumber(number); - } else { - // Anything larger than 4 digits: recursively check first n-3 digits - number = number / 1000; - return eifelerRegelAppliesToNumber(number); - } -} - -export default moment.defineLocale('lb', { - months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), - monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'), - monthsParseExact : true, - weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'), - weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm [Auer]', - LTS: 'H:mm:ss [Auer]', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm [Auer]', - LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]' - }, - calendar: { - sameDay: '[Haut um] LT', - sameElse: 'L', - nextDay: '[Muer um] LT', - nextWeek: 'dddd [um] LT', - lastDay: '[Gëschter um] LT', - lastWeek: function () { - // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule - switch (this.day()) { - case 2: - case 4: - return '[Leschten] dddd [um] LT'; - default: - return '[Leschte] dddd [um] LT'; - } - } - }, - relativeTime : { - future : processFutureTime, - past : processPastTime, - s : 'e puer Sekonnen', - m : processRelativeTime, - mm : '%d Minutten', - h : processRelativeTime, - hh : '%d Stonnen', - d : processRelativeTime, - dd : '%d Deeg', - M : processRelativeTime, - MM : '%d Méint', - y : processRelativeTime, - yy : '%d Joer' - }, - ordinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lo.js deleted file mode 100644 index 34d74521..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lo.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : lao (lo) -//! author : Ryan Hart : https://github.com/ryanhart2 - -import moment from '../moment'; - -export default moment.defineLocale('lo', { - months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'), - weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), - weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'ວັນdddd D MMMM YYYY HH:mm' - }, - meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, - isPM: function (input) { - return input === 'ຕອນແລງ'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ຕອນເຊົ້າ'; - } else { - return 'ຕອນແລງ'; - } - }, - calendar : { - sameDay : '[ມື້ນີ້ເວລາ] LT', - nextDay : '[ມື້ອື່ນເວລາ] LT', - nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT', - lastDay : '[ມື້ວານນີ້ເວລາ] LT', - lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'ອີກ %s', - past : '%sຜ່ານມາ', - s : 'ບໍ່ເທົ່າໃດວິນາທີ', - m : '1 ນາທີ', - mm : '%d ນາທີ', - h : '1 ຊົ່ວໂມງ', - hh : '%d ຊົ່ວໂມງ', - d : '1 ມື້', - dd : '%d ມື້', - M : '1 ເດືອນ', - MM : '%d ເດືອນ', - y : '1 ປີ', - yy : '%d ປີ' - }, - ordinalParse: /(ທີ່)\d{1,2}/, - ordinal : function (number) { - return 'ທີ່' + number; - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lt.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lt.js deleted file mode 100644 index b2900db2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lt.js +++ /dev/null @@ -1,107 +0,0 @@ -//! moment.js locale configuration -//! locale : Lithuanian (lt) -//! author : Mindaugas Mozūras : https://github.com/mmozuras - -import moment from '../moment'; - -var units = { - 'm' : 'minutė_minutės_minutę', - 'mm': 'minutės_minučių_minutes', - 'h' : 'valanda_valandos_valandą', - 'hh': 'valandos_valandų_valandas', - 'd' : 'diena_dienos_dieną', - 'dd': 'dienos_dienų_dienas', - 'M' : 'mėnuo_mėnesio_mėnesį', - 'MM': 'mėnesiai_mėnesių_mėnesius', - 'y' : 'metai_metų_metus', - 'yy': 'metai_metų_metus' -}; -function translateSeconds(number, withoutSuffix, key, isFuture) { - if (withoutSuffix) { - return 'kelios sekundės'; - } else { - return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; - } -} -function translateSingular(number, withoutSuffix, key, isFuture) { - return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]); -} -function special(number) { - return number % 10 === 0 || (number > 10 && number < 20); -} -function forms(key) { - return units[key].split('_'); -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - if (number === 1) { - return result + translateSingular(number, withoutSuffix, key[0], isFuture); - } else if (withoutSuffix) { - return result + (special(number) ? forms(key)[1] : forms(key)[0]); - } else { - if (isFuture) { - return result + forms(key)[1]; - } else { - return result + (special(number) ? forms(key)[1] : forms(key)[2]); - } - } -} -export default moment.defineLocale('lt', { - months : { - format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'), - standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_') - }, - monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), - weekdays : { - format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'), - standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), - isFormat: /dddd HH:mm/ - }, - weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), - weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'YYYY [m.] MMMM D [d.]', - LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', - l : 'YYYY-MM-DD', - ll : 'YYYY [m.] MMMM D [d.]', - lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]', - llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]' - }, - calendar : { - sameDay : '[Šiandien] LT', - nextDay : '[Rytoj] LT', - nextWeek : 'dddd LT', - lastDay : '[Vakar] LT', - lastWeek : '[Praėjusį] dddd LT', - sameElse : 'L' - }, - relativeTime : { - future : 'po %s', - past : 'prieš %s', - s : translateSeconds, - m : translateSingular, - mm : translate, - h : translateSingular, - hh : translate, - d : translateSingular, - dd : translate, - M : translateSingular, - MM : translate, - y : translateSingular, - yy : translate - }, - ordinalParse: /\d{1,2}-oji/, - ordinal : function (number) { - return number + '-oji'; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lv.js deleted file mode 100644 index 1ff0817b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/lv.js +++ /dev/null @@ -1,88 +0,0 @@ -//! moment.js locale configuration -//! locale : latvian (lv) -//! author : Kristaps Karlsons : https://github.com/skakri -//! author : Jānis Elmeris : https://github.com/JanisE - -import moment from '../moment'; - -var units = { - 'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'), - 'h': 'stundas_stundām_stunda_stundas'.split('_'), - 'hh': 'stundas_stundām_stunda_stundas'.split('_'), - 'd': 'dienas_dienām_diena_dienas'.split('_'), - 'dd': 'dienas_dienām_diena_dienas'.split('_'), - 'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), - 'y': 'gada_gadiem_gads_gadi'.split('_'), - 'yy': 'gada_gadiem_gads_gadi'.split('_') -}; -/** - * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. - */ -function format(forms, number, withoutSuffix) { - if (withoutSuffix) { - // E.g. "21 minūte", "3 minūtes". - return number % 10 === 1 && number !== 11 ? forms[2] : forms[3]; - } else { - // E.g. "21 minūtes" as in "pēc 21 minūtes". - // E.g. "3 minūtēm" as in "pēc 3 minūtēm". - return number % 10 === 1 && number !== 11 ? forms[0] : forms[1]; - } -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - return number + ' ' + format(units[key], number, withoutSuffix); -} -function relativeTimeWithSingular(number, withoutSuffix, key) { - return format(units[key], number, withoutSuffix); -} -function relativeSeconds(number, withoutSuffix) { - return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; -} - -export default moment.defineLocale('lv', { - months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'), - weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY.', - LL : 'YYYY. [gada] D. MMMM', - LLL : 'YYYY. [gada] D. MMMM, HH:mm', - LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm' - }, - calendar : { - sameDay : '[Šodien pulksten] LT', - nextDay : '[Rīt pulksten] LT', - nextWeek : 'dddd [pulksten] LT', - lastDay : '[Vakar pulksten] LT', - lastWeek : '[Pagājušā] dddd [pulksten] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'pēc %s', - past : 'pirms %s', - s : relativeSeconds, - m : relativeTimeWithSingular, - mm : relativeTimeWithPlural, - h : relativeTimeWithSingular, - hh : relativeTimeWithPlural, - d : relativeTimeWithSingular, - dd : relativeTimeWithPlural, - M : relativeTimeWithSingular, - MM : relativeTimeWithPlural, - y : relativeTimeWithSingular, - yy : relativeTimeWithPlural - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/me.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/me.js deleted file mode 100644 index 41e59599..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/me.js +++ /dev/null @@ -1,101 +0,0 @@ -//! moment.js locale configuration -//! locale : Montenegrin (me) -//! author : Miodrag Nikač : https://github.com/miodragnikac - -import moment from '../moment'; - -var translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jednog minuta'], - mm: ['minut', 'minuta', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mjesec', 'mjeseca', 'mjeseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } -}; - -export default moment.defineLocale('me', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact : true, - weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sjutra u] LT', - - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedjelju] [u] LT'; - case 3: - return '[u] [srijedu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedjelje] [u] LT', - '[prošlog] [ponedjeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srijede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'prije %s', - s : 'nekoliko sekundi', - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mjesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mk.js deleted file mode 100644 index ce820e60..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mk.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : macedonian (mk) -//! author : Borislav Mickov : https://github.com/B0k0 - -import moment from '../moment'; - -export default moment.defineLocale('mk', { - months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'), - monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), - weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'), - weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'), - weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'D.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[Денес во] LT', - nextDay : '[Утре во] LT', - nextWeek : '[Во] dddd [во] LT', - lastDay : '[Вчера во] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - case 3: - case 6: - return '[Изминатата] dddd [во] LT'; - case 1: - case 2: - case 4: - case 5: - return '[Изминатиот] dddd [во] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'после %s', - past : 'пред %s', - s : 'неколку секунди', - m : 'минута', - mm : '%d минути', - h : 'час', - hh : '%d часа', - d : 'ден', - dd : '%d дена', - M : 'месец', - MM : '%d месеци', - y : 'година', - yy : '%d години' - }, - ordinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, - ordinal : function (number) { - var lastDigit = number % 10, - last2Digits = number % 100; - if (number === 0) { - return number + '-ев'; - } else if (last2Digits === 0) { - return number + '-ен'; - } else if (last2Digits > 10 && last2Digits < 20) { - return number + '-ти'; - } else if (lastDigit === 1) { - return number + '-ви'; - } else if (lastDigit === 2) { - return number + '-ри'; - } else if (lastDigit === 7 || lastDigit === 8) { - return number + '-ми'; - } else { - return number + '-ти'; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ml.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ml.js deleted file mode 100644 index 17db1206..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ml.js +++ /dev/null @@ -1,72 +0,0 @@ -//! moment.js locale configuration -//! locale : malayalam (ml) -//! author : Floyd Pink : https://github.com/floydpink - -import moment from '../moment'; - -export default moment.defineLocale('ml', { - months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'), - monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'), - monthsParseExact : true, - weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'), - weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), - weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), - longDateFormat : { - LT : 'A h:mm -നു', - LTS : 'A h:mm:ss -നു', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm -നു', - LLLL : 'dddd, D MMMM YYYY, A h:mm -നു' - }, - calendar : { - sameDay : '[ഇന്ന്] LT', - nextDay : '[നാളെ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ഇന്നലെ] LT', - lastWeek : '[കഴിഞ്ഞ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s കഴിഞ്ഞ്', - past : '%s മുൻപ്', - s : 'അൽപ നിമിഷങ്ങൾ', - m : 'ഒരു മിനിറ്റ്', - mm : '%d മിനിറ്റ്', - h : 'ഒരു മണിക്കൂർ', - hh : '%d മണിക്കൂർ', - d : 'ഒരു ദിവസം', - dd : '%d ദിവസം', - M : 'ഒരു മാസം', - MM : '%d മാസം', - y : 'ഒരു വർഷം', - yy : '%d വർഷം' - }, - meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if ((meridiem === 'രാത്രി' && hour >= 4) || - meridiem === 'ഉച്ച കഴിഞ്ഞ്' || - meridiem === 'വൈകുന്നേരം') { - return hour + 12; - } else { - return hour; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'രാത്രി'; - } else if (hour < 12) { - return 'രാവിലെ'; - } else if (hour < 17) { - return 'ഉച്ച കഴിഞ്ഞ്'; - } else if (hour < 20) { - return 'വൈകുന്നേരം'; - } else { - return 'രാത്രി'; - } - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mr.js deleted file mode 100644 index 8701c1db..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/mr.js +++ /dev/null @@ -1,150 +0,0 @@ -//! moment.js locale configuration -//! locale : Marathi (mr) -//! author : Harshad Kale : https://github.com/kalehv -//! author : Vivek Athalye : https://github.com/vnathalye - -import moment from '../moment'; - -var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' -}, -numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' -}; - -function relativeTimeMr(number, withoutSuffix, string, isFuture) -{ - var output = ''; - if (withoutSuffix) { - switch (string) { - case 's': output = 'काही सेकंद'; break; - case 'm': output = 'एक मिनिट'; break; - case 'mm': output = '%d मिनिटे'; break; - case 'h': output = 'एक तास'; break; - case 'hh': output = '%d तास'; break; - case 'd': output = 'एक दिवस'; break; - case 'dd': output = '%d दिवस'; break; - case 'M': output = 'एक महिना'; break; - case 'MM': output = '%d महिने'; break; - case 'y': output = 'एक वर्ष'; break; - case 'yy': output = '%d वर्षे'; break; - } - } - else { - switch (string) { - case 's': output = 'काही सेकंदां'; break; - case 'm': output = 'एका मिनिटा'; break; - case 'mm': output = '%d मिनिटां'; break; - case 'h': output = 'एका तासा'; break; - case 'hh': output = '%d तासां'; break; - case 'd': output = 'एका दिवसा'; break; - case 'dd': output = '%d दिवसां'; break; - case 'M': output = 'एका महिन्या'; break; - case 'MM': output = '%d महिन्यां'; break; - case 'y': output = 'एका वर्षा'; break; - case 'yy': output = '%d वर्षां'; break; - } - } - return output.replace(/%d/i, number); -} - -export default moment.defineLocale('mr', { - months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'), - monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'), - monthsParseExact : true, - weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), - weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), - weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'), - longDateFormat : { - LT : 'A h:mm वाजता', - LTS : 'A h:mm:ss वाजता', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm वाजता', - LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता' - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[उद्या] LT', - nextWeek : 'dddd, LT', - lastDay : '[काल] LT', - lastWeek: '[मागील] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future: '%sमध्ये', - past: '%sपूर्वी', - s: relativeTimeMr, - m: relativeTimeMr, - mm: relativeTimeMr, - h: relativeTimeMr, - hh: relativeTimeMr, - d: relativeTimeMr, - dd: relativeTimeMr, - M: relativeTimeMr, - MM: relativeTimeMr, - y: relativeTimeMr, - yy: relativeTimeMr - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'रात्री') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'सकाळी') { - return hour; - } else if (meridiem === 'दुपारी') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'सायंकाळी') { - return hour + 12; - } - }, - meridiem: function (hour, minute, isLower) { - if (hour < 4) { - return 'रात्री'; - } else if (hour < 10) { - return 'सकाळी'; - } else if (hour < 17) { - return 'दुपारी'; - } else if (hour < 20) { - return 'सायंकाळी'; - } else { - return 'रात्री'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms-my.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms-my.js deleted file mode 100644 index 1490a1ff..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms-my.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : Bahasa Malaysia (ms-MY) -//! author : Weldan Jamili : https://github.com/weldan - -import moment from '../moment'; - -export default moment.defineLocale('ms-my', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms.js deleted file mode 100644 index 59fb9a27..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ms.js +++ /dev/null @@ -1,73 +0,0 @@ -//! moment.js locale configuration -//! locale : Bahasa Malaysia (ms-MY) -//! author : Weldan Jamili : https://github.com/weldan - -import moment from '../moment'; - -export default moment.defineLocale('ms', { - months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), - weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), - weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), - weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [pukul] HH.mm', - LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm' - }, - meridiemParse: /pagi|tengahari|petang|malam/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'pagi') { - return hour; - } else if (meridiem === 'tengahari') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'petang' || meridiem === 'malam') { - return hour + 12; - } - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'pagi'; - } else if (hours < 15) { - return 'tengahari'; - } else if (hours < 19) { - return 'petang'; - } else { - return 'malam'; - } - }, - calendar : { - sameDay : '[Hari ini pukul] LT', - nextDay : '[Esok pukul] LT', - nextWeek : 'dddd [pukul] LT', - lastDay : '[Kelmarin pukul] LT', - lastWeek : 'dddd [lepas pukul] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'dalam %s', - past : '%s yang lepas', - s : 'beberapa saat', - m : 'seminit', - mm : '%d minit', - h : 'sejam', - hh : '%d jam', - d : 'sehari', - dd : '%d hari', - M : 'sebulan', - MM : '%d bulan', - y : 'setahun', - yy : '%d tahun' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/my.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/my.js deleted file mode 100644 index d9dff819..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/my.js +++ /dev/null @@ -1,84 +0,0 @@ -//! moment.js locale configuration -//! locale : Burmese (my) -//! author : Squar team, mysquar.com - -import moment from '../moment'; - -var symbolMap = { - '1': '၁', - '2': '၂', - '3': '၃', - '4': '၄', - '5': '၅', - '6': '၆', - '7': '၇', - '8': '၈', - '9': '၉', - '0': '၀' -}, numberMap = { - '၁': '1', - '၂': '2', - '၃': '3', - '၄': '4', - '၅': '5', - '၆': '6', - '၇': '7', - '၈': '8', - '၉': '9', - '၀': '0' -}; - -export default moment.defineLocale('my', { - months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'), - monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), - weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'), - weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), - - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' - }, - calendar: { - sameDay: '[ယနေ.] LT [မှာ]', - nextDay: '[မနက်ဖြန်] LT [မှာ]', - nextWeek: 'dddd LT [မှာ]', - lastDay: '[မနေ.က] LT [မှာ]', - lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', - sameElse: 'L' - }, - relativeTime: { - future: 'လာမည့် %s မှာ', - past: 'လွန်ခဲ့သော %s က', - s: 'စက္ကန်.အနည်းငယ်', - m: 'တစ်မိနစ်', - mm: '%d မိနစ်', - h: 'တစ်နာရီ', - hh: '%d နာရီ', - d: 'တစ်ရက်', - dd: '%d ရက်', - M: 'တစ်လ', - MM: '%d လ', - y: 'တစ်နှစ်', - yy: '%d နှစ်' - }, - preparse: function (string) { - return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nb.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nb.js deleted file mode 100644 index f0215a08..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nb.js +++ /dev/null @@ -1,54 +0,0 @@ -//! moment.js locale configuration -//! locale : norwegian bokmål (nb) -//! authors : Espen Hovlandsdal : https://github.com/rexxars -//! Sigurd Gartmann : https://github.com/sigurdga - -import moment from '../moment'; - -export default moment.defineLocale('nb', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact : true, - weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s siden', - s : 'noen sekunder', - m : 'ett minutt', - mm : '%d minutter', - h : 'en time', - hh : '%d timer', - d : 'en dag', - dd : '%d dager', - M : 'en måned', - MM : '%d måneder', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ne.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ne.js deleted file mode 100644 index 76dd1a23..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ne.js +++ /dev/null @@ -1,114 +0,0 @@ -//! moment.js locale configuration -//! locale : nepali/nepalese -//! author : suvash : https://github.com/suvash - -import moment from '../moment'; - -var symbolMap = { - '1': '१', - '2': '२', - '3': '३', - '4': '४', - '5': '५', - '6': '६', - '7': '७', - '8': '८', - '9': '९', - '0': '०' -}, -numberMap = { - '१': '1', - '२': '2', - '३': '3', - '४': '4', - '५': '5', - '६': '6', - '७': '7', - '८': '8', - '९': '9', - '०': '0' -}; - -export default moment.defineLocale('ne', { - months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), - monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), - monthsParseExact : true, - weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), - weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), - weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'Aको h:mm बजे', - LTS : 'Aको h:mm:ss बजे', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, Aको h:mm बजे', - LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे' - }, - preparse: function (string) { - return string.replace(/[१२३४५६७८९०]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - meridiemParse: /राति|बिहान|दिउँसो|साँझ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'राति') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'बिहान') { - return hour; - } else if (meridiem === 'दिउँसो') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'साँझ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 3) { - return 'राति'; - } else if (hour < 12) { - return 'बिहान'; - } else if (hour < 16) { - return 'दिउँसो'; - } else if (hour < 20) { - return 'साँझ'; - } else { - return 'राति'; - } - }, - calendar : { - sameDay : '[आज] LT', - nextDay : '[भोलि] LT', - nextWeek : '[आउँदो] dddd[,] LT', - lastDay : '[हिजो] LT', - lastWeek : '[गएको] dddd[,] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%sमा', - past : '%s अगाडि', - s : 'केही क्षण', - m : 'एक मिनेट', - mm : '%d मिनेट', - h : 'एक घण्टा', - hh : '%d घण्टा', - d : 'एक दिन', - dd : '%d दिन', - M : 'एक महिना', - MM : '%d महिना', - y : 'एक बर्ष', - yy : '%d बर्ष' - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nl.js deleted file mode 100644 index 1c6be4da..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nl.js +++ /dev/null @@ -1,64 +0,0 @@ -//! moment.js locale configuration -//! locale : dutch (nl) -//! author : Joris Röling : https://github.com/jjupiter - -import moment from '../moment'; - -var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), - monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'); - -export default moment.defineLocale('nl', { - months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), - monthsShort : function (m, format) { - if (/-MMM-/.test(format)) { - return monthsShortWithoutDots[m.month()]; - } else { - return monthsShortWithDots[m.month()]; - } - }, - monthsParseExact : true, - weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), - weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'), - weekdaysMin : 'Zo_Ma_Di_Wo_Do_Vr_Za'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD-MM-YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[vandaag om] LT', - nextDay: '[morgen om] LT', - nextWeek: 'dddd [om] LT', - lastDay: '[gisteren om] LT', - lastWeek: '[afgelopen] dddd [om] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'over %s', - past : '%s geleden', - s : 'een paar seconden', - m : 'één minuut', - mm : '%d minuten', - h : 'één uur', - hh : '%d uur', - d : 'één dag', - dd : '%d dagen', - M : 'één maand', - MM : '%d maanden', - y : 'één jaar', - yy : '%d jaar' - }, - ordinalParse: /\d{1,2}(ste|de)/, - ordinal : function (number) { - return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nn.js deleted file mode 100644 index f341cb41..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/nn.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : norwegian nynorsk (nn) -//! author : https://github.com/mechuwind - -import moment from '../moment'; - -export default moment.defineLocale('nn', { - months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'), - monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), - weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'), - weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY [kl.] H:mm', - LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm' - }, - calendar : { - sameDay: '[I dag klokka] LT', - nextDay: '[I morgon klokka] LT', - nextWeek: 'dddd [klokka] LT', - lastDay: '[I går klokka] LT', - lastWeek: '[Føregåande] dddd [klokka] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : '%s sidan', - s : 'nokre sekund', - m : 'eit minutt', - mm : '%d minutt', - h : 'ein time', - hh : '%d timar', - d : 'ein dag', - dd : '%d dagar', - M : 'ein månad', - MM : '%d månader', - y : 'eit år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pa-in.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pa-in.js deleted file mode 100644 index 5f2721ae..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pa-in.js +++ /dev/null @@ -1,115 +0,0 @@ -//! moment.js locale configuration -//! locale : punjabi india (pa-in) -//! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit - -import moment from '../moment'; - -var symbolMap = { - '1': '੧', - '2': '੨', - '3': '੩', - '4': '੪', - '5': '੫', - '6': '੬', - '7': '੭', - '8': '੮', - '9': '੯', - '0': '੦' -}, -numberMap = { - '੧': '1', - '੨': '2', - '੩': '3', - '੪': '4', - '੫': '5', - '੬': '6', - '੭': '7', - '੮': '8', - '੯': '9', - '੦': '0' -}; - -export default moment.defineLocale('pa-in', { - // There are months name as per Nanakshahi Calender but they are not used as rigidly in modern Punjabi. - months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'), - weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'), - weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), - longDateFormat : { - LT : 'A h:mm ਵਜੇ', - LTS : 'A h:mm:ss ਵਜੇ', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm ਵਜੇ', - LLLL : 'dddd, D MMMM YYYY, A h:mm ਵਜੇ' - }, - calendar : { - sameDay : '[ਅਜ] LT', - nextDay : '[ਕਲ] LT', - nextWeek : 'dddd, LT', - lastDay : '[ਕਲ] LT', - lastWeek : '[ਪਿਛਲੇ] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s ਵਿੱਚ', - past : '%s ਪਿਛਲੇ', - s : 'ਕੁਝ ਸਕਿੰਟ', - m : 'ਇਕ ਮਿੰਟ', - mm : '%d ਮਿੰਟ', - h : 'ਇੱਕ ਘੰਟਾ', - hh : '%d ਘੰਟੇ', - d : 'ਇੱਕ ਦਿਨ', - dd : '%d ਦਿਨ', - M : 'ਇੱਕ ਮਹੀਨਾ', - MM : '%d ਮਹੀਨੇ', - y : 'ਇੱਕ ਸਾਲ', - yy : '%d ਸਾਲ' - }, - preparse: function (string) { - return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // Punjabi notation for meridiems are quite fuzzy in practice. While there exists - // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. - meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ਰਾਤ') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ਸਵੇਰ') { - return hour; - } else if (meridiem === 'ਦੁਪਹਿਰ') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'ਸ਼ਾਮ') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ਰਾਤ'; - } else if (hour < 10) { - return 'ਸਵੇਰ'; - } else if (hour < 17) { - return 'ਦੁਪਹਿਰ'; - } else if (hour < 20) { - return 'ਸ਼ਾਮ'; - } else { - return 'ਰਾਤ'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pl.js deleted file mode 100644 index fde1bb2e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pl.js +++ /dev/null @@ -1,95 +0,0 @@ -//! moment.js locale configuration -//! locale : polish (pl) -//! author : Rafal Hirsz : https://github.com/evoL - -import moment from '../moment'; - -var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'), - monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_'); -function plural(n) { - return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1); -} -function translate(number, withoutSuffix, key) { - var result = number + ' '; - switch (key) { - case 'm': - return withoutSuffix ? 'minuta' : 'minutę'; - case 'mm': - return result + (plural(number) ? 'minuty' : 'minut'); - case 'h': - return withoutSuffix ? 'godzina' : 'godzinę'; - case 'hh': - return result + (plural(number) ? 'godziny' : 'godzin'); - case 'MM': - return result + (plural(number) ? 'miesiące' : 'miesięcy'); - case 'yy': - return result + (plural(number) ? 'lata' : 'lat'); - } -} - -export default moment.defineLocale('pl', { - months : function (momentToFormat, format) { - if (format === '') { - // Hack: if format empty we know this is used to generate - // RegExp by moment. Give then back both valid forms of months - // in RegExp ready format. - return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')'; - } else if (/D MMMM/.test(format)) { - return monthsSubjective[momentToFormat.month()]; - } else { - return monthsNominative[momentToFormat.month()]; - } - }, - monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), - weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), - weekdaysShort : 'nie_pon_wt_śr_czw_pt_sb'.split('_'), - weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Dziś o] LT', - nextDay: '[Jutro o] LT', - nextWeek: '[W] dddd [o] LT', - lastDay: '[Wczoraj o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[W zeszłą niedzielę o] LT'; - case 3: - return '[W zeszłą środę o] LT'; - case 6: - return '[W zeszłą sobotę o] LT'; - default: - return '[W zeszły] dddd [o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : '%s temu', - s : 'kilka sekund', - m : translate, - mm : translate, - h : translate, - hh : translate, - d : '1 dzień', - dd : '%d dni', - M : 'miesiąc', - MM : translate, - y : 'rok', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt-br.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt-br.js deleted file mode 100644 index 50748fb0..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt-br.js +++ /dev/null @@ -1,52 +0,0 @@ -//! moment.js locale configuration -//! locale : brazilian portuguese (pt-br) -//! author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira - -import moment from '../moment'; - -export default moment.defineLocale('pt-br', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY [às] HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : '%s atrás', - s : 'poucos segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº' -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt.js deleted file mode 100644 index db3ba648..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/pt.js +++ /dev/null @@ -1,56 +0,0 @@ -//! moment.js locale configuration -//! locale : portuguese (pt) -//! author : Jefferson : https://github.com/jalex79 - -import moment from '../moment'; - -export default moment.defineLocale('pt', { - months : 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), - monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), - weekdays : 'Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado'.split('_'), - weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), - weekdaysMin : 'Dom_2ª_3ª_4ª_5ª_6ª_Sáb'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D [de] MMMM [de] YYYY', - LLL : 'D [de] MMMM [de] YYYY HH:mm', - LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm' - }, - calendar : { - sameDay: '[Hoje às] LT', - nextDay: '[Amanhã às] LT', - nextWeek: 'dddd [às] LT', - lastDay: '[Ontem às] LT', - lastWeek: function () { - return (this.day() === 0 || this.day() === 6) ? - '[Último] dddd [às] LT' : // Saturday + Sunday - '[Última] dddd [às] LT'; // Monday - Friday - }, - sameElse: 'L' - }, - relativeTime : { - future : 'em %s', - past : 'há %s', - s : 'segundos', - m : 'um minuto', - mm : '%d minutos', - h : 'uma hora', - hh : '%d horas', - d : 'um dia', - dd : '%d dias', - M : 'um mês', - MM : '%d meses', - y : 'um ano', - yy : '%d anos' - }, - ordinalParse: /\d{1,2}º/, - ordinal : '%dº', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ro.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ro.js deleted file mode 100644 index 1f26ac90..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ro.js +++ /dev/null @@ -1,66 +0,0 @@ -//! moment.js locale configuration -//! locale : romanian (ro) -//! author : Vlad Gurdiga : https://github.com/gurdiga -//! author : Valentin Agachi : https://github.com/avaly - -import moment from '../moment'; - -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': 'minute', - 'hh': 'ore', - 'dd': 'zile', - 'MM': 'luni', - 'yy': 'ani' - }, - separator = ' '; - if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { - separator = ' de '; - } - return number + separator + format[key]; -} - -export default moment.defineLocale('ro', { - months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), - monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), - weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), - weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY H:mm', - LLLL : 'dddd, D MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[azi la] LT', - nextDay: '[mâine la] LT', - nextWeek: 'dddd [la] LT', - lastDay: '[ieri la] LT', - lastWeek: '[fosta] dddd [la] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'peste %s', - past : '%s în urmă', - s : 'câteva secunde', - m : 'un minut', - mm : relativeTimeWithPlural, - h : 'o oră', - hh : relativeTimeWithPlural, - d : 'o zi', - dd : relativeTimeWithPlural, - M : 'o lună', - MM : relativeTimeWithPlural, - y : 'un an', - yy : relativeTimeWithPlural - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ru.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ru.js deleted file mode 100644 index 758d72b5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ru.js +++ /dev/null @@ -1,165 +0,0 @@ -//! moment.js locale configuration -//! locale : russian (ru) -//! author : Viktorminator : https://github.com/Viktorminator -//! Author : Menelion Elensúle : https://github.com/Oire -//! author : Коренберг Марк : https://github.com/socketpair - -import moment from '../moment'; - -function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', - 'hh': 'час_часа_часов', - 'dd': 'день_дня_дней', - 'MM': 'месяц_месяца_месяцев', - 'yy': 'год_года_лет' - }; - if (key === 'm') { - return withoutSuffix ? 'минута' : 'минуту'; - } - else { - return number + ' ' + plural(format[key], +number); - } -} -var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i]; - -// http://new.gramota.ru/spravka/rules/139-prop : § 103 -// Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 -// CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 -export default moment.defineLocale('ru', { - months : { - format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'), - standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_') - }, - monthsShort : { - // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ? - format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'), - standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_') - }, - weekdays : { - standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'), - format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'), - isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/ - }, - weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'), - monthsParse : monthsParse, - longMonthsParse : monthsParse, - shortMonthsParse : monthsParse, - monthsRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|сент\.|февр\.|нояб\.|июнь|янв.|июль|дек.|авг.|апр.|марта|мар[.т]|окт.|июн[яь]|июл[яь]|ма[яй])/i, - monthsStrictRegex: /^(сентябр[яь]|октябр[яь]|декабр[яь]|феврал[яь]|январ[яь]|апрел[яь]|августа?|ноябр[яь]|марта?|июн[яь]|июл[яь]|ма[яй])/i, - monthsShortStrictRegex: /^(нояб\.|февр\.|сент\.|июль|янв\.|июн[яь]|мар[.т]|авг\.|апр\.|окт\.|дек\.|ма[яй])/i, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY г.', - LLL : 'D MMMM YYYY г., HH:mm', - LLLL : 'dddd, D MMMM YYYY г., HH:mm' - }, - calendar : { - sameDay: '[Сегодня в] LT', - nextDay: '[Завтра в] LT', - lastDay: '[Вчера в] LT', - nextWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В следующее] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В следующий] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В следующую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - lastWeek: function (now) { - if (now.week() !== this.week()) { - switch (this.day()) { - case 0: - return '[В прошлое] dddd [в] LT'; - case 1: - case 2: - case 4: - return '[В прошлый] dddd [в] LT'; - case 3: - case 5: - case 6: - return '[В прошлую] dddd [в] LT'; - } - } else { - if (this.day() === 2) { - return '[Во] dddd [в] LT'; - } else { - return '[В] dddd [в] LT'; - } - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'через %s', - past : '%s назад', - s : 'несколько секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'час', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'месяц', - MM : relativeTimeWithPlural, - y : 'год', - yy : relativeTimeWithPlural - }, - meridiemParse: /ночи|утра|дня|вечера/i, - isPM : function (input) { - return /^(дня|вечера)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночи'; - } else if (hour < 12) { - return 'утра'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечера'; - } - }, - ordinalParse: /\d{1,2}-(й|го|я)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - return number + '-й'; - case 'D': - return number + '-го'; - case 'w': - case 'W': - return number + '-я'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/se.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/se.js deleted file mode 100644 index e7206397..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/se.js +++ /dev/null @@ -1,51 +0,0 @@ -//! moment.js locale configuration -//! locale : Northern Sami (se) -//! authors : Bård Rolstad Henriksen : https://github.com/karamell - - -import moment from '../moment'; - -export default moment.defineLocale('se', { - months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'), - monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'), - weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'), - weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), - weekdaysMin : 's_v_m_g_d_b_L'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'MMMM D. [b.] YYYY', - LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm', - LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm' - }, - calendar : { - sameDay: '[otne ti] LT', - nextDay: '[ihttin ti] LT', - nextWeek: 'dddd [ti] LT', - lastDay: '[ikte ti] LT', - lastWeek: '[ovddit] dddd [ti] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s geažes', - past : 'maŋit %s', - s : 'moadde sekunddat', - m : 'okta minuhta', - mm : '%d minuhtat', - h : 'okta diimmu', - hh : '%d diimmut', - d : 'okta beaivi', - dd : '%d beaivvit', - M : 'okta mánnu', - MM : '%d mánut', - y : 'okta jahki', - yy : '%d jagit' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/si.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/si.js deleted file mode 100644 index 10c728fa..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/si.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : Sinhalese (si) -//! author : Sampath Sitinamaluwa : https://github.com/sampathsris - -import moment from '../moment'; - -/*jshint -W100*/ -export default moment.defineLocale('si', { - months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'), - monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'), - weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'), - weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), - weekdaysMin : 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'a h:mm', - LTS : 'a h:mm:ss', - L : 'YYYY/MM/DD', - LL : 'YYYY MMMM D', - LLL : 'YYYY MMMM D, a h:mm', - LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss' - }, - calendar : { - sameDay : '[අද] LT[ට]', - nextDay : '[හෙට] LT[ට]', - nextWeek : 'dddd LT[ට]', - lastDay : '[ඊයේ] LT[ට]', - lastWeek : '[පසුගිය] dddd LT[ට]', - sameElse : 'L' - }, - relativeTime : { - future : '%sකින්', - past : '%sකට පෙර', - s : 'තත්පර කිහිපය', - m : 'මිනිත්තුව', - mm : 'මිනිත්තු %d', - h : 'පැය', - hh : 'පැය %d', - d : 'දිනය', - dd : 'දින %d', - M : 'මාසය', - MM : 'මාස %d', - y : 'වසර', - yy : 'වසර %d' - }, - ordinalParse: /\d{1,2} වැනි/, - ordinal : function (number) { - return number + ' වැනි'; - }, - meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, - isPM : function (input) { - return input === 'ප.ව.' || input === 'පස් වරු'; - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'ප.ව.' : 'පස් වරු'; - } else { - return isLower ? 'පෙ.ව.' : 'පෙර වරු'; - } - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sk.js deleted file mode 100644 index dbc73bec..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sk.js +++ /dev/null @@ -1,141 +0,0 @@ -//! moment.js locale configuration -//! locale : slovak (sk) -//! author : Martin Minka : https://github.com/k2s -//! based on work of petrbela : https://github.com/petrbela - -import moment from '../moment'; - -var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), - monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); -function plural(n) { - return (n > 1) && (n < 5); -} -function translate(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': // a few seconds / in a few seconds / a few seconds ago - return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'; - case 'm': // a minute / in a minute / a minute ago - return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou'); - case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'minúty' : 'minút'); - } else { - return result + 'minútami'; - } - break; - case 'h': // an hour / in an hour / an hour ago - return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou'); - case 'hh': // 9 hours / in 9 hours / 9 hours ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'hodiny' : 'hodín'); - } else { - return result + 'hodinami'; - } - break; - case 'd': // a day / in a day / a day ago - return (withoutSuffix || isFuture) ? 'deň' : 'dňom'; - case 'dd': // 9 days / in 9 days / 9 days ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'dni' : 'dní'); - } else { - return result + 'dňami'; - } - break; - case 'M': // a month / in a month / a month ago - return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'; - case 'MM': // 9 months / in 9 months / 9 months ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'mesiace' : 'mesiacov'); - } else { - return result + 'mesiacmi'; - } - break; - case 'y': // a year / in a year / a year ago - return (withoutSuffix || isFuture) ? 'rok' : 'rokom'; - case 'yy': // 9 years / in 9 years / 9 years ago - if (withoutSuffix || isFuture) { - return result + (plural(number) ? 'roky' : 'rokov'); - } else { - return result + 'rokmi'; - } - break; - } -} - -export default moment.defineLocale('sk', { - months : months, - monthsShort : monthsShort, - weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), - weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'), - weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'), - longDateFormat : { - LT: 'H:mm', - LTS : 'H:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd D. MMMM YYYY H:mm' - }, - calendar : { - sameDay: '[dnes o] LT', - nextDay: '[zajtra o] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[v nedeľu o] LT'; - case 1: - case 2: - return '[v] dddd [o] LT'; - case 3: - return '[v stredu o] LT'; - case 4: - return '[vo štvrtok o] LT'; - case 5: - return '[v piatok o] LT'; - case 6: - return '[v sobotu o] LT'; - } - }, - lastDay: '[včera o] LT', - lastWeek: function () { - switch (this.day()) { - case 0: - return '[minulú nedeľu o] LT'; - case 1: - case 2: - return '[minulý] dddd [o] LT'; - case 3: - return '[minulú stredu o] LT'; - case 4: - case 5: - return '[minulý] dddd [o] LT'; - case 6: - return '[minulú sobotu o] LT'; - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pred %s', - s : translate, - m : translate, - mm : translate, - h : translate, - hh : translate, - d : translate, - dd : translate, - M : translate, - MM : translate, - y : translate, - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sl.js deleted file mode 100644 index 36b0e2eb..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sl.js +++ /dev/null @@ -1,152 +0,0 @@ -//! moment.js locale configuration -//! locale : slovenian (sl) -//! author : Robert Sedovšek : https://github.com/sedovsek - -import moment from '../moment'; - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var result = number + ' '; - switch (key) { - case 's': - return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami'; - case 'm': - return withoutSuffix ? 'ena minuta' : 'eno minuto'; - case 'mm': - if (number === 1) { - result += withoutSuffix ? 'minuta' : 'minuto'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'minute' : 'minutami'; - } else { - result += withoutSuffix || isFuture ? 'minut' : 'minutami'; - } - return result; - case 'h': - return withoutSuffix ? 'ena ura' : 'eno uro'; - case 'hh': - if (number === 1) { - result += withoutSuffix ? 'ura' : 'uro'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'uri' : 'urama'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'ure' : 'urami'; - } else { - result += withoutSuffix || isFuture ? 'ur' : 'urami'; - } - return result; - case 'd': - return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; - case 'dd': - if (number === 1) { - result += withoutSuffix || isFuture ? 'dan' : 'dnem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; - } else { - result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; - } - return result; - case 'M': - return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; - case 'MM': - if (number === 1) { - result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; - } else { - result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; - } - return result; - case 'y': - return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; - case 'yy': - if (number === 1) { - result += withoutSuffix || isFuture ? 'leto' : 'letom'; - } else if (number === 2) { - result += withoutSuffix || isFuture ? 'leti' : 'letoma'; - } else if (number < 5) { - result += withoutSuffix || isFuture ? 'leta' : 'leti'; - } else { - result += withoutSuffix || isFuture ? 'let' : 'leti'; - } - return result; - } -} - -export default moment.defineLocale('sl', { - months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'), - monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), - weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), - weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H:mm', - LTS : 'H:mm:ss', - L : 'DD. MM. YYYY', - LL : 'D. MMMM YYYY', - LLL : 'D. MMMM YYYY H:mm', - LLLL : 'dddd, D. MMMM YYYY H:mm' - }, - calendar : { - sameDay : '[danes ob] LT', - nextDay : '[jutri ob] LT', - - nextWeek : function () { - switch (this.day()) { - case 0: - return '[v] [nedeljo] [ob] LT'; - case 3: - return '[v] [sredo] [ob] LT'; - case 6: - return '[v] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[v] dddd [ob] LT'; - } - }, - lastDay : '[včeraj ob] LT', - lastWeek : function () { - switch (this.day()) { - case 0: - return '[prejšnjo] [nedeljo] [ob] LT'; - case 3: - return '[prejšnjo] [sredo] [ob] LT'; - case 6: - return '[prejšnjo] [soboto] [ob] LT'; - case 1: - case 2: - case 4: - case 5: - return '[prejšnji] dddd [ob] LT'; - } - }, - sameElse : 'L' - }, - relativeTime : { - future : 'čez %s', - past : 'pred %s', - s : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sq.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sq.js deleted file mode 100644 index c5aeac3e..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sq.js +++ /dev/null @@ -1,61 +0,0 @@ -//! moment.js locale configuration -//! locale : Albanian (sq) -//! author : Flakërim Ismani : https://github.com/flakerimi -//! author: Menelion Elensúle: https://github.com/Oire (tests) -//! author : Oerd Cukalla : https://github.com/oerd (fixes) - -import moment from '../moment'; - -export default moment.defineLocale('sq', { - months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'), - monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), - weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'), - weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), - weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'), - weekdaysParseExact : true, - meridiemParse: /PD|MD/, - isPM: function (input) { - return input.charAt(0) === 'M'; - }, - meridiem : function (hours, minutes, isLower) { - return hours < 12 ? 'PD' : 'MD'; - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[Sot në] LT', - nextDay : '[Nesër në] LT', - nextWeek : 'dddd [në] LT', - lastDay : '[Dje në] LT', - lastWeek : 'dddd [e kaluar në] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'në %s', - past : '%s më parë', - s : 'disa sekonda', - m : 'një minutë', - mm : '%d minuta', - h : 'një orë', - hh : '%d orë', - d : 'një ditë', - dd : '%d ditë', - M : 'një muaj', - MM : '%d muaj', - y : 'një vit', - yy : '%d vite' - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr-cyrl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr-cyrl.js deleted file mode 100644 index af2a84d2..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr-cyrl.js +++ /dev/null @@ -1,101 +0,0 @@ -//! moment.js locale configuration -//! locale : Serbian-cyrillic (sr-cyrl) -//! author : Milan Janačković : https://github.com/milan-j - -import moment from '../moment'; - -var translator = { - words: { //Different grammatical cases - m: ['један минут', 'једне минуте'], - mm: ['минут', 'минуте', 'минута'], - h: ['један сат', 'једног сата'], - hh: ['сат', 'сата', 'сати'], - dd: ['дан', 'дана', 'дана'], - MM: ['месец', 'месеца', 'месеци'], - yy: ['година', 'године', 'година'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } -}; - -export default moment.defineLocale('sr-cyrl', { - months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'), - monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'), - monthsParseExact: true, - weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), - weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), - weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[данас у] LT', - nextDay: '[сутра у] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[у] [недељу] [у] LT'; - case 3: - return '[у] [среду] [у] LT'; - case 6: - return '[у] [суботу] [у] LT'; - case 1: - case 2: - case 4: - case 5: - return '[у] dddd [у] LT'; - } - }, - lastDay : '[јуче у] LT', - lastWeek : function () { - var lastWeekDays = [ - '[прошле] [недеље] [у] LT', - '[прошлог] [понедељка] [у] LT', - '[прошлог] [уторка] [у] LT', - '[прошле] [среде] [у] LT', - '[прошлог] [четвртка] [у] LT', - '[прошлог] [петка] [у] LT', - '[прошле] [суботе] [у] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'за %s', - past : 'пре %s', - s : 'неколико секунди', - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'дан', - dd : translator.translate, - M : 'месец', - MM : translator.translate, - y : 'годину', - yy : translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr.js deleted file mode 100644 index 46fc7496..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sr.js +++ /dev/null @@ -1,101 +0,0 @@ -//! moment.js locale configuration -//! locale : Serbian-latin (sr) -//! author : Milan Janačković : https://github.com/milan-j - -import moment from '../moment'; - -var translator = { - words: { //Different grammatical cases - m: ['jedan minut', 'jedne minute'], - mm: ['minut', 'minute', 'minuta'], - h: ['jedan sat', 'jednog sata'], - hh: ['sat', 'sata', 'sati'], - dd: ['dan', 'dana', 'dana'], - MM: ['mesec', 'meseca', 'meseci'], - yy: ['godina', 'godine', 'godina'] - }, - correctGrammaticalCase: function (number, wordKey) { - return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]); - }, - translate: function (number, withoutSuffix, key) { - var wordKey = translator.words[key]; - if (key.length === 1) { - return withoutSuffix ? wordKey[0] : wordKey[1]; - } else { - return number + ' ' + translator.correctGrammaticalCase(number, wordKey); - } - } -}; - -export default moment.defineLocale('sr', { - months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'), - monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'), - monthsParseExact: true, - weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'), - weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), - weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), - weekdaysParseExact : true, - longDateFormat: { - LT: 'H:mm', - LTS : 'H:mm:ss', - L: 'DD. MM. YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY H:mm', - LLLL: 'dddd, D. MMMM YYYY H:mm' - }, - calendar: { - sameDay: '[danas u] LT', - nextDay: '[sutra u] LT', - nextWeek: function () { - switch (this.day()) { - case 0: - return '[u] [nedelju] [u] LT'; - case 3: - return '[u] [sredu] [u] LT'; - case 6: - return '[u] [subotu] [u] LT'; - case 1: - case 2: - case 4: - case 5: - return '[u] dddd [u] LT'; - } - }, - lastDay : '[juče u] LT', - lastWeek : function () { - var lastWeekDays = [ - '[prošle] [nedelje] [u] LT', - '[prošlog] [ponedeljka] [u] LT', - '[prošlog] [utorka] [u] LT', - '[prošle] [srede] [u] LT', - '[prošlog] [četvrtka] [u] LT', - '[prošlog] [petka] [u] LT', - '[prošle] [subote] [u] LT' - ]; - return lastWeekDays[this.day()]; - }, - sameElse : 'L' - }, - relativeTime : { - future : 'za %s', - past : 'pre %s', - s : 'nekoliko sekundi', - m : translator.translate, - mm : translator.translate, - h : translator.translate, - hh : translator.translate, - d : 'dan', - dd : translator.translate, - M : 'mesec', - MM : translator.translate, - y : 'godinu', - yy : translator.translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ss.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ss.js deleted file mode 100644 index fc1bcfb7..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ss.js +++ /dev/null @@ -1,80 +0,0 @@ -//! moment.js locale configuration -//! locale : siSwati (ss) -//! author : Nicolai Davies : https://github.com/nicolaidavies - - -import moment from '../moment'; - -export default moment.defineLocale('ss', { - months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'), - monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), - weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'), - weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), - weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'h:mm A', - LTS : 'h:mm:ss A', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY h:mm A', - LLLL : 'dddd, D MMMM YYYY h:mm A' - }, - calendar : { - sameDay : '[Namuhla nga] LT', - nextDay : '[Kusasa nga] LT', - nextWeek : 'dddd [nga] LT', - lastDay : '[Itolo nga] LT', - lastWeek : 'dddd [leliphelile] [nga] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'nga %s', - past : 'wenteka nga %s', - s : 'emizuzwana lomcane', - m : 'umzuzu', - mm : '%d emizuzu', - h : 'lihora', - hh : '%d emahora', - d : 'lilanga', - dd : '%d emalanga', - M : 'inyanga', - MM : '%d tinyanga', - y : 'umnyaka', - yy : '%d iminyaka' - }, - meridiemParse: /ekuseni|emini|entsambama|ebusuku/, - meridiem : function (hours, minutes, isLower) { - if (hours < 11) { - return 'ekuseni'; - } else if (hours < 15) { - return 'emini'; - } else if (hours < 19) { - return 'entsambama'; - } else { - return 'ebusuku'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'ekuseni') { - return hour; - } else if (meridiem === 'emini') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { - if (hour === 0) { - return 0; - } - return hour + 12; - } - }, - ordinalParse: /\d{1,2}/, - ordinal : '%d', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sv.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sv.js deleted file mode 100644 index 3354944c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sv.js +++ /dev/null @@ -1,60 +0,0 @@ -//! moment.js locale configuration -//! locale : swedish (sv) -//! author : Jens Alm : https://github.com/ulmus - -import moment from '../moment'; - -export default moment.defineLocale('sv', { - months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'), - monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'YYYY-MM-DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY [kl.] HH:mm', - LLLL : 'dddd D MMMM YYYY [kl.] HH:mm', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'om %s', - past : 'för %s sedan', - s : 'några sekunder', - m : 'en minut', - mm : '%d minuter', - h : 'en timme', - hh : '%d timmar', - d : 'en dag', - dd : '%d dagar', - M : 'en månad', - MM : '%d månader', - y : 'ett år', - yy : '%d år' - }, - ordinalParse: /\d{1,2}(e|a)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'e' : - (b === 1) ? 'a' : - (b === 2) ? 'a' : - (b === 3) ? 'e' : 'e'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sw.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sw.js deleted file mode 100644 index 06850d6f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/sw.js +++ /dev/null @@ -1,50 +0,0 @@ -//! moment.js locale configuration -//! locale : swahili (sw) -//! author : Fahad Kassim : https://github.com/fadsel - -import moment from '../moment'; - -export default moment.defineLocale('sw', { - months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'), - monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), - weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'), - weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), - weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[leo saa] LT', - nextDay : '[kesho saa] LT', - nextWeek : '[wiki ijayo] dddd [saat] LT', - lastDay : '[jana] LT', - lastWeek : '[wiki iliyopita] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s baadaye', - past : 'tokea %s', - s : 'hivi punde', - m : 'dakika moja', - mm : 'dakika %d', - h : 'saa limoja', - hh : 'masaa %d', - d : 'siku moja', - dd : 'masiku %d', - M : 'mwezi mmoja', - MM : 'miezi %d', - y : 'mwaka mmoja', - yy : 'miaka %d' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ta.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ta.js deleted file mode 100644 index f9b9cccf..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/ta.js +++ /dev/null @@ -1,120 +0,0 @@ -//! moment.js locale configuration -//! locale : tamil (ta) -//! author : Arjunkumar Krishnamoorthy : https://github.com/tk120404 - -import moment from '../moment'; - -var symbolMap = { - '1': '௧', - '2': '௨', - '3': '௩', - '4': '௪', - '5': '௫', - '6': '௬', - '7': '௭', - '8': '௮', - '9': '௯', - '0': '௦' -}, numberMap = { - '௧': '1', - '௨': '2', - '௩': '3', - '௪': '4', - '௫': '5', - '௬': '6', - '௭': '7', - '௮': '8', - '௯': '9', - '௦': '0' -}; - -export default moment.defineLocale('ta', { - months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'), - weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'), - weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'), - weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, HH:mm', - LLLL : 'dddd, D MMMM YYYY, HH:mm' - }, - calendar : { - sameDay : '[இன்று] LT', - nextDay : '[நாளை] LT', - nextWeek : 'dddd, LT', - lastDay : '[நேற்று] LT', - lastWeek : '[கடந்த வாரம்] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s இல்', - past : '%s முன்', - s : 'ஒரு சில விநாடிகள்', - m : 'ஒரு நிமிடம்', - mm : '%d நிமிடங்கள்', - h : 'ஒரு மணி நேரம்', - hh : '%d மணி நேரம்', - d : 'ஒரு நாள்', - dd : '%d நாட்கள்', - M : 'ஒரு மாதம்', - MM : '%d மாதங்கள்', - y : 'ஒரு வருடம்', - yy : '%d ஆண்டுகள்' - }, - ordinalParse: /\d{1,2}வது/, - ordinal : function (number) { - return number + 'வது'; - }, - preparse: function (string) { - return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { - return numberMap[match]; - }); - }, - postformat: function (string) { - return string.replace(/\d/g, function (match) { - return symbolMap[match]; - }); - }, - // refer http://ta.wikipedia.org/s/1er1 - meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, - meridiem : function (hour, minute, isLower) { - if (hour < 2) { - return ' யாமம்'; - } else if (hour < 6) { - return ' வைகறை'; // வைகறை - } else if (hour < 10) { - return ' காலை'; // காலை - } else if (hour < 14) { - return ' நண்பகல்'; // நண்பகல் - } else if (hour < 18) { - return ' எற்பாடு'; // எற்பாடு - } else if (hour < 22) { - return ' மாலை'; // மாலை - } else { - return ' யாமம்'; - } - }, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'யாமம்') { - return hour < 2 ? hour : hour + 12; - } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { - return hour; - } else if (meridiem === 'நண்பகல்') { - return hour >= 10 ? hour : hour + 12; - } else { - return hour + 12; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/te.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/te.js deleted file mode 100644 index 423c592c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/te.js +++ /dev/null @@ -1,79 +0,0 @@ -//! moment.js locale configuration -//! locale : telugu (te) -//! author : Krishna Chaitanya Thota : https://github.com/kcthota - -import moment from '../moment'; - -export default moment.defineLocale('te', { - months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'), - monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'), - monthsParseExact : true, - weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'), - weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), - weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), - longDateFormat : { - LT : 'A h:mm', - LTS : 'A h:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY, A h:mm', - LLLL : 'dddd, D MMMM YYYY, A h:mm' - }, - calendar : { - sameDay : '[నేడు] LT', - nextDay : '[రేపు] LT', - nextWeek : 'dddd, LT', - lastDay : '[నిన్న] LT', - lastWeek : '[గత] dddd, LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s లో', - past : '%s క్రితం', - s : 'కొన్ని క్షణాలు', - m : 'ఒక నిమిషం', - mm : '%d నిమిషాలు', - h : 'ఒక గంట', - hh : '%d గంటలు', - d : 'ఒక రోజు', - dd : '%d రోజులు', - M : 'ఒక నెల', - MM : '%d నెలలు', - y : 'ఒక సంవత్సరం', - yy : '%d సంవత్సరాలు' - }, - ordinalParse : /\d{1,2}వ/, - ordinal : '%dవ', - meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === 'రాత్రి') { - return hour < 4 ? hour : hour + 12; - } else if (meridiem === 'ఉదయం') { - return hour; - } else if (meridiem === 'మధ్యాహ్నం') { - return hour >= 10 ? hour : hour + 12; - } else if (meridiem === 'సాయంత్రం') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'రాత్రి'; - } else if (hour < 10) { - return 'ఉదయం'; - } else if (hour < 17) { - return 'మధ్యాహ్నం'; - } else if (hour < 20) { - return 'సాయంత్రం'; - } else { - return 'రాత్రి'; - } - }, - week : { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/th.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/th.js deleted file mode 100644 index 107e0a94..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/th.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : thai (th) -//! author : Kridsada Thanabulpong : https://github.com/sirn - -import moment from '../moment'; - -export default moment.defineLocale('th', { - months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), - monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'), - monthsParseExact: true, - weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), - weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference - weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'H นาฬิกา m นาที', - LTS : 'H นาฬิกา m นาที s วินาที', - L : 'YYYY/MM/DD', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY เวลา H นาฬิกา m นาที', - LLLL : 'วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที' - }, - meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, - isPM: function (input) { - return input === 'หลังเที่ยง'; - }, - meridiem : function (hour, minute, isLower) { - if (hour < 12) { - return 'ก่อนเที่ยง'; - } else { - return 'หลังเที่ยง'; - } - }, - calendar : { - sameDay : '[วันนี้ เวลา] LT', - nextDay : '[พรุ่งนี้ เวลา] LT', - nextWeek : 'dddd[หน้า เวลา] LT', - lastDay : '[เมื่อวานนี้ เวลา] LT', - lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'อีก %s', - past : '%sที่แล้ว', - s : 'ไม่กี่วินาที', - m : '1 นาที', - mm : '%d นาที', - h : '1 ชั่วโมง', - hh : '%d ชั่วโมง', - d : '1 วัน', - dd : '%d วัน', - M : '1 เดือน', - MM : '%d เดือน', - y : '1 ปี', - yy : '%d ปี' - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tl-ph.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tl-ph.js deleted file mode 100644 index 1cd4842c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tl-ph.js +++ /dev/null @@ -1,53 +0,0 @@ -//! moment.js locale configuration -//! locale : Tagalog/Filipino (tl-ph) -//! author : Dan Hagman - -import moment from '../moment'; - -export default moment.defineLocale('tl-ph', { - months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'), - monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), - weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'), - weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), - weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'MM/D/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY HH:mm', - LLLL : 'dddd, MMMM DD, YYYY HH:mm' - }, - calendar : { - sameDay: '[Ngayon sa] LT', - nextDay: '[Bukas sa] LT', - nextWeek: 'dddd [sa] LT', - lastDay: '[Kahapon sa] LT', - lastWeek: 'dddd [huling linggo] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'sa loob ng %s', - past : '%s ang nakalipas', - s : 'ilang segundo', - m : 'isang minuto', - mm : '%d minuto', - h : 'isang oras', - hh : '%d oras', - d : 'isang araw', - dd : '%d araw', - M : 'isang buwan', - MM : '%d buwan', - y : 'isang taon', - yy : '%d taon' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tlh.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tlh.js deleted file mode 100644 index 1e75f774..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tlh.js +++ /dev/null @@ -1,110 +0,0 @@ -//! moment.js locale configuration -//! locale : Klingon (tlh) -//! author : Dominika Kruk : https://github.com/amaranthrose - -import moment from '../moment'; - -var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); - -function translateFuture(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'leS' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'waQ' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'nem' : - time + ' pIq'; - return time; -} - -function translatePast(output) { - var time = output; - time = (output.indexOf('jaj') !== -1) ? - time.slice(0, -3) + 'Hu’' : - (output.indexOf('jar') !== -1) ? - time.slice(0, -3) + 'wen' : - (output.indexOf('DIS') !== -1) ? - time.slice(0, -3) + 'ben' : - time + ' ret'; - return time; -} - -function translate(number, withoutSuffix, string, isFuture) { - var numberNoun = numberAsNoun(number); - switch (string) { - case 'mm': - return numberNoun + ' tup'; - case 'hh': - return numberNoun + ' rep'; - case 'dd': - return numberNoun + ' jaj'; - case 'MM': - return numberNoun + ' jar'; - case 'yy': - return numberNoun + ' DIS'; - } -} - -function numberAsNoun(number) { - var hundred = Math.floor((number % 1000) / 100), - ten = Math.floor((number % 100) / 10), - one = number % 10, - word = ''; - if (hundred > 0) { - word += numbersNouns[hundred] + 'vatlh'; - } - if (ten > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH'; - } - if (one > 0) { - word += ((word !== '') ? ' ' : '') + numbersNouns[one]; - } - return (word === '') ? 'pagh' : word; -} - -export default moment.defineLocale('tlh', { - months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'), - monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'), - monthsParseExact : true, - weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[DaHjaj] LT', - nextDay: '[wa’leS] LT', - nextWeek: 'LLL', - lastDay: '[wa’Hu’] LT', - lastWeek: 'LLL', - sameElse: 'L' - }, - relativeTime : { - future : translateFuture, - past : translatePast, - s : 'puS lup', - m : 'wa’ tup', - mm : translate, - h : 'wa’ rep', - hh : translate, - d : 'wa’ jaj', - dd : translate, - M : 'wa’ jar', - MM : translate, - y : 'wa’ DIS', - yy : translate - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tr.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tr.js deleted file mode 100644 index e908bc03..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tr.js +++ /dev/null @@ -1,81 +0,0 @@ -//! moment.js locale configuration -//! locale : turkish (tr) -//! authors : Erhan Gundogan : https://github.com/erhangundogan, -//! Burak Yiğit Kaya: https://github.com/BYK - -import moment from '../moment'; - -var suffixes = { - 1: '\'inci', - 5: '\'inci', - 8: '\'inci', - 70: '\'inci', - 80: '\'inci', - 2: '\'nci', - 7: '\'nci', - 20: '\'nci', - 50: '\'nci', - 3: '\'üncü', - 4: '\'üncü', - 100: '\'üncü', - 6: '\'ncı', - 9: '\'uncu', - 10: '\'uncu', - 30: '\'uncu', - 60: '\'ıncı', - 90: '\'ıncı' -}; - -export default moment.defineLocale('tr', { - months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), - monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), - weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), - weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), - weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[bugün saat] LT', - nextDay : '[yarın saat] LT', - nextWeek : '[haftaya] dddd [saat] LT', - lastDay : '[dün] LT', - lastWeek : '[geçen hafta] dddd [saat] LT', - sameElse : 'L' - }, - relativeTime : { - future : '%s sonra', - past : '%s önce', - s : 'birkaç saniye', - m : 'bir dakika', - mm : '%d dakika', - h : 'bir saat', - hh : '%d saat', - d : 'bir gün', - dd : '%d gün', - M : 'bir ay', - MM : '%d ay', - y : 'bir yıl', - yy : '%d yıl' - }, - ordinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/, - ordinal : function (number) { - if (number === 0) { // special case for zero - return number + '\'ıncı'; - } - var a = number % 10, - b = number % 100 - a, - c = number >= 100 ? 100 : null; - return number + (suffixes[a] || suffixes[b] || suffixes[c]); - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzl.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzl.js deleted file mode 100644 index 9f983f7f..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzl.js +++ /dev/null @@ -1,82 +0,0 @@ -//! moment.js locale configuration -//! locale : talossan (tzl) -//! author : Robin van der Vliet : https://github.com/robin0van0der0v with the help of Iustì Canun - - -import moment from '../moment'; - -// After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. -// This is currently too difficult (maybe even impossible) to add. -export default moment.defineLocale('tzl', { - months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'), - monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), - weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), - weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), - weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), - longDateFormat : { - LT : 'HH.mm', - LTS : 'HH.mm.ss', - L : 'DD.MM.YYYY', - LL : 'D. MMMM [dallas] YYYY', - LLL : 'D. MMMM [dallas] YYYY HH.mm', - LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm' - }, - meridiemParse: /d\'o|d\'a/i, - isPM : function (input) { - return 'd\'o' === input.toLowerCase(); - }, - meridiem : function (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'd\'o' : 'D\'O'; - } else { - return isLower ? 'd\'a' : 'D\'A'; - } - }, - calendar : { - sameDay : '[oxhi à] LT', - nextDay : '[demà à] LT', - nextWeek : 'dddd [à] LT', - lastDay : '[ieiri à] LT', - lastWeek : '[sür el] dddd [lasteu à] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'osprei %s', - past : 'ja%s', - s : processRelativeTime, - m : processRelativeTime, - mm : processRelativeTime, - h : processRelativeTime, - hh : processRelativeTime, - d : processRelativeTime, - dd : processRelativeTime, - M : processRelativeTime, - MM : processRelativeTime, - y : processRelativeTime, - yy : processRelativeTime - }, - ordinalParse: /\d{1,2}\./, - ordinal : '%d.', - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - -function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - 's': ['viensas secunds', '\'iensas secunds'], - 'm': ['\'n míut', '\'iens míut'], - 'mm': [number + ' míuts', '' + number + ' míuts'], - 'h': ['\'n þora', '\'iensa þora'], - 'hh': [number + ' þoras', '' + number + ' þoras'], - 'd': ['\'n ziua', '\'iensa ziua'], - 'dd': [number + ' ziuas', '' + number + ' ziuas'], - 'M': ['\'n mes', '\'iens mes'], - 'MM': [number + ' mesen', '' + number + ' mesen'], - 'y': ['\'n ar', '\'iens ar'], - 'yy': [number + ' ars', '' + number + ' ars'] - }; - return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]); -} - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm-latn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm-latn.js deleted file mode 100644 index e2631d97..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm-latn.js +++ /dev/null @@ -1,49 +0,0 @@ -//! moment.js locale configuration -//! locale : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn) -//! author : Abdel Said : https://github.com/abdelsaid - -import moment from '../moment'; - -export default moment.defineLocale('tzm-latn', { - months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'), - weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[asdkh g] LT', - nextDay: '[aska g] LT', - nextWeek: 'dddd [g] LT', - lastDay: '[assant g] LT', - lastWeek: 'dddd [g] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'dadkh s yan %s', - past : 'yan %s', - s : 'imik', - m : 'minuḍ', - mm : '%d minuḍ', - h : 'saɛa', - hh : '%d tassaɛin', - d : 'ass', - dd : '%d ossan', - M : 'ayowr', - MM : '%d iyyirn', - y : 'asgas', - yy : '%d isgasn' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm.js deleted file mode 100644 index a06a27d9..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/tzm.js +++ /dev/null @@ -1,49 +0,0 @@ -//! moment.js locale configuration -//! locale : Morocco Central Atlas Tamaziɣt (tzm) -//! author : Abdel Said : https://github.com/abdelsaid - -import moment from '../moment'; - -export default moment.defineLocale('tzm', { - months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'), - weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS: 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd D MMMM YYYY HH:mm' - }, - calendar : { - sameDay: '[ⴰⵙⴷⵅ ⴴ] LT', - nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', - nextWeek: 'dddd [ⴴ] LT', - lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', - lastWeek: 'dddd [ⴴ] LT', - sameElse: 'L' - }, - relativeTime : { - future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', - past : 'ⵢⴰⵏ %s', - s : 'ⵉⵎⵉⴽ', - m : 'ⵎⵉⵏⵓⴺ', - mm : '%d ⵎⵉⵏⵓⴺ', - h : 'ⵙⴰⵄⴰ', - hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', - d : 'ⴰⵙⵙ', - dd : '%d oⵙⵙⴰⵏ', - M : 'ⴰⵢoⵓⵔ', - MM : '%d ⵉⵢⵢⵉⵔⵏ', - y : 'ⴰⵙⴳⴰⵙ', - yy : '%d ⵉⵙⴳⴰⵙⵏ' - }, - week : { - dow : 6, // Saturday is the first day of the week. - doy : 12 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uk.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uk.js deleted file mode 100644 index 6cbffaa6..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uk.js +++ /dev/null @@ -1,137 +0,0 @@ -//! moment.js locale configuration -//! locale : ukrainian (uk) -//! author : zemlanin : https://github.com/zemlanin -//! Author : Menelion Elensúle : https://github.com/Oire - -import moment from '../moment'; - -function plural(word, num) { - var forms = word.split('_'); - return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]); -} -function relativeTimeWithPlural(number, withoutSuffix, key) { - var format = { - 'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', - 'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин', - 'dd': 'день_дні_днів', - 'MM': 'місяць_місяці_місяців', - 'yy': 'рік_роки_років' - }; - if (key === 'm') { - return withoutSuffix ? 'хвилина' : 'хвилину'; - } - else if (key === 'h') { - return withoutSuffix ? 'година' : 'годину'; - } - else { - return number + ' ' + plural(format[key], +number); - } -} -function weekdaysCaseReplace(m, format) { - var weekdays = { - 'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'), - 'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'), - 'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_') - }, - nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ? - 'accusative' : - ((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ? - 'genitive' : - 'nominative'); - return weekdays[nounCase][m.day()]; -} -function processHoursFunction(str) { - return function () { - return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; - }; -} - -export default moment.defineLocale('uk', { - months : { - 'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'), - 'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_') - }, - monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'), - weekdays : weekdaysCaseReplace, - weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD.MM.YYYY', - LL : 'D MMMM YYYY р.', - LLL : 'D MMMM YYYY р., HH:mm', - LLLL : 'dddd, D MMMM YYYY р., HH:mm' - }, - calendar : { - sameDay: processHoursFunction('[Сьогодні '), - nextDay: processHoursFunction('[Завтра '), - lastDay: processHoursFunction('[Вчора '), - nextWeek: processHoursFunction('[У] dddd ['), - lastWeek: function () { - switch (this.day()) { - case 0: - case 3: - case 5: - case 6: - return processHoursFunction('[Минулої] dddd [').call(this); - case 1: - case 2: - case 4: - return processHoursFunction('[Минулого] dddd [').call(this); - } - }, - sameElse: 'L' - }, - relativeTime : { - future : 'за %s', - past : '%s тому', - s : 'декілька секунд', - m : relativeTimeWithPlural, - mm : relativeTimeWithPlural, - h : 'годину', - hh : relativeTimeWithPlural, - d : 'день', - dd : relativeTimeWithPlural, - M : 'місяць', - MM : relativeTimeWithPlural, - y : 'рік', - yy : relativeTimeWithPlural - }, - // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason - meridiemParse: /ночі|ранку|дня|вечора/, - isPM: function (input) { - return /^(дня|вечора)$/.test(input); - }, - meridiem : function (hour, minute, isLower) { - if (hour < 4) { - return 'ночі'; - } else if (hour < 12) { - return 'ранку'; - } else if (hour < 17) { - return 'дня'; - } else { - return 'вечора'; - } - }, - ordinalParse: /\d{1,2}-(й|го)/, - ordinal: function (number, period) { - switch (period) { - case 'M': - case 'd': - case 'DDD': - case 'w': - case 'W': - return number + '-й'; - case 'D': - return number + '-го'; - default: - return number; - } - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 1st is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uz.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uz.js deleted file mode 100644 index 881e50b5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/uz.js +++ /dev/null @@ -1,49 +0,0 @@ -//! moment.js locale configuration -//! locale : uzbek (uz) -//! author : Sardor Muminov : https://github.com/muminoff - -import moment from '../moment'; - -export default moment.defineLocale('uz', { - months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), - monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), - weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), - weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), - weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'D MMMM YYYY, dddd HH:mm' - }, - calendar : { - sameDay : '[Бугун соат] LT [да]', - nextDay : '[Эртага] LT [да]', - nextWeek : 'dddd [куни соат] LT [да]', - lastDay : '[Кеча соат] LT [да]', - lastWeek : '[Утган] dddd [куни соат] LT [да]', - sameElse : 'L' - }, - relativeTime : { - future : 'Якин %s ичида', - past : 'Бир неча %s олдин', - s : 'фурсат', - m : 'бир дакика', - mm : '%d дакика', - h : 'бир соат', - hh : '%d соат', - d : 'бир кун', - dd : '%d кун', - M : 'бир ой', - MM : '%d ой', - y : 'бир йил', - yy : '%d йил' - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 7 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/vi.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/vi.js deleted file mode 100644 index 34cc18d1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/vi.js +++ /dev/null @@ -1,70 +0,0 @@ -//! moment.js locale configuration -//! locale : vietnamese (vi) -//! author : Bang Nguyen : https://github.com/bangnk - -import moment from '../moment'; - -export default moment.defineLocale('vi', { - months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'), - monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'), - monthsParseExact : true, - weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'), - weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'), - weekdaysParseExact : true, - meridiemParse: /sa|ch/i, - isPM : function (input) { - return /^ch$/i.test(input); - }, - meridiem : function (hours, minutes, isLower) { - if (hours < 12) { - return isLower ? 'sa' : 'SA'; - } else { - return isLower ? 'ch' : 'CH'; - } - }, - longDateFormat : { - LT : 'HH:mm', - LTS : 'HH:mm:ss', - L : 'DD/MM/YYYY', - LL : 'D MMMM [năm] YYYY', - LLL : 'D MMMM [năm] YYYY HH:mm', - LLLL : 'dddd, D MMMM [năm] YYYY HH:mm', - l : 'DD/M/YYYY', - ll : 'D MMM YYYY', - lll : 'D MMM YYYY HH:mm', - llll : 'ddd, D MMM YYYY HH:mm' - }, - calendar : { - sameDay: '[Hôm nay lúc] LT', - nextDay: '[Ngày mai lúc] LT', - nextWeek: 'dddd [tuần tới lúc] LT', - lastDay: '[Hôm qua lúc] LT', - lastWeek: 'dddd [tuần rồi lúc] LT', - sameElse: 'L' - }, - relativeTime : { - future : '%s tới', - past : '%s trước', - s : 'vài giây', - m : 'một phút', - mm : '%d phút', - h : 'một giờ', - hh : '%d giờ', - d : 'một ngày', - dd : '%d ngày', - M : 'một tháng', - MM : '%d tháng', - y : 'một năm', - yy : '%d năm' - }, - ordinalParse: /\d{1,2}/, - ordinal : function (number) { - return number; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/x-pseudo.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/x-pseudo.js deleted file mode 100644 index 3bcb80f3..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/x-pseudo.js +++ /dev/null @@ -1,58 +0,0 @@ -//! moment.js locale configuration -//! locale : pseudo (x-pseudo) -//! author : Andrew Hood : https://github.com/andrewhood125 - -import moment from '../moment'; - -export default moment.defineLocale('x-pseudo', { - months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'), - monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'), - monthsParseExact : true, - weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'), - weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), - weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), - weekdaysParseExact : true, - longDateFormat : { - LT : 'HH:mm', - L : 'DD/MM/YYYY', - LL : 'D MMMM YYYY', - LLL : 'D MMMM YYYY HH:mm', - LLLL : 'dddd, D MMMM YYYY HH:mm' - }, - calendar : { - sameDay : '[T~ódá~ý át] LT', - nextDay : '[T~ómó~rró~w át] LT', - nextWeek : 'dddd [át] LT', - lastDay : '[Ý~ést~érdá~ý át] LT', - lastWeek : '[L~ást] dddd [át] LT', - sameElse : 'L' - }, - relativeTime : { - future : 'í~ñ %s', - past : '%s á~gó', - s : 'á ~féw ~sécó~ñds', - m : 'á ~míñ~úté', - mm : '%d m~íñú~tés', - h : 'á~ñ hó~úr', - hh : '%d h~óúrs', - d : 'á ~dáý', - dd : '%d d~áýs', - M : 'á ~móñ~th', - MM : '%d m~óñt~hs', - y : 'á ~ýéár', - yy : '%d ý~éárs' - }, - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, - week : { - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-cn.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-cn.js deleted file mode 100644 index d9db7173..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-cn.js +++ /dev/null @@ -1,118 +0,0 @@ -//! moment.js locale configuration -//! locale : chinese (zh-cn) -//! author : suupic : https://github.com/suupic -//! author : Zeno Zeng : https://github.com/zenozeng - -import moment from '../moment'; - -export default moment.defineLocale('zh-cn', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah点mm分', - LTS : 'Ah点m分s秒', - L : 'YYYY-MM-DD', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah点mm分', - LLLL : 'YYYY年MMMD日ddddAh点mm分', - l : 'YYYY-MM-DD', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah点mm分', - llll : 'YYYY年MMMD日ddddAh点mm分' - }, - meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, - meridiemHour: function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '凌晨' || meridiem === '早上' || - meridiem === '上午') { - return hour; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } else { - // '中午' - return hour >= 11 ? hour : hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 600) { - return '凌晨'; - } else if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : function () { - return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT'; - }, - nextDay : function () { - return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT'; - }, - lastDay : function () { - return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT'; - }, - nextWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - lastWeek : function () { - var startOfWeek, prefix; - startOfWeek = moment().startOf('week'); - prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; - return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm'; - }, - sameElse : 'LL' - }, - ordinalParse: /\d{1,2}(日|月|周)/, - ordinal : function (number, period) { - switch (period) { - case 'd': - case 'D': - case 'DDD': - return number + '日'; - case 'M': - return number + '月'; - case 'w': - case 'W': - return number + '周'; - default: - return number; - } - }, - relativeTime : { - future : '%s内', - past : '%s前', - s : '几秒', - m : '1 分钟', - mm : '%d 分钟', - h : '1 小时', - hh : '%d 小时', - d : '1 天', - dd : '%d 天', - M : '1 个月', - MM : '%d 个月', - y : '1 年', - yy : '%d 年' - }, - week : { - // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 - dow : 1, // Monday is the first day of the week. - doy : 4 // The week that contains Jan 4th is the first week of the year. - } -}); - diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-tw.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-tw.js deleted file mode 100644 index c5e3b69b..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/locale/zh-tw.js +++ /dev/null @@ -1,91 +0,0 @@ -//! moment.js locale configuration -//! locale : traditional chinese (zh-tw) -//! author : Ben : https://github.com/ben-lin - -import moment from '../moment'; - -export default moment.defineLocale('zh-tw', { - months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'), - monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), - weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), - weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'), - weekdaysMin : '日_一_二_三_四_五_六'.split('_'), - longDateFormat : { - LT : 'Ah點mm分', - LTS : 'Ah點m分s秒', - L : 'YYYY年MMMD日', - LL : 'YYYY年MMMD日', - LLL : 'YYYY年MMMD日Ah點mm分', - LLLL : 'YYYY年MMMD日ddddAh點mm分', - l : 'YYYY年MMMD日', - ll : 'YYYY年MMMD日', - lll : 'YYYY年MMMD日Ah點mm分', - llll : 'YYYY年MMMD日ddddAh點mm分' - }, - meridiemParse: /早上|上午|中午|下午|晚上/, - meridiemHour : function (hour, meridiem) { - if (hour === 12) { - hour = 0; - } - if (meridiem === '早上' || meridiem === '上午') { - return hour; - } else if (meridiem === '中午') { - return hour >= 11 ? hour : hour + 12; - } else if (meridiem === '下午' || meridiem === '晚上') { - return hour + 12; - } - }, - meridiem : function (hour, minute, isLower) { - var hm = hour * 100 + minute; - if (hm < 900) { - return '早上'; - } else if (hm < 1130) { - return '上午'; - } else if (hm < 1230) { - return '中午'; - } else if (hm < 1800) { - return '下午'; - } else { - return '晚上'; - } - }, - calendar : { - sameDay : '[今天]LT', - nextDay : '[明天]LT', - nextWeek : '[下]ddddLT', - lastDay : '[昨天]LT', - lastWeek : '[上]ddddLT', - sameElse : 'L' - }, - ordinalParse: /\d{1,2}(日|月|週)/, - ordinal : function (number, period) { - switch (period) { - case 'd' : - case 'D' : - case 'DDD' : - return number + '日'; - case 'M' : - return number + '月'; - case 'w' : - case 'W' : - return number + '週'; - default : - return number; - } - }, - relativeTime : { - future : '%s內', - past : '%s前', - s : '幾秒', - m : '1分鐘', - mm : '%d分鐘', - h : '1小時', - hh : '%d小時', - d : '1天', - dd : '%d天', - M : '1個月', - MM : '%d個月', - y : '1年', - yy : '%d年' - } -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/moment.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/moment.js deleted file mode 100644 index ebe17525..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/src/moment.js +++ /dev/null @@ -1,75 +0,0 @@ -//! moment.js -//! version : 2.13.0 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com - -import { hooks as moment, setHookCallback } from './lib/utils/hooks'; - -moment.version = '2.13.0'; - -import { - min, - max, - now, - isMoment, - momentPrototype as fn, - createUTC as utc, - createUnix as unix, - createLocal as local, - createInvalid as invalid, - createInZone as parseZone -} from './lib/moment/moment'; - -import { - defineLocale, - updateLocale, - getSetGlobalLocale as locale, - getLocale as localeData, - listLocales as locales, - listMonths as months, - listMonthsShort as monthsShort, - listWeekdays as weekdays, - listWeekdaysMin as weekdaysMin, - listWeekdaysShort as weekdaysShort -} from './lib/locale/locale'; - -import { - isDuration, - createDuration as duration, - getSetRelativeTimeThreshold as relativeTimeThreshold -} from './lib/duration/duration'; - -import { normalizeUnits } from './lib/units/units'; - -import isDate from './lib/utils/is-date'; - -setHookCallback(local); - -moment.fn = fn; -moment.min = min; -moment.max = max; -moment.now = now; -moment.utc = utc; -moment.unix = unix; -moment.months = months; -moment.isDate = isDate; -moment.locale = locale; -moment.invalid = invalid; -moment.duration = duration; -moment.isMoment = isMoment; -moment.weekdays = weekdays; -moment.parseZone = parseZone; -moment.localeData = localeData; -moment.isDuration = isDuration; -moment.monthsShort = monthsShort; -moment.weekdaysMin = weekdaysMin; -moment.defineLocale = defineLocale; -moment.updateLocale = updateLocale; -moment.locales = locales; -moment.weekdaysShort = weekdaysShort; -moment.normalizeUnits = normalizeUnits; -moment.relativeTimeThreshold = relativeTimeThreshold; -moment.prototype = fn; - -export default moment; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd-named.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd-named.js deleted file mode 100644 index 76104564..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd-named.js +++ /dev/null @@ -1,7 +0,0 @@ -/*global define:false*/ - -import moment from "./moment"; - -define("moment", [], function () { - return moment; -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd.js deleted file mode 100644 index 847bcefa..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/amd.js +++ /dev/null @@ -1,7 +0,0 @@ -/*global define:false*/ - -import moment from "./moment"; - -define([], function () { - return moment; -}); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/default.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/default.js deleted file mode 100644 index 3d6d4af8..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/default.js +++ /dev/null @@ -1,5 +0,0 @@ -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, function () { 'use strict'; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/globals.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/globals.js deleted file mode 100644 index 5ac160f1..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/globals.js +++ /dev/null @@ -1,5 +0,0 @@ -/*global window:false*/ - -import moment from "./moment"; - -window.moment = moment; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/locale-header.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/locale-header.js deleted file mode 100644 index 9a0f5a73..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/locale-header.js +++ /dev/null @@ -1,6 +0,0 @@ -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/test-header.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/test-header.js deleted file mode 100644 index aee69d38..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/moment/templates/test-header.js +++ /dev/null @@ -1,6 +0,0 @@ -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../../moment')) : - typeof define === 'function' && define.amd ? define(['../../moment'], factory) : - factory(global.moment) -}(this, function (moment) { 'use strict'; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/stepup-ra.js b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/stepup-ra.js index b6bf5ec8..e48b6e45 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/public/js/stepup-ra.js +++ b/src/Surfnet/StepupRa/RaBundle/Resources/public/js/stepup-ra.js @@ -14,6 +14,8 @@ * limitations under the License. */ +import moment from "moment"; + (function ($) { 'use strict'; diff --git a/webpack.config.js b/webpack.config.js index 2d7a100e..f800a98a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,4 @@ -var Encore = require('@symfony/webpack-encore'); +const Encore = require('@symfony/webpack-encore'); // Manually configure the runtime environment if not already configured yet by the "encore" command. // It's useful when you use tools that rely on webpack.config.js file. From 6c66b4fc88e9f6fdf30a400761c1ffb9ae21c26d Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 16:16:43 +0100 Subject: [PATCH 071/202] Fix deprecations --- .../RaBundle/Form/Type/InitiateGssfType.php | 1 + .../Form/Type/StartVettingProcedureType.php | 1 + .../RaBundle/Resources/config/services.yml | 4 +- .../Authentication/Provider/SamlProvider.php | 5 +- .../Service/LocaleProviderService.php | 6 +-- .../StepupRa/RaBundle/Value/DateTime.php | 53 ++----------------- .../Resources/config/services.yml | 4 +- .../Saml/StateHandler.php | 17 ++---- 8 files changed, 18 insertions(+), 73 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php index ac5a92d7..753dc243 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php @@ -18,6 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use JMS\TranslationBundle\Annotation\Ignore; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php index 96d99740..872d93ca 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php @@ -18,6 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use JMS\TranslationBundle\Annotation\Ignore; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index 477b74b2..3d645c0e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -145,13 +145,13 @@ services: - "@ra.service.gssf.sessionbag" ra.service.gssf.sessionbag: - class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag + class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag factory: ['@session', 'getBag'] arguments: ['ra.service.gssf'] ra.service.gssf.namespaced_attribute_bag: public: false - class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag + class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag arguments: - '__ra.service.gssf__' - '/' diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index 59568f1f..a908b382 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -47,11 +47,8 @@ public function __construct( /** * @SuppressWarnings(PHPMD.NPathComplexity) - The authorization tests cause the complexity to raise, could and * @SuppressWarnings(PHPMD.CyclomaticComplexity) might be changed by introducing additional utility classes. - * Consider rebuilding this in the future. - * @param SamlToken|TokenInterface $token - * @return TokenInterface|void */ - public function authenticate(TokenInterface $token) + public function authenticate(TokenInterface $token): TokenInterface { $translatedAssertion = $this->attributeDictionary->translate($token->assertion); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php b/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php index 5145d109..0475a5b7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php @@ -28,19 +28,19 @@ public function __construct(private TokenStorageInterface $tokenStorage) { } - public function determinePreferredLocale() + public function determinePreferredLocale(): string { $token = $this->tokenStorage->getToken(); if (!$token) { - return; + return ''; } /** @var Identity $identity */ $identity = $token->getUser(); if (!$identity instanceof Identity) { - return; + return ''; } return $identity->preferredLocale; diff --git a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php index 426cd0ee..c14b61ef 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php @@ -40,14 +40,8 @@ class DateTime implements Stringable */ private static $now; - /** - * @var CoreDateTime - */ - private $dateTime; + private CoreDateTime $dateTime; - /** - * @return self - */ public static function now(): DateTime { return self::$now ?: new self(new CoreDateTime); @@ -55,14 +49,9 @@ public static function now(): DateTime /** * @param string $string A date-time string formatted using `self::FORMAT` (eg. '2014-11-26T15:20:43+01:00'). - * @return DateTime */ - public static function fromString($string): DateTime + public static function fromString(string $string): DateTime { - if (!is_string($string)) { - InvalidArgumentException::invalidType('string', 'string', $string); - } - $dateTime = CoreDateTime::createFromFormat(self::FORMAT, $string); if ($dateTime === false) { @@ -75,14 +64,11 @@ public static function fromString($string): DateTime /** * @param CoreDateTime|null $dateTime */ - public function __construct(CoreDateTime $dateTime = null) + public function __construct(?CoreDateTime $dateTime = null) { $this->dateTime = $dateTime ?: new CoreDateTime(); } - /** - * @return DateTime - */ public function add(DateInterval $interval): DateTime { $dateTime = clone $this->dateTime; @@ -91,9 +77,6 @@ public function add(DateInterval $interval): DateTime return new self($dateTime); } - /** - * @return DateTime - */ public function sub(DateInterval $interval): DateTime { $dateTime = clone $this->dateTime; @@ -102,56 +85,30 @@ public function sub(DateInterval $interval): DateTime return new self($dateTime); } - /** - * @return boolean - */ public function comesBefore(DateTime $dateTime): bool { return $this->dateTime < $dateTime->dateTime; } - /** - * @return boolean - */ public function comesBeforeOrIsEqual(DateTime $dateTime): bool { return $this->dateTime <= $dateTime->dateTime; } - /** - * @return boolean - */ public function comesAfter(DateTime $dateTime): bool { return $this->dateTime > $dateTime->dateTime; } - /** - * @return boolean - */ public function comesAfterOrIsEqual(DateTime $dateTime): bool { return $this->dateTime >= $dateTime->dateTime; } - /** - * @param $format - * @return string - */ - public function format($format): string + public function format(string $format): string { - $formatted = $this->dateTime->format($format); - - if ($formatted === false) { - throw new InvalidArgumentException( - sprintf( - 'Given format "%s" is not a valid format for DateTime', - $format, - ), - ); - } - return $formatted; + return $this->dateTime->format($format); } /** diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index 07008d2a..5d3aede6 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -11,13 +11,13 @@ services: alias: gssp.provider_repository gssp.sessionbag: - class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag + class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag factory: ['@session', 'getBag'] arguments: ['gssp'] gssp.session.namespaced_attribute_bag: public: false - class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag + class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag arguments: - '__gssp__' - '/' diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php index 2ee95173..cd6a0da5 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php @@ -18,32 +18,21 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle\Saml; -use Surfnet\StepupRa\GatewayBundle\Saml\Proxy\ProxyStateHandler; -use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag; +use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; final class StateHandler { - /** - * @param string $provider - */ - public function __construct(private readonly NamespacedAttributeBag $attributeBag, private $provider) + public function __construct(private readonly AttributeBag $attributeBag, private readonly string $provider) { } - /** - * @param string $originalRequestId - * @return $this - */ - public function setRequestId($originalRequestId): static + public function setRequestId(string $originalRequestId): StateHandler { $this->set('request_id', $originalRequestId); return $this; } - /** - * @return string|null - */ public function getRequestId(): ?string { return $this->get('request_id'); From 49cbb136e19b1e5c72ed98391dade5cca393e8ad Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 16:20:49 +0100 Subject: [PATCH 072/202] Remove deleted service definitions --- .../StepupRa/RaBundle/Resources/config/services.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index 3d645c0e..7884b430 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -68,12 +68,6 @@ services: class: Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType tags: [{ name: form.type, alias: ra_revoke_second_factor }] - ra.form.type.sraa_institution_select: - class: Surfnet\StepupRa\RaBundle\Form\Type\InstitutionSelectionType - arguments: - - "@ra.form.extension.institution_listing_choice_list" - tags: [{ name: form.type, alias: sraa_institution_select }] - ra.form.type.management.create_ra: class: Surfnet\StepupRa\RaBundle\Form\Type\CreateRaType tags: [{ name: form.type, alias: ra_management_create_ra }] @@ -97,11 +91,6 @@ services: tags: [{ name: form.type, alias: ra_initiate_gssf }] # Form Extensions - ra.form.extension.institution_listing_choice_list: - class: Surfnet\StepupRa\RaBundle\Form\Extension\InstitutionListingChoiceList - arguments: - - "@surfnet_stepup_middleware_client.identity.service.institution_listing" - ra.form.extension.second_factor_type_choice_list: class: Surfnet\StepupRa\RaBundle\Form\Extension\SecondFactorTypeChoiceList arguments: From 1acac3f8a3a62bfdc1eee1daad50878045bf3c3f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 16:35:32 +0100 Subject: [PATCH 073/202] Add types --- .../Command/SearchRaCandidatesCommand.php | 8 ++-- .../Extensions/Extension/SecondFactorType.php | 2 +- .../RaBundle/Value/RoleAtInstitution.php | 38 +++---------------- 3 files changed, 11 insertions(+), 37 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php index 219b5e35..1fe30fcc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php @@ -27,13 +27,13 @@ class SearchRaCandidatesCommand */ public string $actorId; - public string $institution; + public ?string $institution = null; - public ?string $name; + public ?string $name = null; - public ?string $email; + public ?string $email = null; - public string $raInstitution; + public ?string $raInstitution = null; /** * @Assert\Choice( diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php index 7e4b1aa2..353def6f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php @@ -42,7 +42,7 @@ public function getFilters(): array ]; } - public function translateSecondFactorType($secondFactorType): string + public function translateSecondFactorType($secondFactorType): ?string { return $this->translator->translate($secondFactorType, 'ra.second_factor.search.type.%s'); } diff --git a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php index a202fa7a..d63568bd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php @@ -22,62 +22,36 @@ class RoleAtInstitution { - /** - * @var string - */ - private $role; + private ?string $role = null; - /** - * @var string - */ - private $institution; + private ?string $institution = null; - /** - * @param string $role - */ - public function setRole($role): void + public function setRole(?string $role): void { - Assert::nullOrString($role, 'Role must be null or a string value'); $this->role = $role; } - /** - * @param string $institution - */ - public function setInstitution($institution): void + public function setInstitution(?string $institution): void { - Assert::nullOrString($institution, 'Institution must be null or a string value'); $this->institution = $institution; } - /** - * @return bool - */ public function hasRole(): bool { return !is_null($this->role); } - /** - * @return bool - */ public function hasInstitution(): bool { return !is_null($this->institution); } - /** - * @return string - */ - public function getRole(): string + public function getRole(): ?string { return $this->role; } - /** - * @return string - */ - public function getInstitution(): string + public function getInstitution(): ?string { return $this->institution; } From e3164c4622506373476e9ab7e58b9315b25ae780 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 16:51:46 +0100 Subject: [PATCH 074/202] Run rector --- composer.lock | 18 ++++++++------- package.json | 2 +- src/Surfnet/StepupRa/RaBundle/Assert.php | 4 ++-- .../Command/ExportRaSecondFactorsCommand.php | 1 - .../Command/SearchRaCandidatesCommand.php | 4 ++-- .../Controller/ExceptionController.php | 1 - .../RaBundle/Controller/LocaleController.php | 2 +- .../Controller/RaManagementController.php | 3 --- .../Controller/SecondFactorController.php | 3 --- .../RaBundle/Controller/VettingController.php | 2 +- .../StepupRa/RaBundle/DateTime/DateTime.php | 3 --- .../Handler/LogoutSuccessHandler.php | 6 ++--- .../Authentication/Provider/SamlProvider.php | 4 ++-- .../SamlInteractionProvider.php | 3 --- .../Session/SessionLifetimeGuard.php | 23 ++----------------- .../RaBundle/Service/AuditLogService.php | 3 --- .../RaBundle/Service/GlobalViewParameters.php | 3 --- .../Service/Gssf/VerificationResult.php | 8 ------- .../StepupRa/RaBundle/Service/GssfService.php | 1 - ...InstitutionConfigurationOptionsService.php | 1 - ...onConfigurationOptionsServiceInterface.php | 1 - .../RaBundle/Service/RaLocationService.php | 6 ----- .../RaBundle/Service/VettingService.php | 2 +- .../VerificationResult.php | 5 +--- .../Service/YubikeySecondFactorService.php | 3 --- .../RaBundle/Service/YubikeyService.php | 3 --- .../Service/YubikeyVerificationResult.php | 9 -------- .../StepupRa/RaBundle/Value/TimeFrame.php | 7 ------ .../StepupRa/RaBundle/VettingProcedure.php | 22 +++++++++--------- .../Compiler/ViewConfigCollectionPass.php | 3 --- .../DependencyInjection/Configuration.php | 4 ++-- ...netStepupRaSamlStepupProviderExtension.php | 1 - .../Provider/Provider.php | 12 ---------- .../Provider/ProviderRepository.php | 7 +----- .../Saml/StateHandler.php | 4 ++-- 35 files changed, 42 insertions(+), 142 deletions(-) diff --git a/composer.lock b/composer.lock index 460a10e5..fbc6fc3f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "28a31f3c078fbca70f85b1281fad3804", + "content-hash": "7ad63dd3c1408ffcd0693b8953127ea1", "packages": [ { "name": "beberlei/assert", @@ -9508,16 +9508,16 @@ }, { "name": "rector/rector", - "version": "0.19.5", + "version": "0.19.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "89c895d127b9d248d2af007068a824b5348ef81f" + "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", - "reference": "89c895d127b9d248d2af007068a824b5348ef81f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/de3b3bb159abd704b144aa86fb244f7f1f4ac947", + "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947", "shasum": "" }, "require": { @@ -9552,7 +9552,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.5" + "source": "https://github.com/rectorphp/rector/tree/0.19.8" }, "funding": [ { @@ -9560,7 +9560,7 @@ "type": "github" } ], - "time": "2024-01-29T23:53:47+00:00" + "time": "2024-02-05T10:59:13+00:00" }, { "name": "sebastian/cli-parser", @@ -11147,7 +11147,9 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.2", + "ext-openssl": "*", + "ext-dom": "*" }, "platform-dev": [], "platform-overrides": { diff --git a/package.json b/package.json index aaba548b..4b052ef3 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "devDependencies": { "@babel/core": "^7.20.5", "@babel/preset-env": "^7.20.2", - "@symfony/webpack-encore": "^4 <4.5", + "@symfony/webpack-encore": "^4.6.1", "bootstrap-less": "^3.3.8", "core-js": "^3.0.0", "font-awesome": "^4.7.0", diff --git a/src/Surfnet/StepupRa/RaBundle/Assert.php b/src/Surfnet/StepupRa/RaBundle/Assert.php index 905c981d..1f178af9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Assert.php +++ b/src/Surfnet/StepupRa/RaBundle/Assert.php @@ -54,14 +54,14 @@ public static function keysAre(array $array, array $expectedKeys, $propertyPath $required = array_diff($expectedKeys, $givenKeys); $message = 'Keys do not match requirements'; - if (!empty($additional)) { + if ($additional !== []) { $message .= sprintf( ', additional keys "%s" found', implode('", "', array_diff($givenKeys, $expectedKeys)), ); } - if (!empty($required)) { + if ($required !== []) { $message .= sprintf( ', required keys "%s" are missing', implode('", "', array_diff($expectedKeys, $givenKeys)), diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php index a86d08e4..f5c25286 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php @@ -89,7 +89,6 @@ final class ExportRaSecondFactorsCommand /** * Builds the command from a SearchRaSecondFactorsCommand - * @return ExportRaSecondFactorsCommand */ public static function fromSearchCommand(SearchRaSecondFactorsCommand $command): ExportRaSecondFactorsCommand { diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php index 1fe30fcc..8d16e456 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php @@ -41,12 +41,12 @@ class SearchRaCandidatesCommand * message="ra.search_ra_candidates.order_by.invalid_choice" * ) */ - public ?string $orderBy; + public ?string $orderBy = null; /** * @Assert\Choice({"asc", "desc"}, message="ra.search_ra_candidates.order_direction.invalid_choice") */ - public ?string $orderDirection; + public ?string $orderDirection = null; /** * @Assert\GreaterThan(0, message="ra.search_ra_candidates.page_number.greater_than_zero") diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php index 8b6645b6..3ee43c31 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php @@ -28,7 +28,6 @@ final class ExceptionController extends BaseExceptionController { /** - * @param Exception $exception * @return array View parameters 'title' and 'description' */ protected function getPageTitleAndDescription(Exception $exception): array diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 376ae5bf..065cb927 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -47,7 +47,7 @@ public function switchLocale(Request $request): RedirectResponse // Return URLs generated by us always include a path (ie. at least a forward slash) // @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878 $domain = $request->getSchemeAndHttpHost() . '/'; - if (!str_starts_with($returnUrl, $domain)) { + if (!str_starts_with((string) $returnUrl, $domain)) { $this->logger->error(sprintf( 'Identity "%s" used illegal return-url for redirection after changing locale, aborting request', $this->getIdentity()->id, diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index f3450350..afca7d48 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -308,9 +308,6 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI ]); } - /** - * @return Identity - */ private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index fbe7b372..a20b2b3b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -203,9 +203,6 @@ public function auditLog(Request $request): Response ); } - /** - * @return Identity - */ private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 35471e25..00d762b5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -79,7 +79,7 @@ public function startProcedure(Request $request): Response $secondFactor = $this->secondFactorService ->findVerifiedSecondFactorByRegistrationCode($command->registrationCode, $identity->id); - if ($secondFactor === null) { + if (!$secondFactor instanceof \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\VerifiedSecondFactor) { $this->addFlash('error', 'ra.form.start_vetting_procedure.unknown_registration_code'); $this->logger->notice('Cannot start new vetting procedure, no second factor found'); diff --git a/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php b/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php index 2a1a7e6d..c358e23a 100644 --- a/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php +++ b/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php @@ -27,9 +27,6 @@ class DateTime */ private static $now; - /** - * @return CoreDateTime - */ public static function now(): CoreDateTime { return self::$now ?: new CoreDateTime; diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php index c88678a1..a5e4d15c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php @@ -23,14 +23,14 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; -final class LogoutSuccessHandler implements LogoutSuccessHandlerInterface +final readonly class LogoutSuccessHandler implements LogoutSuccessHandlerInterface { /** * @param string[] $logoutRedirectUrl */ public function __construct( - private readonly TokenStorageInterface $tokenStorage, - private readonly array $logoutRedirectUrl, + private TokenStorageInterface $tokenStorage, + private array $logoutRedirectUrl, ) { } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index a908b382..be4b1019 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -57,7 +57,7 @@ public function authenticate(TokenInterface $token): TokenInterface $identity = $this->identityService->findByNameIdAndInstitution($nameId, $institution); // if no identity can be found, we're done. - if ($identity === null) { + if (!$identity instanceof \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity) { throw new BadCredentialsException( 'Unable to find Identity matching the criteria. Has the identity been registered before?', ); @@ -79,7 +79,7 @@ public function authenticate(TokenInterface $token): TokenInterface } // Get authorizations (explicit RA(A) roles use_ra/use_raa). - foreach ($profile->authorizations as $institution => $role) { + foreach ($profile->authorizations as $role) { if ($role[0] == 'raa' && !in_array('ROLE_RAA', $roles)) { $roles[] = 'ROLE_RAA'; } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php index acf40313..2bf16dde 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php @@ -48,9 +48,6 @@ public function __construct( ) { } - /** - * @return bool - */ public function isSamlAuthenticationInitiated(): bool { return $this->samlAuthenticationStateHandler->hasRequestId(); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php index c736ff30..098fda4c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php @@ -30,18 +30,12 @@ public function __construct( ) { } - /** - * @return bool - */ public function sessionLifetimeWithinLimits(AuthenticatedSessionStateHandler $sessionStateHandler): bool { return $this->sessionLifetimeWithinAbsoluteLimit($sessionStateHandler) && $this->sessionLifetimeWithinRelativeLimit($sessionStateHandler); } - /** - * @return bool - */ public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHandler $sessionStateHandler): bool { if (!$sessionStateHandler->isAuthenticationMomentLogged()) { @@ -51,17 +45,9 @@ public function sessionLifetimeWithinAbsoluteLimit(AuthenticatedSessionStateHand $authenticationMoment = $sessionStateHandler->getAuthenticationMoment(); $sessionTimeoutMoment = $this->absoluteTimeoutLimit->getEndWhenStartingAt($authenticationMoment); $now = DateTime::now(); - - if ($now->comesBeforeOrIsEqual($sessionTimeoutMoment)) { - return true; - } - - return false; + return $now->comesBeforeOrIsEqual($sessionTimeoutMoment); } - /** - * @return bool - */ public function sessionLifetimeWithinRelativeLimit(AuthenticatedSessionStateHandler $sessionStateHandler): bool { if (!$sessionStateHandler->hasSeenInteraction()) { @@ -71,11 +57,6 @@ public function sessionLifetimeWithinRelativeLimit(AuthenticatedSessionStateHand $lastInteractionMoment = $sessionStateHandler->getLastInteractionMoment(); $sessionTimeoutMoment = $this->relativeTimeoutLimit->getEndWhenStartingAt($lastInteractionMoment); $now = DateTime::now(); - - if ($now->comesBeforeOrIsEqual($sessionTimeoutMoment)) { - return true; - } - - return false; + return $now->comesBeforeOrIsEqual($sessionTimeoutMoment); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php index a690a27a..fe999f1b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php @@ -29,9 +29,6 @@ public function __construct(private readonly ApiAuditLogService $apiAuditLogServ { } - /** - * @return AuditLog - */ public function getAuditlog(SearchSecondFactorAuditLogCommand $command): AuditLog { $query = new SecondFactorAuditLogSearchQuery($command->institution, $command->identityId, $command->pageNumber); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php index a191e8e0..8d7d15f6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php @@ -44,9 +44,6 @@ public function __construct(private readonly TranslatorInterface $translator, ar $this->supportUrl = $supportUrl; } - /** - * @return string - */ public function getSupportUrl(): string { return $this->supportUrl[$this->translator->getLocale()]; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php index 0a6f911d..63360c6f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php @@ -34,7 +34,6 @@ final class VerificationResult /** * @param string $procedureId - * @return VerificationResult */ public static function verificationSucceeded($procedureId): VerificationResult { @@ -59,7 +58,6 @@ public static function noSuchProcedure(): VerificationResult /** * @param string $procedureId - * @return VerificationResult */ public static function verificationFailed($procedureId): VerificationResult { @@ -74,17 +72,11 @@ public static function verificationFailed($procedureId): VerificationResult return $result; } - /** - * @return bool - */ public function isSuccess(): bool { return $this->verificationSucceeded && $this->procedureId; } - /** - * @return bool - */ public function didVerificationSucceed(): bool { return $this->verificationSucceeded; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index 922e13e7..aad89747 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -38,7 +38,6 @@ public function startVerification($gssfId, $procedureId): void /** * @param string $gssfId - * @return VerificationResult */ public function verify($gssfId): VerificationResult { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php index d7f1d7a4..44b6910b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php @@ -31,7 +31,6 @@ public function __construct( /** * @param string $institution - * @return null|InstitutionConfigurationOptions */ public function getInstitutionConfigurationOptionsFor($institution): ?InstitutionConfigurationOptions { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php index d94197d9..8138ad89 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php @@ -24,7 +24,6 @@ interface InstitutionConfigurationOptionsServiceInterface { /** * @param $institution - * @return null|InstitutionConfigurationOptions */ public function getInstitutionConfigurationOptionsFor($institution): ?InstitutionConfigurationOptions; } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php index 9f624ac8..a2283bdd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php @@ -49,9 +49,6 @@ public function find(string $id): ?RaLocation return $this->apiRaLocationService->get($id); } - /** - * @return RaLocationCollection - */ public function search(SearchRaLocationsCommand $command): RaLocationCollection { $query = new RaLocationSearchQuery($command->institution); @@ -115,9 +112,6 @@ public function change(ChangeRaLocationCommand $command): bool return $result->isSuccessful(); } - /** - * @return bool - */ public function remove(RemoveRaLocationCommand $command): bool { $middlewareCommand = new MiddlewareRemoveRaLocationCommand(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index ed8a8abf..eddebbc9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -338,6 +338,6 @@ private function getProcedure(string $procedureId): ?VettingProcedure public function hasProcedure(string $procedureId): bool { - return $this->vettingProcedureRepository->retrieve($procedureId) !== null; + return $this->vettingProcedureRepository->retrieve($procedureId) instanceof \Surfnet\StepupRa\RaBundle\VettingProcedure; } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php index b7222e45..315c2b0f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php @@ -55,7 +55,7 @@ public function __construct($result, private readonly ?YubikeyPublicId $publicId public function didPublicIdMatch(): bool { - return $this->result === self::RESULT_PUBLIC_ID_MATCHED && $this->publicId !== null; + return $this->result === self::RESULT_PUBLIC_ID_MATCHED && $this->publicId instanceof \Surfnet\StepupBundle\Value\YubikeyPublicId; } public function wasOtpInvalid(): bool @@ -68,9 +68,6 @@ public function didOtpVerificationFail(): bool return $this->result === self::RESULT_OTP_VERIFICATION_FAILED; } - /** - * @return YubikeyPublicId|null - */ public function getPublicId(): ?YubikeyPublicId { return $this->publicId; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php index e45844f8..6e2573c7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php @@ -33,9 +33,6 @@ public function __construct( ) { } - /** - * @return VerificationResult - */ public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command): VerificationResult { $verifyOtpCommand = new VerifyYubikeyOtpCommand(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php index 7f5a97b8..61f3dc9f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php @@ -33,9 +33,6 @@ public function __construct(private readonly Client $guzzleClient, private reado { } - /** - * @return YubikeyVerificationResult - */ public function verify(VerifyYubikeyOtpCommand $command): YubikeyVerificationResult { $this->logger->info('Verifying Yubikey OTP'); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php index 0299df6a..d13710e0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php @@ -28,25 +28,16 @@ public function __construct(private $clientError, private $serverError) { } - /** - * @return bool - */ public function isSuccessful(): bool { return !$this->clientError && !$this->serverError; } - /** - * @return boolean - */ public function isClientError(): bool { return $this->clientError; } - /** - * @return boolean - */ public function isServerError(): bool { return $this->serverError; diff --git a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php index 98465556..c2d103e7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php @@ -30,7 +30,6 @@ final private function __construct(private DateInterval $timeFrame) /** * @param int $seconds - * @return TimeFrame */ public static function ofSeconds($seconds): TimeFrame { @@ -41,17 +40,11 @@ public static function ofSeconds($seconds): TimeFrame return new TimeFrame(new DateInterval('PT' . $seconds . 'S')); } - /** - * @return DateTime - */ public function getEndWhenStartingAt(DateTime $dateTime): DateTime { return $dateTime->add($this->timeFrame); } - /** - * @return bool - */ public function equals(TimeFrame $other): bool { return $this->timeFrame->s === $other->timeFrame->s; diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index 5d6d0b1e..aa151aa1 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -29,17 +29,17 @@ class VettingProcedure private string $id; private string $authorityId; - private ?string $registrationCode; + private ?string $registrationCode = null; private VerifiedSecondFactor $secondFactor; - private ?string $inputSecondFactorIdentifier; + private ?string $inputSecondFactorIdentifier = null; - private ?string $documentNumber; + private ?string $documentNumber = null; - private ?bool $identityVerified; + private ?bool $identityVerified = null; - private ?bool $skipProvePossession; + private ?bool $skipProvePossession = null; final private function __construct() { @@ -83,7 +83,7 @@ public function verifySecondFactorIdentifier(string $secondFactorIdentifier): vo private function isReadyForSecondFactorToBeVerified(): bool { - return !empty($this->registrationCode); + return isset($this->registrationCode) && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0'); } /** @@ -98,11 +98,11 @@ public function verifyIdentity(string $documentNumber, bool $identityVerified): ); } - if (empty($documentNumber)) { + if ($documentNumber === '' || $documentNumber === '0') { throw new InvalidArgumentException('Document number may not be empty.'); } - if ($identityVerified !== true) { + if (!$identityVerified) { throw new DomainException("The registrant's identity must have been confirmed by the RA."); } @@ -112,7 +112,7 @@ public function verifyIdentity(string $documentNumber, bool $identityVerified): private function isReadyForIdentityVerification(): bool { - return $this->isPossessionProvenOrCanItBeSkipped() && !empty($this->registrationCode); + return $this->isPossessionProvenOrCanItBeSkipped() && (isset($this->registrationCode) && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')); } private function isPossessionProvenOrCanItBeSkipped(): bool @@ -137,8 +137,8 @@ public function vet(): void private function isReadyForVetting(): bool { return $this->isPossessionProvenOrCanItBeSkipped() - && !empty($this->registrationCode) - && !empty($this->documentNumber) + && (isset($this->registrationCode) && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')) + && (isset($this->documentNumber) && ($this->documentNumber !== null && $this->documentNumber !== '' && $this->documentNumber !== '0')) && $this->identityVerified === true; } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php index 4b8e7790..43383788 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php @@ -26,9 +26,6 @@ class ViewConfigCollectionPass implements CompilerPassInterface { - /** - * @param ContainerBuilder $container - */ public function process(ContainerBuilder $container): void { if (!$container->has('surfnet_stepup.provider.collection')) { diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php index ce02cb70..1e782334 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php @@ -47,14 +47,14 @@ private function addRoutesSection(ArrayNodeDefinition $rootNode): void ->scalarNode('consume_assertion') ->isRequired() ->validate() - ->ifTrue(fn($v) => !is_string($v) || strlen($v) === 0) + ->ifTrue(fn($v) => !is_string($v) || $v === '') ->thenInvalid('Consume assertion route must be a non-empty string') ->end() ->end() ->scalarNode('metadata') ->isRequired() ->validate() - ->ifTrue(fn($v) => !is_string($v) || strlen($v) === 0) + ->ifTrue(fn($v) => !is_string($v) || $v === '') ->thenInvalid('Metadata route must be a non-empty string') ->end() ->end() diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index 292c31f5..9d50ec5a 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -134,7 +134,6 @@ private function createHostedDefinitions( /** * @param string $provider - * @return Definition */ private function buildHostedEntityDefinition($provider, array $configuration, array $routes): Definition { diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php index e5a79c0a..04230067 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php @@ -35,33 +35,21 @@ public function __construct( ) { } - /** - * @return StateHandler - */ public function getStateHandler(): StateHandler { return $this->stateHandler; } - /** - * @return IdentityProvider - */ public function getRemoteIdentityProvider(): IdentityProvider { return $this->remoteIdentityProvider; } - /** - * @return ServiceProvider - */ public function getServiceProvider(): ServiceProvider { return $this->serviceProvider; } - /** - * @return string - */ public function getName(): string { return $this->name; diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php index 5c32ec02..f4be4307 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php @@ -28,12 +28,7 @@ final class ProviderRepository /** * @var Provider[] */ - private array $providers; - - public function __construct() - { - $this->providers = []; - } + private array $providers = []; public function addProvider(Provider $provider): void { diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php index cd6a0da5..fba45473 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php @@ -20,9 +20,9 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -final class StateHandler +final readonly class StateHandler { - public function __construct(private readonly AttributeBag $attributeBag, private readonly string $provider) + public function __construct(private AttributeBag $attributeBag, private string $provider) { } From a1c51dc7479089fb1f698b098d9cda5c1a73a571 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 16:56:56 +0100 Subject: [PATCH 075/202] Add types --- .../Command/SearchRecoveryTokensCommand.php | 47 +++++-------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php index 73d44ae1..57725393 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php @@ -24,64 +24,39 @@ final class SearchRecoveryTokensCommand { /** * @Assert\NotBlank(message="ra.search_ra_recovery_tokens.actor.blank") - * @Assert\Type("string", message="ra.search_ra_recovery_tokens.actor.type") - * - * @var string */ - public $actorId; + public string $actorId = ''; - /** - * @var string|null - */ - public $name; + public ?string $name = null; - /** - * @var string|null - */ - public $type; + public ?string $type = null; - /** - * @var string - */ - public $status; + public string $status = ''; - /** - * @var string|null - */ - public $email; + public ?string $email = null; /** * @Assert\Choice( * {"name", "type", "email", "status"}, * message="ra.search_ra_recovery_tokens.order_by.invalid_choice" * ) - * - * @var string|null */ - public $orderBy; + public ?string $orderBy = null; /** * @Assert\Choice({"asc", "desc"}, message="ra.search_ra_recovery_tokens.order_direction.invalid_choice") - * - * @var string|null */ - public $orderDirection; + public ?string $orderDirection = null; /** - * @Assert\Type("integer", message="ra.search_ra_recovery_tokens.page_number.type") * @Assert\GreaterThan(0, message="ra.search_ra_recovery_tokens.page_number.greater_than_zero") - * - * @var int */ - public $pageNumber; + public int $pageNumber = 0; /** - * @var string|null The institution to filter the results on + * The institution to filter the results on */ - public $institution; + public ?string $institution = null; - /** - * @var array - */ - public $institutionFilterOptions; + public array $institutionFilterOptions = []; } From 9f4d4d4c5846052235ed8e3d0cc41d913015ba91 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 5 Feb 2024 18:52:51 +0100 Subject: [PATCH 076/202] Add types --- src/Surfnet/StepupRa/RaBundle/VettingProcedure.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index aa151aa1..d938e2da 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -83,7 +83,11 @@ public function verifySecondFactorIdentifier(string $secondFactorIdentifier): vo private function isReadyForSecondFactorToBeVerified(): bool { - return isset($this->registrationCode) && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0'); + return ( + $this->registrationCode !== null && + $this->registrationCode !== '' && + $this->registrationCode !== '0' + ); } /** @@ -112,7 +116,7 @@ public function verifyIdentity(string $documentNumber, bool $identityVerified): private function isReadyForIdentityVerification(): bool { - return $this->isPossessionProvenOrCanItBeSkipped() && (isset($this->registrationCode) && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')); + return $this->isPossessionProvenOrCanItBeSkipped() && ($this->registrationCode !== null && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')); } private function isPossessionProvenOrCanItBeSkipped(): bool @@ -137,8 +141,8 @@ public function vet(): void private function isReadyForVetting(): bool { return $this->isPossessionProvenOrCanItBeSkipped() - && (isset($this->registrationCode) && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')) - && (isset($this->documentNumber) && ($this->documentNumber !== null && $this->documentNumber !== '' && $this->documentNumber !== '0')) + && ($this->registrationCode !== null && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')) + && ($this->documentNumber !== null && ($this->documentNumber !== null && $this->documentNumber !== '' && $this->documentNumber !== '0')) && $this->identityVerified === true; } From 1db21814e6140936a7df61646264250d29f9460b Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 8 Feb 2024 10:55:59 +0100 Subject: [PATCH 077/202] Remove direct dependency --- composer.json | 1 - composer.lock | 32 ++++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index fc364419..4cfdeb3b 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,6 @@ "knplabs/knp-paginator-bundle": "^5.9", "nelmio/security-bundle": "^2.12", "openconext/monitor-bundle": "^3.0", - "ramsey/uuid": "^3.5", "sensiolabs/security-checker": "^6.0", "surfnet/stepup-bundle": "^5.0", "surfnet/stepup-middleware-client-bundle": "^4.1", diff --git a/composer.lock b/composer.lock index fbc6fc3f..5204c543 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7ad63dd3c1408ffcd0693b8953127ea1", + "content-hash": "d3f1f0c1f844f20992a4a9127014a0b9", "packages": [ { "name": "beberlei/assert", @@ -2686,16 +2686,16 @@ }, { "name": "ramsey/uuid", - "version": "3.9.6", + "version": "3.9.7", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3" + "reference": "dc75aa439eb4c1b77f5379fd958b3dc0e6014178" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/ffa80ab953edd85d5b6c004f96181a538aad35a3", - "reference": "ffa80ab953edd85d5b6c004f96181a538aad35a3", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/dc75aa439eb4c1b77f5379fd958b3dc0e6014178", + "reference": "dc75aa439eb4c1b77f5379fd958b3dc0e6014178", "shasum": "" }, "require": { @@ -2732,11 +2732,6 @@ "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "autoload": { "files": [ "src/functions.php" @@ -2787,7 +2782,7 @@ "type": "tidelift" } ], - "time": "2021-09-25T23:07:42+00:00" + "time": "2022-12-19T21:55:10+00:00" }, { "name": "robrichards/xmlseclibs", @@ -5388,16 +5383,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -5411,9 +5406,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5450,7 +5442,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -5466,7 +5458,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-icu", From cc8373fcc2a7cce0c540de938c12ea9fd696e582 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 8 Feb 2024 11:09:18 +0100 Subject: [PATCH 078/202] Change security check to composer audit --- .github/workflows/daily-security-check.yml | 8 +- composer.json | 1 - composer.lock | 220 +-------------------- 3 files changed, 5 insertions(+), 224 deletions(-) diff --git a/.github/workflows/daily-security-check.yml b/.github/workflows/daily-security-check.yml index 51d7d58b..25a73ff2 100644 --- a/.github/workflows/daily-security-check.yml +++ b/.github/workflows/daily-security-check.yml @@ -19,9 +19,9 @@ jobs: uses: andstor/file-existence-action@v2 with: files: "composer.lock" - - name: Run php local security checker - if: steps.check_composer.outputs.files_exists == 'true' - uses: symfonycorp/security-checker-action@v4 + - name: Vulnerability check + run: php composer audit + if: steps.check_composer.outputs.files_exists == 'true' # node-yarn checks - name: Check for node-yarn project @@ -99,4 +99,4 @@ jobs: SLACK_MESSAGE: 'Dependency check failed :crying_cat_face:' SLACK_TITLE: ${{ github.repository }} wants attention SLACK_USERNAME: NightlySecurityCheck - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/composer.json b/composer.json index 4cfdeb3b..71bd290c 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,6 @@ "knplabs/knp-paginator-bundle": "^5.9", "nelmio/security-bundle": "^2.12", "openconext/monitor-bundle": "^3.0", - "sensiolabs/security-checker": "^6.0", "surfnet/stepup-bundle": "^5.0", "surfnet/stepup-middleware-client-bundle": "^4.1", "surfnet/stepup-saml-bundle": "^4.3.2", diff --git a/composer.lock b/composer.lock index 5204c543..b1b84a97 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d3f1f0c1f844f20992a4a9127014a0b9", + "content-hash": "26a0847c52456cae4aa6409fddb413d4", "packages": [ { "name": "beberlei/assert", @@ -2906,59 +2906,6 @@ }, "time": "2020-08-25T19:10:18+00:00" }, - { - "name": "sensiolabs/security-checker", - "version": "v6.0.3", - "source": { - "type": "git", - "url": "https://github.com/sensiolabs/security-checker.git", - "reference": "a576c01520d9761901f269c4934ba55448be4a54" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/security-checker/zipball/a576c01520d9761901f269c4934ba55448be4a54", - "reference": "a576c01520d9761901f269c4934ba55448be4a54", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/console": "^2.8|^3.4|^4.2|^5.0", - "symfony/http-client": "^4.3|^5.0", - "symfony/mime": "^4.3|^5.0", - "symfony/polyfill-ctype": "^1.11" - }, - "bin": [ - "security-checker" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.0-dev" - } - }, - "autoload": { - "psr-4": { - "SensioLabs\\Security\\": "SensioLabs/Security" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien.potencier@gmail.com" - } - ], - "description": "A security checker for your composer.lock", - "support": { - "issues": "https://github.com/sensiolabs/security-checker/issues", - "source": "https://github.com/sensiolabs/security-checker/tree/master" - }, - "abandoned": "https://github.com/fabpot/local-php-security-checker", - "time": "2019-11-01T13:20:14+00:00" - }, { "name": "simplesamlphp/saml2", "version": "v3.2.6", @@ -4570,87 +4517,6 @@ ], "time": "2022-11-05T15:42:31+00:00" }, - { - "name": "symfony/http-client", - "version": "v4.4.49", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client.git", - "reference": "0185497cd61440bdf68df7d81241b97a543e9c3f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/0185497cd61440bdf68df7d81241b97a543e9c3f", - "reference": "0185497cd61440bdf68df7d81241b97a543e9c3f", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2|^3", - "symfony/http-client-contracts": "^1.1.10|^2", - "symfony/polyfill-php73": "^1.11", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.0|^2" - }, - "provide": { - "php-http/async-client-implementation": "*", - "php-http/client-implementation": "*", - "psr/http-client-implementation": "1.0", - "symfony/http-client-implementation": "1.1|2.0" - }, - "require-dev": { - "guzzlehttp/promises": "^1.4", - "nyholm/psr7": "^1.0", - "php-http/httplug": "^1.0|^2.0", - "psr/http-client": "^1.0", - "symfony/dependency-injection": "^4.3|^5.0", - "symfony/http-kernel": "^4.4.13", - "symfony/process": "^4.2|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpClient\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-client/tree/v4.4.49" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-03T19:03:45+00:00" - }, { "name": "symfony/http-client-contracts", "version": "v2.5.2", @@ -5069,90 +4935,6 @@ ], "time": "2022-10-03T15:15:11+00:00" }, - { - "name": "symfony/mime", - "version": "v5.4.35", - "source": { - "type": "git", - "url": "https://github.com/symfony/mime.git", - "reference": "ee94d9b538f93abbbc1ee4ccff374593117b04a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/ee94d9b538f93abbbc1ee4ccff374593117b04a9", - "reference": "ee94d9b538f93abbbc1ee4ccff374593117b04a9", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "egulias/email-validator": "~3.0.0", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<4.4", - "symfony/serializer": "<5.4.35|>=6,<6.3.12|>=6.4,<6.4.3" - }, - "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1|^4", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/property-access": "^4.4|^5.1|^6.0", - "symfony/property-info": "^4.4|^5.1|^6.0", - "symfony/serializer": "^5.4.35|~6.3.12|^6.4.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Mime\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows manipulating MIME messages", - "homepage": "https://symfony.com", - "keywords": [ - "mime", - "mime-type" - ], - "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.35" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-30T08:00:51+00:00" - }, { "name": "symfony/monolog-bridge", "version": "v4.4.43", From 5cd644546a5e63eb81739d16e7c6298d5bfd6087 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 8 Feb 2024 11:09:26 +0100 Subject: [PATCH 079/202] Change security check to composer audit --- symfony.lock | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/symfony.lock b/symfony.lock index a84440e4..b55b579c 100644 --- a/symfony.lock +++ b/symfony.lock @@ -256,18 +256,6 @@ "config/packages/sensio_framework_extra.yaml" ] }, - "sensiolabs/security-checker": { - "version": "4.0", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "4.0", - "ref": "160c9b600564faa1224e8f387d49ef13ceb8b793" - }, - "files": [ - "config/packages/security_checker.yaml" - ] - }, "simplesamlphp/saml2": { "version": "v3.2.6" }, @@ -382,9 +370,6 @@ "src/Kernel.php" ] }, - "symfony/http-client": { - "version": "v4.4.10" - }, "symfony/http-client-contracts": { "version": "v1.1.8" }, @@ -409,9 +394,6 @@ "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" } }, - "symfony/mime": { - "version": "v4.4.10" - }, "symfony/monolog-bridge": { "version": "v4.4.10" }, From 47b56d7f2f3edd862fa65ee5c4e668985f63c607 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 8 Feb 2024 11:40:49 +0100 Subject: [PATCH 080/202] 1st Upgrade to 6.x --- composer.json | 38 +- composer.lock | 4011 ++++++++--------- config/bundles.php | 1 - config/packages/framework.yaml | 3 +- config/packages/jms_translation.yaml | 4 +- config/packages/sensio_framework_extra.yaml | 3 - config/packages/twig.yaml | 1 - .../Controller/ExceptionController.php | 2 +- .../RaBundle/Security/Factory/SamlFactory.php | 29 +- .../RaBundle/Service/IdentityService.php | 2 +- .../RaBundle/SurfnetStepupRaRaBundle.php | 2 +- 11 files changed, 1975 insertions(+), 2121 deletions(-) delete mode 100644 config/packages/sensio_framework_extra.yaml diff --git a/composer.json b/composer.json index 71bd290c..19c50241 100644 --- a/composer.json +++ b/composer.json @@ -14,30 +14,30 @@ "require": { "php": "^8.2", "fortawesome/font-awesome": "~4.2.0", - "guzzlehttp/guzzle": "^6", + "guzzlehttp/guzzle": "^6 || ^7", "incenteev/composer-parameter-handler": "~2.0", "jms/translation-bundle": "^2.1", - "knplabs/knp-paginator-bundle": "^5.9", - "nelmio/security-bundle": "^2.12", - "openconext/monitor-bundle": "^3.0", - "surfnet/stepup-bundle": "^5.0", - "surfnet/stepup-middleware-client-bundle": "^4.1", - "surfnet/stepup-saml-bundle": "^4.3.2", - "symfony/asset": "4.4.* || ^5.1", - "symfony/expression-language": "4.4.* || ^5.1", + "knplabs/knp-paginator-bundle": "^5.9 || ^6.0", + "nelmio/security-bundle": "^2.12 || ^3.0", + "openconext/monitor-bundle": "^3.0 || ^4.0", + "surfnet/stepup-bundle": "^5.0 || ^6.0", + "surfnet/stepup-middleware-client-bundle": "^4.0 || ^5.0.0-beta", + "surfnet/stepup-saml-bundle": "^4.3.2 || ^6.0", + "symfony/asset": "4.4.* || ^5.1 || ^6.0", + "symfony/expression-language": "4.4.* || ^5.1 || ^6.0", "symfony/flex": "^v2.4.3", - "symfony/form": "4.4.* || ^5.1", - "symfony/http-foundation": "^5.0", + "symfony/form": "4.4.* || ^5.1 || ^6.0", + "symfony/http-foundation": "^5.0 || ^6.0", "symfony/monolog-bundle": "^3.5", - "symfony/security-bundle": "4.4.* || ^5.1", - "symfony/translation": "4.4.* || ^5.1", - "symfony/twig-bundle": "4.4.* |^5.1", - "symfony/validator": "4.4.* || ^5.1", + "symfony/security-bundle": "4.4.* || ^5.1 || ^6.0", + "symfony/translation": "4.4.* || ^5.1 || ^6.0", + "symfony/twig-bundle": "4.4.* || ^5.1 || ^6.0", + "symfony/validator": "4.4.* || ^5.1 || ^6.0", "symfony/webpack-encore-bundle": "^1.7", "twbs/bootstrap": "~3.3.0", "twig/extensions": "~1.5", - "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0", + "twig/extra-bundle": "^2.12 || ^3.0", + "twig/twig": "^2.12 || ^3.0", "ext-openssl": "*", "ext-dom": "*" }, @@ -56,7 +56,7 @@ "symfony/maker-bundle": "^1.19", "symfony/phpunit-bridge": "^6.0", "symfony/stopwatch": "^5.1", - "symfony/web-profiler-bundle": "4.4.* || ^5.1" + "symfony/web-profiler-bundle": "4.4.* || ^5.1 || ^6.0" }, "conflict": { "symfony/symfony": "*" @@ -126,7 +126,7 @@ "extra": { "symfony": { "allow-contrib": false, - "require": "4.4.* || ^5.0" + "require": "4.4.* || ^5.0 || ^6.0" }, "symfony-app-dir": "app", "symfony-var-dir": "var", diff --git a/composer.lock b/composer.lock index b1b84a97..2d3c691f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "26a0847c52456cae4aa6409fddb413d4", + "content-hash": "e798a0b3cab869b4de2e9deb1f4e23b9", "packages": [ { "name": "beberlei/assert", @@ -65,18 +65,73 @@ }, "time": "2019-05-28T15:27:37+00:00" }, + { + "name": "brick/math", + "version": "0.11.0", + "source": { + "type": "git", + "url": "https://github.com/brick/math.git", + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^9.0", + "vimeo/psalm": "5.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Brick\\Math\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Arbitrary-precision arithmetic library", + "keywords": [ + "Arbitrary-precision", + "BigInteger", + "BigRational", + "arithmetic", + "bigdecimal", + "bignum", + "brick", + "math" + ], + "support": { + "issues": "https://github.com/brick/math/issues", + "source": "https://github.com/brick/math/tree/0.11.0" + }, + "funding": [ + { + "url": "https://github.com/BenMorel", + "type": "github" + } + ], + "time": "2023-01-15T23:15:59+00:00" + }, { "name": "composer/ca-bundle", - "version": "1.3.2", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "fd5dd441932a7e10ca6e5b490e272d34c8430640" + "reference": "b66d11b7479109ab547f9405b97205640b17d385" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/fd5dd441932a7e10ca6e5b490e272d34c8430640", - "reference": "fd5dd441932a7e10ca6e5b490e272d34c8430640", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385", + "reference": "b66d11b7479109ab547f9405b97205640b17d385", "shasum": "" }, "require": { @@ -88,7 +143,7 @@ "phpstan/phpstan": "^0.12.55", "psr/log": "^1.0", "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { @@ -123,7 +178,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.2" + "source": "https://github.com/composer/ca-bundle/tree/1.4.0" }, "funding": [ { @@ -139,83 +194,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:56:16+00:00" - }, - { - "name": "doctrine/annotations", - "version": "1.14.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", - "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^1 || ^2", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "vimeo/psalm": "^4.10" - }, - "suggest": { - "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.14.3" - }, - "time": "2023-02-01T09:20:38+00:00" + "time": "2023-12-18T12:05:55+00:00" }, { "name": "doctrine/cache", @@ -489,16 +468,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9" + "reference": "c9ea252cdce4da324ede3d6c5913dd89f769afd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/d244f2e6e6bf32bff5174e6729b57214923ecec9", - "reference": "d244f2e6e6bf32bff5174e6729b57214923ecec9", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/c9ea252cdce4da324ede3d6c5913dd89f769afd2", + "reference": "c9ea252cdce4da324ede3d6c5913dd89f769afd2", "shasum": "" }, "require": { @@ -514,9 +493,9 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.10.56", + "phpstan/phpstan": "1.10.57", "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.15", + "phpunit/phpunit": "9.6.16", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", "squizlabs/php_codesniffer": "3.8.1", @@ -582,7 +561,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.0" + "source": "https://github.com/doctrine/dbal/tree/3.8.1" }, "funding": [ { @@ -598,7 +577,7 @@ "type": "tidelift" } ], - "time": "2024-01-25T21:44:02+00:00" + "time": "2024-02-03T17:33:49+00:00" }, { "name": "doctrine/deprecations", @@ -901,28 +880,27 @@ }, { "name": "doctrine/lexer", - "version": "2.1.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" + "vimeo/psalm": "^5.21" }, "type": "library", "autoload": { @@ -959,7 +937,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.0" + "source": "https://github.com/doctrine/lexer/tree/3.0.1" }, "funding": [ { @@ -975,20 +953,20 @@ "type": "tidelift" } ], - "time": "2022-12-14T08:49:07+00:00" + "time": "2024-02-05T11:56:58+00:00" }, { "name": "doctrine/orm", - "version": "2.17.4", + "version": "2.18.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "ccfc97c32f63aaa0988ac6aa42e71c5590bb794d" + "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/ccfc97c32f63aaa0988ac6aa42e71c5590bb794d", - "reference": "ccfc97c32f63aaa0988ac6aa42e71c5590bb794d", + "url": "https://api.github.com/repos/doctrine/orm/zipball/f2176a9ce56cafdfd1624d54bfdb076819083d5b", + "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b", "shasum": "" }, "require": { @@ -1001,7 +979,7 @@ "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3 || ^2", - "doctrine/lexer": "^2", + "doctrine/lexer": "^2 || ^3", "doctrine/persistence": "^2.4 || ^3", "ext-ctype": "*", "php": "^7.1 || ^8.0", @@ -1037,7 +1015,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\ORM\\": "lib/Doctrine/ORM" + "Doctrine\\ORM\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1074,9 +1052,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.17.4" + "source": "https://github.com/doctrine/orm/tree/2.18.0" }, - "time": "2024-01-26T19:41:16+00:00" + "time": "2024-01-31T15:53:12+00:00" }, { "name": "doctrine/persistence", @@ -1230,37 +1208,47 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.5.8", + "version": "7.8.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981" + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981", - "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.9", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17" + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "6.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { @@ -1313,19 +1301,20 @@ } ], "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", "keywords": [ "client", "curl", "framework", "http", "http client", + "psr-18", + "psr-7", "rest", "web service" ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/6.5.8" + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" }, "funding": [ { @@ -1341,38 +1330,37 @@ "type": "tidelift" } ], - "time": "2022-06-20T22:16:07+00:00" + "time": "2023-12-03T20:35:24+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } @@ -1409,7 +1397,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.1" + "source": "https://github.com/guzzle/promises/tree/2.0.2" }, "funding": [ { @@ -1425,42 +1413,48 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:56:57+00:00" + "time": "2023-12-03T20:19:20+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.9.1", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", - "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Psr7\\": "src/" } @@ -1499,6 +1493,11 @@ "name": "Tobias Schultze", "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -1514,7 +1513,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.1" + "source": "https://github.com/guzzle/psr7/tree/2.6.2" }, "funding": [ { @@ -1530,35 +1529,37 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:00:37+00:00" + "time": "2023-12-03T20:05:35+00:00" }, { "name": "incenteev/composer-parameter-handler", - "version": "v2.1.5", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/Incenteev/ParameterHandler.git", - "reference": "e1dd118763503f7fd766f907013e1d76d525fcc4" + "reference": "90bffce926e96b365579a2ef024aab457f4b80c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/e1dd118763503f7fd766f907013e1d76d525fcc4", - "reference": "e1dd118763503f7fd766f907013e1d76d525fcc4", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/90bffce926e96b365579a2ef024aab457f4b80c5", + "reference": "90bffce926e96b365579a2ef024aab457f4b80c5", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/yaml": "^2.3 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "php": ">=7.4", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "composer/composer": "^1.0@dev", - "symfony/filesystem": "^2.3 || ^3 || ^4 || ^5 || ^6.0", - "symfony/phpunit-bridge": "^3.4.47 || ^4.4.41 || ^5.4.8 || ^6.0" + "composer/composer": "^2.0@dev", + "phpspec/prophecy-phpunit": "^2.1", + "phpunit/phpunit": "^9.6", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^6.4.1 || ^7.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -1583,26 +1584,26 @@ ], "support": { "issues": "https://github.com/Incenteev/ParameterHandler/issues", - "source": "https://github.com/Incenteev/ParameterHandler/tree/v2.1.5" + "source": "https://github.com/Incenteev/ParameterHandler/tree/v2.2.0" }, - "time": "2022-05-25T10:57:22+00:00" + "time": "2023-12-09T10:31:14+00:00" }, { "name": "jms/translation-bundle", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSTranslationBundle.git", - "reference": "da38bd07cf3bc375a0db8aa5b839514faae70810" + "reference": "ad89a56dfe9de9485b10dc5d8893665101cd2fa3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/da38bd07cf3bc375a0db8aa5b839514faae70810", - "reference": "da38bd07cf3bc375a0db8aa5b839514faae70810", + "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/ad89a56dfe9de9485b10dc5d8893665101cd2fa3", + "reference": "ad89a56dfe9de9485b10dc5d8893665101cd2fa3", "shasum": "" }, "require": { - "nikic/php-parser": "^4.9", + "nikic/php-parser": "^4.9 || ^5", "php": "^7.4 || ^8.0", "psr/log": "^1.0 || ^2.0", "symfony/config": "^4.3 || ^5.4 || ^6.2", @@ -1671,39 +1672,44 @@ ], "support": { "issues": "https://github.com/schmittjoh/JMSTranslationBundle/issues", - "source": "https://github.com/schmittjoh/JMSTranslationBundle/tree/2.1.0" + "source": "https://github.com/schmittjoh/JMSTranslationBundle/tree/2.2.0" }, - "time": "2023-12-12T09:42:26+00:00" + "time": "2024-02-06T10:14:05+00:00" }, { "name": "knplabs/knp-components", - "version": "v2.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/KnpLabs/knp-components.git", - "reference": "ab7ced8a662e6aa1898b5c4919fe3eb78d62d963" + "reference": "145d74f3fbb24619a60a6f7e54aa4bd10862b07a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/ab7ced8a662e6aa1898b5c4919fe3eb78d62d963", - "reference": "ab7ced8a662e6aa1898b5c4919fe3eb78d62d963", + "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/145d74f3fbb24619a60a6f7e54aa4bd10862b07a", + "reference": "145d74f3fbb24619a60a6f7e54aa4bd10862b07a", "shasum": "" }, "require": { - "php": "^7.2", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher": "^3.4 || ^4.0 || ^5.0", - "symfony/http-foundation": "^3.4 || ^4.0 || ^5.0" + "php": "^7.4 || ^8.0", + "symfony/event-dispatcher-contracts": "^2.0 || ^3.0", + "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0" + }, + "conflict": { + "doctrine/dbal": "<2.10" }, "require-dev": { "doctrine/mongodb-odm": "^2.0", - "doctrine/orm": "^2.5", + "doctrine/orm": "^2.7", "doctrine/phpcr-odm": "^1.2", + "ext-pdo_sqlite": "*", "jackalope/jackalope-doctrine-dbal": "^1.2", - "phpunit/phpunit": "^8.5 || ^9.3", - "ruflin/elastica": "^1.0", - "symfony/http-kernel": "^3.4 || ^4.0 || ^5.0", - "symfony/property-access": "^3.4 || ^4.0 || ^5.0" + "phpunit/phpunit": "^9.5", + "propel/propel1": "^1.7", + "ruflin/elastica": "^7.0", + "solarium/solarium": "^6.0", + "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0", + "symfony/property-access": "^4.4 || ^5.4 || ^6.0" }, "suggest": { "doctrine/common": "to allow usage pagination with Doctrine ArrayCollection", @@ -1751,9 +1757,9 @@ ], "support": { "issues": "https://github.com/KnpLabs/knp-components/issues", - "source": "https://github.com/KnpLabs/knp-components/tree/v2.5.1" + "source": "https://github.com/KnpLabs/knp-components/tree/v3.6.0" }, - "time": "2020-11-27T10:10:33+00:00" + "time": "2022-08-18T06:36:14+00:00" }, { "name": "knplabs/knp-paginator-bundle", @@ -1831,51 +1837,66 @@ }, { "name": "monolog/monolog", - "version": "1.27.1", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "904713c5929655dc9b97288b69cfeedad610c9a1" + "reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1", - "reference": "904713c5929655dc9b97288b69cfeedad610c9a1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c915e2634718dbc8a4a15c61b0e62e7a44e14448", + "reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448", "shasum": "" }, "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0" + "psr/log-implementation": "3.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "aws/aws-sdk-php": "^3.0", "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpstan/phpstan": "^0.12.59", - "phpunit/phpunit": "~4.5", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2.0", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-strict-rules": "^1.4", + "phpunit/phpunit": "^10.1", + "predis/predis": "^1.1 || ^2", + "ruflin/elastica": "^7", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { "psr-4": { "Monolog\\": "src/Monolog" @@ -1889,11 +1910,11 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "homepage": "https://seld.be" } ], "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", + "homepage": "https://github.com/Seldaek/monolog", "keywords": [ "log", "logging", @@ -1901,7 +1922,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.27.1" + "source": "https://github.com/Seldaek/monolog/tree/3.5.0" }, "funding": [ { @@ -1913,106 +1934,56 @@ "type": "tidelift" } ], - "time": "2022-06-09T08:53:42+00:00" - }, - { - "name": "moontoast/math", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/ramsey/moontoast-math.git", - "reference": "5f47d34c87767dbcc08b30377a9827df71de91fa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/moontoast-math/zipball/5f47d34c87767dbcc08b30377a9827df71de91fa", - "reference": "5f47d34c87767dbcc08b30377a9827df71de91fa", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpseclib/bcmath_compat": ">=1.0.3" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "^0.9.0", - "phpunit/phpunit": "^4.8 || ^5.5 || ^6.5 || ^7.0", - "satooshi/php-coveralls": "^0.6.1", - "squizlabs/php_codesniffer": "^2.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Moontoast\\Math\\": "src/Moontoast/Math", - "Moontoast\\Math\\Exception\\": "src/Moontoast/Math/Exception" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "A mathematics library, providing functionality for large numbers", - "homepage": "https://github.com/ramsey/moontoast-math", - "keywords": [ - "bcmath", - "math" - ], - "support": { - "issues": "https://github.com/ramsey/moontoast-math/issues", - "source": "https://github.com/ramsey/moontoast-math" - }, - "abandoned": "brick/math", - "time": "2020-01-05T04:49:34+00:00" + "time": "2023-10-27T15:32:31+00:00" }, { "name": "nelmio/security-bundle", - "version": "v2.12.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/nelmio/NelmioSecurityBundle.git", - "reference": "dc8b8c3ee5c64715486e1e3947f83f4169f4374f" + "reference": "9ae9fabf708ec5899cda46b2d764864bceaa9c8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nelmio/NelmioSecurityBundle/zipball/dc8b8c3ee5c64715486e1e3947f83f4169f4374f", - "reference": "dc8b8c3ee5c64715486e1e3947f83f4169f4374f", + "url": "https://api.github.com/repos/nelmio/NelmioSecurityBundle/zipball/9ae9fabf708ec5899cda46b2d764864bceaa9c8e", + "reference": "9ae9fabf708ec5899cda46b2d764864bceaa9c8e", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99.99", - "php": ">5.4", - "symfony/framework-bundle": "~2.3|~v3.0|~4.0|~5.0|~6.0", - "symfony/security-core": "~2.3|~3.0|~4.0|~5.0|~6.0", - "symfony/security-csrf": "~2.3|~3.0|~4.0|~5.0|~6.0", - "symfony/security-http": "~2.3|~3.0|~4.0|~5.0|~6.0", - "symfony/yaml": "~2.3|~3.0|~4.0|~5.0|~6.0", + "php": "^7.4 || ^8.0", + "symfony/framework-bundle": "^5.4 || ^6.3 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.3 || ^7.0", + "symfony/security-core": "^5.4 || ^6.3 || ^7.0", + "symfony/security-csrf": "^5.4 || ^6.3 || ^7.0", + "symfony/security-http": "^5.4 || ^6.3 || ^7.0", + "symfony/yaml": "^5.4 || ^6.3 || ^7.0", "ua-parser/uap-php": "^3.4.4" }, "require-dev": { - "doctrine/cache": "^1.0", - "psr/cache": "^1.0", - "symfony/phpunit-bridge": "^5.0.5|^6.0", - "twig/twig": "^1.38|^2.10|^3.0" + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan-symfony": "^1.1", + "phpunit/phpunit": "^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/browser-kit": "^5.4 || ^6.3 || ^7.0", + "symfony/cache": "^5.4 || ^6.3 || ^7.0", + "symfony/phpunit-bridge": "^6.3 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.3 || ^7.0", + "twig/twig": "^2.10 || ^3.0" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.11.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Nelmio\\SecurityBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Nelmio\\SecurityBundle\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2034,9 +2005,9 @@ ], "support": { "issues": "https://github.com/nelmio/NelmioSecurityBundle/issues", - "source": "https://github.com/nelmio/NelmioSecurityBundle/tree/v2.12.0" + "source": "https://github.com/nelmio/NelmioSecurityBundle/tree/v3.1.1" }, - "time": "2022-02-23T06:10:58+00:00" + "time": "2024-01-17T14:32:52+00:00" }, { "name": "nikic/php-parser", @@ -2096,34 +2067,34 @@ }, { "name": "openconext/monitor-bundle", - "version": "3.1.0", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/OpenConext/Monitor-bundle.git", - "reference": "719c34a5a00b0a2089ddc52abfe0876fc6ed9049" + "reference": "e0231adc22d7ef9a08ae1b7ccc933261dfe013d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Monitor-bundle/zipball/719c34a5a00b0a2089ddc52abfe0876fc6ed9049", - "reference": "719c34a5a00b0a2089ddc52abfe0876fc6ed9049", + "url": "https://api.github.com/repos/OpenConext/Monitor-bundle/zipball/e0231adc22d7ef9a08ae1b7ccc933261dfe013d5", + "reference": "e0231adc22d7ef9a08ae1b7ccc933261dfe013d5", "shasum": "" }, "require": { "doctrine/orm": "^2.9", - "php": ">=7.2, <9.0-dev", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^4.4|^5.0|^6.0", + "php": ">=8.2, <9.0-dev", + "symfony/dependency-injection": "^5.4|^6.3|^7.0", + "symfony/framework-bundle": "^5.4|^6.3|^7.0", "webmozart/assert": "^1.10" }, "require-dev": { - "malukenho/docheader": "^0.1.8", + "malukenho/docheader": "^1.0", "matthiasnoback/symfony-config-test": "^4.3", "mockery/mockery": "^1.3.5|^1.4.4", "php-parallel-lint/php-parallel-lint": "^1.3", "phpdocumentor/reflection-docblock": "^5.2", - "phpmd/phpmd": "^2.6", + "phpmd/phpmd": "^2.13", "phpunit/php-token-stream": "^3.1.3|^4.0.4", - "phpunit/phpunit": "^8.5|^9.0", + "phpunit/phpunit": "^9.6|^10.4", "sebastian/phpcpd": "^4.1|^5.0|^6.0", "squizlabs/php_codesniffer": "^3.6" }, @@ -2137,7 +2108,7 @@ "license": [ "Apache-2.0" ], - "description": "A Symfony 4/5/6 bundle that facilitates health and info endpoints to a Symfony application. The bundle is backwards compatible with Symfony 2 projects.", + "description": "A Symfony 5/6/7 bundle that facilitates health and info endpoints to a Symfony application.", "keywords": [ "OpenConext", "health", @@ -2147,35 +2118,36 @@ ], "support": { "issues": "https://github.com/OpenConext/Monitor-bundle/issues", - "source": "https://github.com/OpenConext/Monitor-bundle/tree/3.1.0" + "source": "https://github.com/OpenConext/Monitor-bundle/tree/4.1.0" }, - "time": "2022-04-19T12:42:45+00:00" + "time": "2024-01-25T10:06:27+00:00" }, { - "name": "paragonie/constant_time_encoding", - "version": "v2.6.3", + "name": "psr/cache", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "58c3f47f650c94ec05a151692652a868995d2938" + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", - "reference": "58c3f47f650c94ec05a151692652a868995d2938", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": "^7|^8" - }, - "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" + "php": ">=8.0.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { - "ParagonIE\\ConstantTime\\": "src/" + "Psr\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2184,124 +2156,95 @@ ], "authors": [ { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com", - "role": "Maintainer" - }, - { - "name": "Steve 'Sc00bz' Thomas", - "email": "steve@tobtu.com", - "homepage": "https://www.tobtu.com", - "role": "Original Developer" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", + "description": "Common interface for caching libraries", "keywords": [ - "base16", - "base32", - "base32_decode", - "base32_encode", - "base64", - "base64_decode", - "base64_encode", - "bin2hex", - "encoding", - "hex", - "hex2bin", - "rfc4648" + "cache", + "psr", + "psr-6" ], "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/constant_time_encoding/issues", - "source": "https://github.com/paragonie/constant_time_encoding" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2022-06-14T06:56:20+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { - "name": "paragonie/random_compat", - "version": "v9.99.100", + "name": "psr/clock", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", "shasum": "" }, "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + "php": "^7.0 || ^8.0" }, "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" + "clock", + "now", + "psr", + "psr-20", + "time" ], "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" }, - "time": "2020-10-15T08:29:30+00:00" + "time": "2022-11-25T14:36:26+00:00" }, { - "name": "phpseclib/bcmath_compat", - "version": "2.0.1", + "name": "psr/container", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/phpseclib/bcmath_compat.git", - "reference": "2ffea8bfe1702b4535a7b3c2649c4301968e9a3c" + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/bcmath_compat/zipball/2ffea8bfe1702b4535a7b3c2649c4301968e9a3c", - "reference": "2ffea8bfe1702b4535a7b3c2649c4301968e9a3c", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "phpseclib/phpseclib": "^3.0" - }, - "provide": { - "ext-bcmath": "8.1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4", - "squizlabs/php_codesniffer": "^3.0" - }, - "suggest": { - "ext-gmp": "Will enable faster math operations" + "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { - "files": [ - "lib/bcmath.php" - ], "psr-4": { - "bcmath_compat\\": "src" + "Psr\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2310,62 +2253,51 @@ ], "authors": [ { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "homepage": "http://phpseclib.sourceforge.net" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "PHP 5.x-8.x polyfill for bcmath extension", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "BigInteger", - "bcmath", - "bigdecimal", - "math", - "polyfill" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], "support": { - "email": "terrafrost@php.net", - "issues": "https://github.com/phpseclib/bcmath_compat/issues", - "source": "https://github.com/phpseclib/bcmath_compat" + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-12-16T02:35:52+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { - "name": "phpseclib/phpseclib", - "version": "3.0.35", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4b1827beabce71953ca479485c0ae9c51287f2fe", - "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "paragonie/constant_time_encoding": "^1|^2", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "suggest": { - "ext-dom": "Install the DOM extension to load XML formatted public keys.", - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + "php": ">=7.2.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], "psr-4": { - "phpseclib3\\": "phpseclib/" + "Psr\\EventDispatcher\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2374,88 +2306,39 @@ ], "authors": [ { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", + "description": "Standard interfaces for event handling.", "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" + "events", + "psr", + "psr-14" ], "support": { - "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.35" + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "funding": [ - { - "url": "https://github.com/terrafrost", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpseclib", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", - "type": "tidelift" - } - ], - "time": "2023-12-29T01:59:53+00:00" + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "psr/cache", - "version": "2.0.0", + "name": "psr/http-client", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -2465,7 +2348,7 @@ }, "autoload": { "psr-4": { - "Psr\\Cache\\": "src/" + "Psr\\Http\\Client\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2478,38 +2361,46 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for caching libraries", + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", "keywords": [ - "cache", + "http", + "http-client", "psr", - "psr-6" + "psr-18" ], "support": { - "source": "https://github.com/php-fig/cache/tree/2.0.0" + "source": "https://github.com/php-fig/http-client" }, - "time": "2021-02-03T23:23:37+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { - "name": "psr/container", - "version": "1.1.2", + "name": "psr/http-factory", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2522,33 +2413,34 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Common interfaces for PSR-7 HTTP message factories", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { @@ -2557,7 +2449,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2572,7 +2464,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -2586,36 +2478,36 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2636,9 +2528,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/2.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:41:46+00:00" }, { "name": "ralouphie/getallheaders", @@ -2684,54 +2576,153 @@ }, "time": "2019-03-08T08:55:37+00:00" }, + { + "name": "ramsey/collection", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/collection.git", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "captainhook/plugin-composer": "^5.3", + "ergebnis/composer-normalize": "^2.28.3", + "fakerphp/faker": "^1.21", + "hamcrest/hamcrest-php": "^2.0", + "jangregor/phpstan-prophecy": "^1.0", + "mockery/mockery": "^1.5", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcsstandards/phpcsutils": "^1.0.0-rc1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18.4", + "ramsey/coding-standard": "^2.0.3", + "ramsey/conventional-commits": "^1.3", + "vimeo/psalm": "^5.4" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + } + }, + "autoload": { + "psr-4": { + "Ramsey\\Collection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "A PHP library for representing and manipulating collections.", + "keywords": [ + "array", + "collection", + "hash", + "map", + "queue", + "set" + ], + "support": { + "issues": "https://github.com/ramsey/collection/issues", + "source": "https://github.com/ramsey/collection/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], + "time": "2022-12-31T21:50:55+00:00" + }, { "name": "ramsey/uuid", - "version": "3.9.7", + "version": "4.7.5", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "dc75aa439eb4c1b77f5379fd958b3dc0e6014178" + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/dc75aa439eb4c1b77f5379fd958b3dc0e6014178", - "reference": "dc75aa439eb4c1b77f5379fd958b3dc0e6014178", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "shasum": "" }, "require": { + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11", "ext-json": "*", - "paragonie/random_compat": "^1 | ^2 | ^9.99.99", - "php": "^5.4 | ^7.0 | ^8.0", - "symfony/polyfill-ctype": "^1.8" + "php": "^8.0", + "ramsey/collection": "^1.2 || ^2.0" }, "replace": { "rhumsaa/uuid": "self.version" }, "require-dev": { - "codeception/aspect-mock": "^1 | ^2", - "doctrine/annotations": "^1.2", - "goaop/framework": "1.0.0-alpha.2 | ^1 | >=2.1.0 <=2.3.2", - "mockery/mockery": "^0.9.11 | ^1", - "moontoast/math": "^1.1", - "nikic/php-parser": "<=4.5.0", + "captainhook/captainhook": "^5.10", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "doctrine/annotations": "^1.8", + "ergebnis/composer-normalize": "^2.15", + "mockery/mockery": "^1.3", "paragonie/random-lib": "^2", - "php-mock/php-mock-phpunit": "^0.3 | ^1.1 | ^2.6", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpunit/phpunit": ">=4.8.36 <9.0.0 | >=9.3.0", + "php-mock/php-mock": "^2.2", + "php-mock/php-mock-mockery": "^1.3", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpbench/phpbench": "^1.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^8.5 || ^9", + "ramsey/composer-repl": "^1.4", + "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5", - "yoast/phpunit-polyfills": "^1.0" + "vimeo/psalm": "^4.9" }, "suggest": { - "ext-ctype": "Provides support for PHP Ctype functions", - "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", - "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", - "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", - "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", + "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", + "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, "type": "library", + "extra": { + "captainhook": { + "force-install": true + } + }, "autoload": { "files": [ "src/functions.php" @@ -2744,23 +2735,7 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - }, - { - "name": "Marijn Huizendveld", - "email": "marijn.huizendveld@gmail.com" - }, - { - "name": "Thibaud Fabre", - "email": "thibaud@aztech.io" - } - ], - "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", - "homepage": "https://github.com/ramsey/uuid", + "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", "keywords": [ "guid", "identifier", @@ -2768,9 +2743,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "rss": "https://github.com/ramsey/uuid/releases.atom", - "source": "https://github.com/ramsey/uuid", - "wiki": "https://github.com/ramsey/uuid/wiki" + "source": "https://github.com/ramsey/uuid/tree/4.7.5" }, "funding": [ { @@ -2782,7 +2755,7 @@ "type": "tidelift" } ], - "time": "2022-12-19T21:55:10+00:00" + "time": "2023-11-08T05:53:05+00:00" }, { "name": "robrichards/xmlseclibs", @@ -2826,128 +2799,45 @@ }, "time": "2020-09-05T13:00:25+00:00" }, - { - "name": "sensio/framework-extra-bundle", - "version": "v5.6.1", - "source": { - "type": "git", - "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "430d14c01836b77c28092883d195a43ce413ee32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/430d14c01836b77c28092883d195a43ce413ee32", - "reference": "430d14c01836b77c28092883d195a43ce413ee32", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.0", - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0" - }, - "conflict": { - "doctrine/doctrine-cache-bundle": "<1.3.1", - "doctrine/persistence": "<1.3" - }, - "require-dev": { - "doctrine/dbal": "^2.10|^3.0", - "doctrine/doctrine-bundle": "^1.11|^2.0", - "doctrine/orm": "^2.5", - "nyholm/psr7": "^1.1", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/doctrine-bridge": "^4.4|^5.0", - "symfony/dom-crawler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/monolog-bridge": "^4.0|^5.0", - "symfony/monolog-bundle": "^3.2", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9", - "symfony/psr-http-message-bridge": "^1.1", - "symfony/security-bundle": "^4.4|^5.0", - "symfony/twig-bundle": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0", - "twig/twig": "^1.34|^2.4|^3.0" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "5.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Sensio\\Bundle\\FrameworkExtraBundle\\": "src/" - }, - "exclude-from-classmap": [ - "/tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "This bundle provides a way to configure your controllers with annotations", - "keywords": [ - "annotations", - "controllers" - ], - "support": { - "issues": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues", - "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v5.6.1" - }, - "time": "2020-08-25T19:10:18+00:00" - }, { "name": "simplesamlphp/saml2", - "version": "v3.2.6", + "version": "v4.6.11", "source": { "type": "git", "url": "https://github.com/simplesamlphp/saml2.git", - "reference": "a56e46ef8e0c5245a4ca7facc3d308b493215751" + "reference": "1b5d48753c78d02e88667068e633531c233141fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/a56e46ef8e0c5245a4ca7facc3d308b493215751", - "reference": "a56e46ef8e0c5245a4ca7facc3d308b493215751", + "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/1b5d48753c78d02e88667068e633531c233141fb", + "reference": "1b5d48753c78d02e88667068e633531c233141fb", "shasum": "" }, "require": { "ext-dom": "*", "ext-openssl": "*", "ext-zlib": "*", - "php": ">=5.4", - "psr/log": "~1.0", - "robrichards/xmlseclibs": "^3.0" + "php": ">=7.1 || ^8.0", + "psr/log": "~1.1 || ^2.0 || ^3.0", + "robrichards/xmlseclibs": "^3.1.1", + "webmozart/assert": "^1.9" }, "require-dev": { - "mockery/mockery": "~0.9", - "phpmd/phpmd": "~1.5", - "phpunit/phpunit": "~4", - "sebastian/phpcpd": "~1.4", - "sensiolabs/security-checker": "~1.1", - "squizlabs/php_codesniffer": "~1.4" + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "sebastian/phpcpd": "~4.1 || ^5.0 || ^6.0", + "simplesamlphp/simplesamlphp-test-framework": "~0.1.0", + "squizlabs/php_codesniffer": "~3.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "v3.1.x-dev" + "dev-master": "v4.2.x-dev" } }, "autoload": { - "files": [ - "src/_autoload.php" - ], - "psr-0": { - "SAML2\\": "src/" + "psr-4": { + "SAML2\\": "src/SAML2" } }, "notification-url": "https://packagist.org/downloads/", @@ -2963,51 +2853,60 @@ "description": "SAML2 PHP library from SimpleSAMLphp", "support": { "issues": "https://github.com/simplesamlphp/saml2/issues", - "source": "https://github.com/simplesamlphp/saml2/tree/master" + "source": "https://github.com/simplesamlphp/saml2/tree/v4.6.11" }, - "time": "2018-11-20T11:11:28+00:00" + "time": "2024-01-25T19:39:46+00:00" }, { "name": "surfnet/stepup-bundle", - "version": "5.0.4", + "version": "6.0.11", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-bundle.git", - "reference": "c0740f4753635a5b98bb2ef949f6f03e3e83c5c4" + "reference": "f42f7de4fe444a713fbe3a74ff019a29a06c5adb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-bundle/zipball/c0740f4753635a5b98bb2ef949f6f03e3e83c5c4", - "reference": "c0740f4753635a5b98bb2ef949f6f03e3e83c5c4", + "url": "https://api.github.com/repos/OpenConext/Stepup-bundle/zipball/f42f7de4fe444a713fbe3a74ff019a29a06c5adb", + "reference": "f42f7de4fe444a713fbe3a74ff019a29a06c5adb", "shasum": "" }, "require": { "ext-gmp": "*", "ext-json": "*", "ext-openssl": "*", - "guzzlehttp/guzzle": "^6.0", - "monolog/monolog": "~1.11", - "php": "^7.2", - "sensio/framework-extra-bundle": "^5.4", - "surfnet/stepup-saml-bundle": "^4.1.8", - "symfony/config": "^4.4", - "symfony/dependency-injection": "^4.4", - "symfony/form": "^4.4", - "symfony/framework-bundle": "^4.4", - "symfony/http-kernel": "^4.4", - "symfony/twig-bridge": "^4.4", - "symfony/validator": "^4.4" + "guzzlehttp/guzzle": "^7.8", + "monolog/monolog": "^3", + "php": "^8.2", + "surfnet/stepup-saml-bundle": "^6.0", + "symfony/config": "^5.4|^6.3", + "symfony/dependency-injection": "^5.4|^6.3", + "symfony/form": "^5.4|^6.3", + "symfony/framework-bundle": "^5.4|^6.3", + "symfony/http-kernel": "^5.4|^6.3", + "symfony/twig-bridge": "^5.4|^6.3", + "symfony/validator": "^5.4|^6.3" }, "require-dev": { - "mockery/mockery": "^1.3", - "phpmd/phpmd": "^2.0", - "phpunit/phpunit": "^8.0", - "sebastian/phpcpd": "^4.0", - "sensiolabs/security-checker": "^5.0", - "squizlabs/php_codesniffer": "^3.4", - "symfony/phpunit-bridge": "^4.4" + "mockery/mockery": "^1.5", + "overtrue/phplint": "*", + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-symfony": "^1.3", + "phpunit/phpunit": "^9.6", + "sebastian/phpcpd": "^6.0", + "slevomat/coding-standard": "^8.13", + "squizlabs/php_codesniffer": "^3.7.1", + "symfony/phpunit-bridge": "^5.4|^6.3" }, "type": "library", + "extra": { + "phpstan": { + "includes": [ + "./ci/qa/extension.neon" + ] + } + }, "autoload": { "psr-4": { "Surfnet\\StepupBundle\\": "src" @@ -3017,57 +2916,58 @@ "license": [ "Apache-2.0" ], - "description": "A Symfony 3 bundle (with Symfony 4.3 support) that holds shared code and framework integration for all Step-up applications.", + "description": "A Symfony 5|6 bundle that holds shared code and framework integration for all Step-up applications.", "keywords": [ "stepup", - "suaas", - "surfnet" + "surf", + "surf secure id" ], "support": { "issues": "https://github.com/OpenConext/Stepup-bundle/issues", - "source": "https://github.com/OpenConext/Stepup-bundle/tree/5.0.4" + "source": "https://github.com/OpenConext/Stepup-bundle/tree/6.0.11" }, - "time": "2022-08-02T12:43:19+00:00" + "time": "2024-01-23T17:33:14+00:00" }, { "name": "surfnet/stepup-middleware-client-bundle", - "version": "4.1.7", + "version": "5.0.0-beta", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-Middleware-clientbundle.git", - "reference": "b7789f049c26605667224d8d1d2163a17e449f84" + "reference": "60109c376b8442d11fc9647599cafa934ac00b73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-Middleware-clientbundle/zipball/b7789f049c26605667224d8d1d2163a17e449f84", - "reference": "b7789f049c26605667224d8d1d2163a17e449f84", + "url": "https://api.github.com/repos/OpenConext/Stepup-Middleware-clientbundle/zipball/60109c376b8442d11fc9647599cafa934ac00b73", + "reference": "60109c376b8442d11fc9647599cafa934ac00b73", "shasum": "" }, "require": { "beberlei/assert": "~2.0", - "guzzlehttp/guzzle": "^6.0", - "moontoast/math": "~1.1", - "php": "^7.2", - "psr/log": "~1.0", - "ramsey/uuid": "^3.4", - "surfnet/stepup-bundle": "^5.0", - "symfony/config": "^3.4|^4.4", - "symfony/dependency-injection": "^3.4|^4.4", - "symfony/framework-bundle": "^3.4|^4.4", - "symfony/http-kernel": "^3.4|^4.4", - "symfony/validator": "^3.4|^4.4" - }, - "conflict": { - "surfnet/stepup-middleware-client": "*" + "brick/math": "^0.11.0", + "guzzlehttp/guzzle": "^7.8", + "php": "^8.1", + "psr/log": "~2.0", + "ramsey/uuid": "^4.7", + "surfnet/stepup-bundle": "^6.0", + "symfony/config": "^5.4|^6.3", + "symfony/dependency-injection": "^5.4|^6.3", + "symfony/framework-bundle": "^5.4|^6.3", + "symfony/http-kernel": "^5.4|^6.3", + "symfony/validator": "^5.4|^6.3" }, "require-dev": { - "matthiasnoback/symfony-config-test": "^2.0|^3.0|^4.0", - "mockery/mockery": "^1.2", - "phpmd/phpmd": "^2.0", - "phpunit/phpunit": "^7.0|^8.0", - "sebastian/phpcpd": "^2.0", - "sensiolabs/security-checker": "^5.0", - "squizlabs/php_codesniffer": "^3.0" + "matthiasnoback/symfony-config-test": "^4.0|^v5.0.0", + "mockery/mockery": "^1.6", + "overtrue/phplint": "*", + "phpmd/phpmd": "^2.13", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-symfony": "^1.3", + "phpunit/phpunit": "^9.6", + "sebastian/phpcpd": "^6.0", + "slevomat/coding-standard": "^8.13", + "squizlabs/php_codesniffer": "^3.7.1", + "symfony/phpunit-bridge": "^5.4|^6.3" }, "type": "library", "autoload": { @@ -3080,50 +2980,62 @@ "license": [ "Apache-2.0" ], - "description": "Symfony2 bundle for consuming the Step-up Middleware API.", + "description": "Symfony 5|6 bundle for consuming the Step-up Middleware API.", "support": { "issues": "https://github.com/OpenConext/Stepup-Middleware-clientbundle/issues", - "source": "https://github.com/OpenConext/Stepup-Middleware-clientbundle/tree/4.1.7" + "source": "https://github.com/OpenConext/Stepup-Middleware-clientbundle/tree/5.0.0-beta" }, - "time": "2023-08-10T13:24:15+00:00" + "time": "2023-12-19T10:31:50+00:00" }, { "name": "surfnet/stepup-saml-bundle", - "version": "4.4.1", + "version": "6.0.4", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-saml-bundle.git", - "reference": "07be27ec720fb61fc90a11c02e1778f08655cd0f" + "reference": "381d7bcf45aa702f8e691a8103062da7afb8c4e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-saml-bundle/zipball/07be27ec720fb61fc90a11c02e1778f08655cd0f", - "reference": "07be27ec720fb61fc90a11c02e1778f08655cd0f", + "url": "https://api.github.com/repos/OpenConext/Stepup-saml-bundle/zipball/381d7bcf45aa702f8e691a8103062da7afb8c4e9", + "reference": "381d7bcf45aa702f8e691a8103062da7afb8c4e9", "shasum": "" }, "require": { "ext-dom": "*", "ext-openssl": "*", - "php": ">=7.2,<8.0-dev", - "robrichards/xmlseclibs": "^3.0.4", - "simplesamlphp/saml2": "3.2.*", - "symfony/dependency-injection": "^4.4", - "symfony/framework-bundle": "^4.4", - "symfony/templating": "^4.4", - "twig/twig": "^2" + "php": "^8.1", + "robrichards/xmlseclibs": "^3.1.1", + "simplesamlphp/saml2": "^4.6", + "symfony/dependency-injection": "5.4.*|^6", + "symfony/framework-bundle": "5.4.*|^6", + "symfony/security-bundle": "5.4.*|^6", + "symfony/templating": "5.4.*|^6", + "twig/twig": "^2|^3" }, "require-dev": { - "jasny/phpunit-xsdvalidation": "^1.0", - "mockery/mockery": "~0.9", + "ext-zlib": "*", + "mbhsoft/phpunit-xsdvalidation": "^3.0", + "mockery/mockery": "^1.5", + "overtrue/phplint": "*", "phpmd/phpmd": "^2.6", - "phpunit/phpunit": "^5.7", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5", "psr/log": "~1.0", - "sebastian/exporter": "~2.0", - "sebastian/phpcpd": "^2.0", - "squizlabs/php_codesniffer": "^3.0", - "symfony/phpunit-bridge": "^4.4" + "sebastian/exporter": "^4.0.5", + "sebastian/phpcpd": "^6.0", + "squizlabs/php_codesniffer": "^3.7.1", + "symfony/phpunit-bridge": "5.4.*|^6" }, "type": "symfony-bundle", + "extra": { + "phpstan": { + "includes": [ + "./ci/qa/extension.neon" + ] + } + }, "autoload": { "psr-4": { "Surfnet\\SamlBundle\\": "src" @@ -3133,7 +3045,7 @@ "license": [ "Apache-2.0" ], - "description": "A Symfony 4 bundle that integrates the simplesamlphp\\saml2 library with Symfony.", + "description": "A Symfony 5|6 bundle that integrates the simplesamlphp\\saml2 library with Symfony.", "keywords": [ "SAML2", "saml", @@ -3143,39 +3055,34 @@ ], "support": { "issues": "https://github.com/OpenConext/Stepup-saml-bundle/issues", - "source": "https://github.com/OpenConext/Stepup-saml-bundle/tree/4.4.1" + "source": "https://github.com/OpenConext/Stepup-saml-bundle/tree/6.0.4" }, - "time": "2022-05-10T08:37:04+00:00" + "time": "2023-10-10T07:52:25+00:00" }, { "name": "symfony/asset", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "0e98032106d18e57f57176d616e3fae80db7a845" + "reference": "14b1c0fddb64af6ea626af51bb3c47af9fa19cb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/0e98032106d18e57f57176d616e3fae80db7a845", - "reference": "0e98032106d18e57f57176d616e3fae80db7a845", + "url": "https://api.github.com/repos/symfony/asset/zipball/14b1c0fddb64af6ea626af51bb3c47af9fa19cb7", + "reference": "14b1c0fddb64af6ea626af51bb3c47af9fa19cb7", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "conflict": { - "symfony/http-foundation": "<5.3" + "symfony/http-foundation": "<5.4" }, "require-dev": { - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^5.3|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0" - }, - "suggest": { - "symfony/http-foundation": "" + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -3203,7 +3110,7 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v5.4.35" + "source": "https://github.com/symfony/asset/tree/v6.4.3" }, "funding": [ { @@ -3219,62 +3126,61 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/cache", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "db1adb004e2da984085d0178964eb6f319d3cba1" + "reference": "49f8cdee544a621a621cd21b6cda32a38926d310" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/db1adb004e2da984085d0178964eb6f319d3cba1", - "reference": "db1adb004e2da984085d0178964eb6f319d3cba1", + "url": "https://api.github.com/repos/symfony/cache/zipball/49f8cdee544a621a621cd21b6cda32a38926d310", + "reference": "49f8cdee544a621a621cd21b6cda32a38926d310", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0", + "php": ">=8.1", + "psr/cache": "^2.0|^3.0", "psr/log": "^1.1|^2|^3", - "symfony/cache-contracts": "^1.1.7|^2", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/cache-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3", + "symfony/var-exporter": "^6.3.6|^7.0" }, "conflict": { "doctrine/dbal": "<2.13.1", - "symfony/dependency-injection": "<4.4", - "symfony/http-kernel": "<4.4", - "symfony/var-dumper": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/var-dumper": "<5.4" }, "provide": { - "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0|2.0", - "symfony/cache-implementation": "1.0|2.0" + "psr/cache-implementation": "2.0|3.0", + "psr/simple-cache-implementation": "1.0|2.0|3.0", + "symfony/cache-implementation": "1.1|2.0|3.0" }, "require-dev": { "cache/integration-tests": "dev-master", - "doctrine/cache": "^1.6|^2.0", "doctrine/dbal": "^2.13.1|^3|^4", - "predis/predis": "^1.1", - "psr/simple-cache": "^1.0|^2.0", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/messenger": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "predis/predis": "^1.1|^2.0", + "psr/simple-cache": "^1.0|^2.0|^3.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/filesystem": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Cache\\": "" }, + "classmap": [ + "Traits/ValueWrapper.php" + ], "exclude-from-classmap": [ "/Tests/" ] @@ -3300,7 +3206,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.4.35" + "source": "https://github.com/symfony/cache/tree/v6.4.3" }, "funding": [ { @@ -3316,33 +3222,30 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/cache-contracts", - "version": "v2.5.2", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" + "reference": "1d74b127da04ffa87aa940abe15446fa89653778" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/1d74b127da04ffa87aa940abe15446fa89653778", + "reference": "1d74b127da04ffa87aa940abe15446fa89653778", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0|^3.0" - }, - "suggest": { - "symfony/cache-implementation": "" + "php": ">=8.1", + "psr/cache": "^3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3379,7 +3282,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/cache-contracts/tree/v3.4.0" }, "funding": [ { @@ -3395,46 +3298,37 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-09-25T12:52:38+00:00" }, { - "name": "symfony/config", - "version": "v4.4.44", + "name": "symfony/clock", + "version": "v6.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "ed42f8f9da528d2c6cae36fe1f380b0c1d8f0658" + "url": "https://github.com/symfony/clock.git", + "reference": "f48770105c544001da00b8d745873a628e0de198" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/ed42f8f9da528d2c6cae36fe1f380b0c1d8f0658", - "reference": "ed42f8f9da528d2c6cae36fe1f380b0c1d8f0658", + "url": "https://api.github.com/repos/symfony/clock/zipball/f48770105c544001da00b8d745873a628e0de198", + "reference": "f48770105c544001da00b8d745873a628e0de198", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/filesystem": "^3.4|^4.0|^5.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22" - }, - "conflict": { - "symfony/finder": "<3.4" - }, - "require-dev": { - "symfony/event-dispatcher": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/messenger": "^4.1|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" + "php": ">=8.1", + "psr/clock": "^1.0", + "symfony/polyfill-php83": "^1.28" }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" + "provide": { + "psr/clock-implementation": "1.0" }, "type": "library", "autoload": { + "files": [ + "Resources/now.php" + ], "psr-4": { - "Symfony\\Component\\Config\\": "" + "Symfony\\Component\\Clock\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3446,18 +3340,23 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", + "description": "Decouples applications from the system clock", "homepage": "https://symfony.com", + "keywords": [ + "clock", + "psr20", + "time" + ], "support": { - "source": "https://github.com/symfony/config/tree/v4.4.44" + "source": "https://github.com/symfony/clock/tree/v6.4.3" }, "funding": [ { @@ -3473,58 +3372,43 @@ "type": "tidelift" } ], - "time": "2022-07-20T09:59:04+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { - "name": "symfony/console", - "version": "v4.4.49", + "name": "symfony/config", + "version": "v6.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9" + "url": "https://github.com/symfony/config.git", + "reference": "206482ff3ed450495b1d5b7bad1bc3a852def96f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", - "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", + "url": "https://api.github.com/repos/symfony/config/zipball/206482ff3ed450495b1d5b7bad1bc3a852def96f", + "reference": "206482ff3ed450495b1d5b7bad1bc3a852def96f", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/filesystem": "^5.4|^6.0|^7.0", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/lock": "<4.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" + "symfony/finder": "<5.4", + "symfony/service-contracts": "<2.5" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Console\\": "" + "Symfony\\Component\\Config\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3544,10 +3428,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Eases the creation of beautiful and testable command line interfaces", + "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.49" + "source": "https://github.com/symfony/config/tree/v6.4.3" }, "funding": [ { @@ -3563,36 +3447,61 @@ "type": "tidelift" } ], - "time": "2022-11-05T17:10:16+00:00" + "time": "2024-01-29T13:26:27+00:00" }, { - "name": "symfony/debug", - "version": "v4.4.44", + "name": "symfony/console", + "version": "v5.4.35", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "1a692492190773c5310bc7877cb590c04c2f05be" + "url": "https://github.com/symfony/console.git", + "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be", - "reference": "1a692492190773c5310bc7877cb590c04c2f05be", + "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931", + "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2|^3" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { - "symfony/http-kernel": "<3.4" + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3612,10 +3521,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides tools to ease debugging PHP code", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.44" + "source": "https://github.com/symfony/console/tree/v5.4.35" }, "funding": [ { @@ -3631,50 +3546,44 @@ "type": "tidelift" } ], - "abandoned": "symfony/error-handler", - "time": "2022-07-28T16:29:46+00:00" + "time": "2024-01-23T14:28:09+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.4.49", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "9065fe97dbd38a897e95ea254eb5ddfe1310f734" + "reference": "6871811c5a5c5e180244ddb689746446db02c05b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/9065fe97dbd38a897e95ea254eb5ddfe1310f734", - "reference": "9065fe97dbd38a897e95ea254eb5ddfe1310f734", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6871811c5a5c5e180244ddb689746446db02c05b", + "reference": "6871811c5a5c5e180244ddb689746446db02c05b", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/container": "^1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1.6|^2" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.2.10|^7.0" }, "conflict": { - "symfony/config": "<4.3|>=5.0", - "symfony/finder": "<3.4", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<4.4.26" + "ext-psr": "<1.1|>=2", + "symfony/config": "<6.1", + "symfony/finder": "<5.4", + "symfony/proxy-manager-bridge": "<6.3", + "symfony/yaml": "<5.4" }, "provide": { - "psr/container-implementation": "1.0", - "symfony/service-implementation": "1.0|2.0" + "psr/container-implementation": "1.1|2.0", + "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^4.3", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/yaml": "^4.4.26|^5.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" + "symfony/config": "^6.1|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -3702,7 +3611,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v4.4.49" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.3" }, "funding": [ { @@ -3718,29 +3627,29 @@ "type": "tidelift" } ], - "time": "2022-11-16T16:18:09+00:00" + "time": "2024-01-30T08:32:12+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3769,7 +3678,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -3785,32 +3694,39 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/error-handler", - "version": "v4.4.44", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "be731658121ef2d8be88f3a1ec938148a9237291" + "reference": "6dc3c76a278b77f01d864a6005d640822c6f26a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/be731658121ef2d8be88f3a1ec938148a9237291", - "reference": "be731658121ef2d8be88f3a1ec938148a9237291", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/6dc3c76a278b77f01d864a6005d640822c6f26a6", + "reference": "6dc3c76a278b77f01d864a6005d640822c6f26a6", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/debug": "^4.4.5", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/var-dumper": "^5.4|^6.0|^7.0" + }, + "conflict": { + "symfony/deprecation-contracts": "<2.5", + "symfony/http-kernel": "<6.4" }, "require-dev": { - "symfony/http-kernel": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/serializer": "^5.4|^6.0|^7.0" }, + "bin": [ + "Resources/bin/patch-type-declarations" + ], "type": "library", "autoload": { "psr-4": { @@ -3837,7 +3753,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v4.4.44" + "source": "https://github.com/symfony/error-handler/tree/v6.4.3" }, "funding": [ { @@ -3853,47 +3769,43 @@ "type": "tidelift" } ], - "time": "2022-07-28T16:29:46+00:00" + "time": "2024-01-29T15:40:36+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.44", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a" + "reference": "ae9d3a6f3003a6caf56acd7466d8d52378d44fef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1e866e9e5c1b22168e0ce5f0b467f19bba61266a", - "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae9d3a6f3003a6caf56acd7466d8d52378d44fef", + "reference": "ae9d3a6f3003a6caf56acd7466d8d52378d44fef", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -3921,7 +3833,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.44" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.3" }, "funding": [ { @@ -3937,33 +3849,30 @@ "type": "tidelift" } ], - "time": "2022-07-20T09:59:04+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.10.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "761c8b8387cfe5f8026594a75fdf0a4e83ba6974" + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/761c8b8387cfe5f8026594a75fdf0a4e83ba6974", - "reference": "761c8b8387cfe5f8026594a75fdf0a4e83ba6974", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", "shasum": "" }, "require": { - "php": ">=7.1.3" - }, - "suggest": { - "psr/event-dispatcher": "", - "symfony/event-dispatcher-implementation": "" + "php": ">=8.1", + "psr/event-dispatcher": "^1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -4000,7 +3909,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.10.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.0" }, "funding": [ { @@ -4016,26 +3925,27 @@ "type": "tidelift" } ], - "time": "2022-07-20T09:59:04+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/expression-language", - "version": "v4.4.47", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "e4964c7636e19f6008660f450c09121c80c2a7b9" + "reference": "b4a4ae33fbb33a99d23c5698faaecadb76ad0fe4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/e4964c7636e19f6008660f450c09121c80c2a7b9", - "reference": "e4964c7636e19f6008660f450c09121c80c2a7b9", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/b4a4ae33fbb33a99d23c5698faaecadb76ad0fe4", + "reference": "b4a4ae33fbb33a99d23c5698faaecadb76ad0fe4", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/cache": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2" + "php": ">=8.1", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -4063,7 +3973,7 @@ "description": "Provides an engine that can compile and evaluate expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/expression-language/tree/v4.4.47" + "source": "https://github.com/symfony/expression-language/tree/v6.4.3" }, "funding": [ { @@ -4079,27 +3989,26 @@ "type": "tidelift" } ], - "time": "2022-10-03T15:15:11+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086" + "reference": "7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5a553607d4ffbfa9c0ab62facadea296c9db7086", - "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb", + "reference": "7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -4127,7 +4036,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.35" + "source": "https://github.com/symfony/filesystem/tree/v6.4.3" }, "funding": [ { @@ -4143,7 +4052,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/finder", @@ -4210,16 +4119,16 @@ }, { "name": "symfony/flex", - "version": "v2.4.3", + "version": "v2.4.4", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "6b44ac75c7f07f48159ec36c2d21ef8cf48a21b1" + "reference": "bec213c39511eda66663baa2ee7440c65f89c695" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/6b44ac75c7f07f48159ec36c2d21ef8cf48a21b1", - "reference": "6b44ac75c7f07f48159ec36c2d21ef8cf48a21b1", + "url": "https://api.github.com/repos/symfony/flex/zipball/bec213c39511eda66663baa2ee7440c65f89c695", + "reference": "bec213c39511eda66663baa2ee7440c65f89c695", "shasum": "" }, "require": { @@ -4255,7 +4164,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v2.4.3" + "source": "https://github.com/symfony/flex/tree/v2.4.4" }, "funding": [ { @@ -4271,61 +4180,60 @@ "type": "tidelift" } ], - "time": "2024-01-02T11:08:32+00:00" + "time": "2024-02-05T18:04:53+00:00" }, { "name": "symfony/form", - "version": "v4.4.48", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "e1d137b13e0ec2cb5c5e38debca7a510c6f858c6" + "reference": "dabf7e9375550aada8916ced1736d01c2e3debff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/e1d137b13e0ec2cb5c5e38debca7a510c6f858c6", - "reference": "e1d137b13e0ec2cb5c5e38debca7a510c6f858c6", + "url": "https://api.github.com/repos/symfony/form/zipball/dabf7e9375550aada8916ced1736d01c2e3debff", + "reference": "dabf7e9375550aada8916ced1736d01c2e3debff", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher": "^4.3", - "symfony/intl": "^4.4|^5.0", - "symfony/options-resolver": "~4.3|^5.0", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/options-resolver": "^5.4|^6.0|^7.0", "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-icu": "^1.21", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/property-access": "^3.4.40|^4.4.8|^5.0.8", - "symfony/service-contracts": "^1.1|^2" + "symfony/property-access": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<4.3", - "symfony/dependency-injection": "<3.4", - "symfony/doctrine-bridge": "<3.4", - "symfony/framework-bundle": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/intl": "<4.3", - "symfony/translation": "<4.2", - "symfony/twig-bridge": "<3.4.5|<4.0.5,>=4.0" + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/doctrine-bridge": "<5.4.21|>=6,<6.2.7", + "symfony/error-handler": "<5.4", + "symfony/framework-bundle": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/translation": "<5.4.35|>=6.0,<6.3.12|>=6.4,<6.4.3|>=7.0,<7.0.3", + "symfony/translation-contracts": "<2.5", + "symfony/twig-bridge": "<6.3" }, "require-dev": { - "doctrine/collections": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^4.3|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/security-csrf": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2|^5.0", - "symfony/validator": "^4.4.17|^5.1.9", - "symfony/var-dumper": "^4.3|^5.0" - }, - "suggest": { - "symfony/security-csrf": "For protecting forms against CSRF attacks.", - "symfony/twig-bridge": "For templating with Twig.", - "symfony/validator": "For form validation." + "doctrine/collections": "^1.0|^2.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/html-sanitizer": "^6.1|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/security-core": "^6.2|^7.0", + "symfony/security-csrf": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4.35|~6.3.12|^6.4.3|^7.0.3", + "symfony/uid": "^5.4|^6.0|^7.0", + "symfony/validator": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -4353,7 +4261,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v4.4.48" + "source": "https://github.com/symfony/form/tree/v6.4.3" }, "funding": [ { @@ -4369,109 +4277,111 @@ "type": "tidelift" } ], - "time": "2022-10-22T05:50:33+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/framework-bundle", - "version": "v4.4.51", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "8f1698ff2a97be8442fb202ac93111f7b6b40781" + "reference": "fb413ac4483803954411966a39f3a9204835848e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/8f1698ff2a97be8442fb202ac93111f7b6b40781", - "reference": "8f1698ff2a97be8442fb202ac93111f7b6b40781", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/fb413ac4483803954411966a39f3a9204835848e", + "reference": "fb413ac4483803954411966a39f3a9204835848e", "shasum": "" }, "require": { + "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=7.1.3", - "symfony/cache": "^4.4|^5.0", - "symfony/config": "^4.4.11|~5.0.11|^5.1.3", - "symfony/dependency-injection": "^4.4.38|^5.0.1", - "symfony/error-handler": "^4.4.1|^5.0.1", - "symfony/filesystem": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/http-kernel": "^4.4", + "php": ">=8.1", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/config": "^6.1|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/error-handler": "^6.1|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/filesystem": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/routing": "^4.4.12|^5.1.4" + "symfony/routing": "^6.4|^7.0" }, "conflict": { + "doctrine/annotations": "<1.13.1", "doctrine/persistence": "<1.3", - "phpdocumentor/reflection-docblock": "<3.0|>=3.2.0,<3.2.2", - "phpdocumentor/type-resolver": "<0.3.0|1.3.*", - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/asset": "<3.4", - "symfony/browser-kit": "<4.3", - "symfony/console": "<4.4.21", - "symfony/dom-crawler": "<4.3", - "symfony/dotenv": "<4.3.6", - "symfony/form": "<4.3.5", - "symfony/http-client": "<4.4", - "symfony/lock": "<4.4", - "symfony/mailer": "<4.4", - "symfony/messenger": "<4.4", - "symfony/mime": "<4.4", - "symfony/property-info": "<3.4", - "symfony/security-bundle": "<4.4", - "symfony/serializer": "<4.4", - "symfony/stopwatch": "<3.4", - "symfony/translation": "<4.4", - "symfony/twig-bridge": "<4.1.1", - "symfony/twig-bundle": "<4.4", - "symfony/validator": "<4.4", - "symfony/web-profiler-bundle": "<4.4", - "symfony/workflow": "<4.3.6" + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/asset": "<5.4", + "symfony/asset-mapper": "<6.4", + "symfony/clock": "<6.3", + "symfony/console": "<5.4|>=7.0", + "symfony/dom-crawler": "<6.4", + "symfony/dotenv": "<5.4", + "symfony/form": "<5.4", + "symfony/http-client": "<6.3", + "symfony/lock": "<5.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<6.3", + "symfony/mime": "<6.4", + "symfony/property-access": "<5.4", + "symfony/property-info": "<5.4", + "symfony/scheduler": "<6.4.3|>=7.0.0,<7.0.3", + "symfony/security-core": "<5.4", + "symfony/security-csrf": "<5.4", + "symfony/serializer": "<6.4", + "symfony/stopwatch": "<5.4", + "symfony/translation": "<6.4", + "symfony/twig-bridge": "<5.4", + "symfony/twig-bundle": "<5.4", + "symfony/validator": "<6.4", + "symfony/web-profiler-bundle": "<6.4", + "symfony/workflow": "<6.4" }, "require-dev": { - "doctrine/annotations": "^1.10.4", - "doctrine/cache": "^1.0|^2.0", + "doctrine/annotations": "^1.13.1|^2", "doctrine/persistence": "^1.3|^2|^3", - "paragonie/sodium_compat": "^1.8", + "dragonmantank/cron-expression": "^3.1", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/asset": "^3.4|^4.0|^5.0", - "symfony/browser-kit": "^4.3|^5.0", - "symfony/console": "^4.4.42|^5.4.9", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dom-crawler": "^4.4.30|^5.3.7", - "symfony/dotenv": "^4.3.6|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/form": "^4.3.5|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/mailer": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0", + "seld/jsonlint": "^1.10", + "symfony/asset": "^5.4|^6.0|^7.0", + "symfony/asset-mapper": "^6.4|^7.0", + "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/clock": "^6.2|^7.0", + "symfony/console": "^5.4.9|^6.0.9|^7.0", + "symfony/css-selector": "^5.4|^6.0|^7.0", + "symfony/dom-crawler": "^6.4|^7.0", + "symfony/dotenv": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/form": "^5.4|^6.0|^7.0", + "symfony/html-sanitizer": "^6.1|^7.0", + "symfony/http-client": "^6.3|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/mailer": "^5.4|^6.0|^7.0", + "symfony/messenger": "^6.3|^7.0", + "symfony/mime": "^6.4|^7.0", + "symfony/notifier": "^5.4|^6.0|^7.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/property-info": "^3.4|^4.0|^5.0", - "symfony/security-core": "^3.4|^4.4|^5.2", - "symfony/security-csrf": "^3.4|^4.0|^5.0", - "symfony/security-http": "^3.4|^4.0|^5.0", - "symfony/serializer": "^4.4|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.4|^5.0", - "symfony/twig-bundle": "^4.4|^5.0", - "symfony/validator": "^4.4|^5.0", - "symfony/web-link": "^4.4|^5.0", - "symfony/workflow": "^4.3.6|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" - }, - "suggest": { - "ext-apcu": "For best performance of the system caches", - "symfony/console": "For using the console commands", - "symfony/form": "For using forms", - "symfony/property-info": "For using the property_info service", - "symfony/serializer": "For using the serializer service", - "symfony/validator": "For using validation", - "symfony/web-link": "For using web links, features such as preloading, prefetching or prerendering", - "symfony/yaml": "For using the debug:config and lint:yaml commands" + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/property-info": "^5.4|^6.0|^7.0", + "symfony/rate-limiter": "^5.4|^6.0|^7.0", + "symfony/scheduler": "^6.4.3|^7.0.3", + "symfony/security-bundle": "^5.4|^6.0|^7.0", + "symfony/semaphore": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/string": "^5.4|^6.0|^7.0", + "symfony/translation": "^6.4|^7.0", + "symfony/twig-bundle": "^5.4|^6.0|^7.0", + "symfony/uid": "^5.4|^6.0|^7.0", + "symfony/validator": "^6.4|^7.0", + "symfony/web-link": "^5.4|^6.0|^7.0", + "symfony/workflow": "^6.4|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0", + "twig/twig": "^2.10|^3.0" }, "type": "symfony-bundle", "autoload": { @@ -4499,85 +4409,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v4.4.51" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-05T15:42:31+00:00" - }, - { - "name": "symfony/http-client-contracts", - "version": "v2.5.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/http-client-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/framework-bundle/tree/v6.4.3" }, "funding": [ { @@ -4593,211 +4425,45 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2024-01-29T15:02:55+00:00" }, { "name": "symfony/http-foundation", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "f2ab692a22aef1cd54beb893aa0068bdfb093928" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f2ab692a22aef1cd54beb893aa0068bdfb093928", - "reference": "f2ab692a22aef1cd54beb893aa0068bdfb093928", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4", - "symfony/mime": "^4.4|^5.0|^6.0", - "symfony/rate-limiter": "^5.2|^6.0" - }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Defines an object-oriented layer for the HTTP specification", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.35" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-23T13:51:25+00:00" - }, - { - "name": "symfony/http-kernel", - "version": "v4.4.51", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "ad8ab192cb619ff7285c95d28c69b36d718416c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ad8ab192cb619ff7285c95d28c69b36d718416c7", - "reference": "ad8ab192cb619ff7285c95d28c69b36d718416c7", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2", - "symfony/error-handler": "^4.4", - "symfony/event-dispatcher": "^4.4", - "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^4.4.30|^5.3.7", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/browser-kit": "<4.3", - "symfony/config": "<3.4", - "symfony/console": ">=5", - "symfony/dependency-injection": "<4.3", - "symfony/translation": "<4.2", - "twig/twig": "<1.43|<2.13,>=2" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^4.3|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^4.3|^5.0", - "symfony/dom-crawler": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/routing": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^1.43|^2.13|^3.0.4" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a structured process for converting a Request into a Response", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-kernel/tree/v4.4.51" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-11-10T13:31:29+00:00" - }, - { - "name": "symfony/inflector", - "version": "v4.4.44", - "source": { - "type": "git", - "url": "https://github.com/symfony/inflector.git", - "reference": "66185be61805b1e44a5c4000929e700228d426cc" + "reference": "5677bdf7cade4619cb17fc9e1e7b31ec392244a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/66185be61805b1e44a5c4000929e700228d426cc", - "reference": "66185be61805b1e44a5c4000929e700228d426cc", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5677bdf7cade4619cb17fc9e1e7b31ec392244a9", + "reference": "5677bdf7cade4619cb17fc9e1e7b31ec392244a9", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" + }, + "conflict": { + "symfony/cache": "<6.3" + }, + "require-dev": { + "doctrine/dbal": "^2.13.1|^3|^4", + "predis/predis": "^1.1|^2.0", + "symfony/cache": "^6.3|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4|^7.0", + "symfony/mime": "^5.4|^6.0|^7.0", + "symfony/rate-limiter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Inflector\\": "" + "Symfony\\Component\\HttpFoundation\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -4809,26 +4475,18 @@ ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Converts words between their singular and plural forms (English only)", + "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string", - "symfony", - "words" - ], "support": { - "source": "https://github.com/symfony/inflector/tree/v4.4.44" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.3" }, "funding": [ { @@ -4844,42 +4502,82 @@ "type": "tidelift" } ], - "abandoned": "EnglishInflector from the String component", - "time": "2022-07-20T09:59:04+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { - "name": "symfony/intl", - "version": "v4.4.47", + "name": "symfony/http-kernel", + "version": "v6.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/intl.git", - "reference": "f1d0f9d91ab482d33423b788999fbb43c34a9a59" + "url": "https://github.com/symfony/http-kernel.git", + "reference": "9c6ec4e543044f7568a53a76ab1484ecd30637a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/f1d0f9d91ab482d33423b788999fbb43c34a9a59", - "reference": "f1d0f9d91ab482d33423b788999fbb43c34a9a59", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9c6ec4e543044f7568a53a76ab1484ecd30637a2", + "reference": "9c6ec4e543044f7568a53a76ab1484ecd30637a2", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/error-handler": "^6.4|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/polyfill-ctype": "^1.8" }, - "require-dev": { - "symfony/filesystem": "^3.4|^4.0|^5.0" + "conflict": { + "symfony/browser-kit": "<5.4", + "symfony/cache": "<5.4", + "symfony/config": "<6.1", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<6.4", + "symfony/doctrine-bridge": "<5.4", + "symfony/form": "<5.4", + "symfony/http-client": "<5.4", + "symfony/http-client-contracts": "<2.5", + "symfony/mailer": "<5.4", + "symfony/messenger": "<5.4", + "symfony/translation": "<5.4", + "symfony/translation-contracts": "<2.5", + "symfony/twig-bridge": "<5.4", + "symfony/validator": "<6.4", + "symfony/var-dumper": "<6.3", + "twig/twig": "<2.13" }, - "suggest": { - "ext-intl": "to use the component with locales other than \"en\"" + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/clock": "^6.2|^7.0", + "symfony/config": "^6.1|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/css-selector": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/dom-crawler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/property-access": "^5.4.5|^6.0.5|^7.0", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.3|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/translation-contracts": "^2.5|^3", + "symfony/uid": "^5.4|^6.0|^7.0", + "symfony/validator": "^6.4|^7.0", + "symfony/var-exporter": "^6.2|^7.0", + "twig/twig": "^2.13|^3.0.4" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Intl\\": "" + "Symfony\\Component\\HttpKernel\\": "" }, - "classmap": [ - "Resources/stubs" - ], "exclude-from-classmap": [ "/Tests/" ] @@ -4890,34 +4588,18 @@ ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - }, - { - "name": "Eriksen Costa", - "email": "eriksen.costa@infranology.com.br" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library", + "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", - "keywords": [ - "i18n", - "icu", - "internationalization", - "intl", - "l10n", - "localization" - ], "support": { - "source": "https://github.com/symfony/intl/tree/v4.4.47" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.3" }, "funding": [ { @@ -4933,43 +4615,42 @@ "type": "tidelift" } ], - "time": "2022-10-03T15:15:11+00:00" + "time": "2024-01-31T07:21:29+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v4.4.43", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "ad09c9980b912e757c4ecd8363cebf3039d1d471" + "reference": "1e1ec293f15dcc815146637ee9ee8a7f43642fa1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/ad09c9980b912e757c4ecd8363cebf3039d1d471", - "reference": "ad09c9980b912e757c4ecd8363cebf3039d1d471", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/1e1ec293f15dcc815146637ee9ee8a7f43642fa1", + "reference": "1e1ec293f15dcc815146637ee9ee8a7f43642fa1", "shasum": "" }, "require": { - "monolog/monolog": "^1.25.1", - "php": ">=7.1.3", - "symfony/http-kernel": "^4.3", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" + "monolog/monolog": "^1.25.1|^2|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "symfony/console": "<3.4", - "symfony/http-foundation": "<3.4" + "symfony/console": "<5.4", + "symfony/http-foundation": "<5.4", + "symfony/security-core": "<6.0" }, "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/security-core": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings.", - "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", - "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/mailer": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/mime": "^5.4|^6.0|^7.0", + "symfony/security-core": "^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "symfony-bridge", "autoload": { @@ -4997,7 +4678,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v4.4.43" + "source": "https://github.com/symfony/monolog-bridge/tree/v6.4.3" }, "funding": [ { @@ -5013,34 +4694,34 @@ "type": "tidelift" } ], - "time": "2022-06-16T12:12:11+00:00" + "time": "2024-01-29T15:01:07+00:00" }, { "name": "symfony/monolog-bundle", - "version": "v3.8.0", + "version": "v3.10.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d" + "reference": "414f951743f4aa1fd0f5bf6a0e9c16af3fe7f181" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d", - "reference": "a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/414f951743f4aa1fd0f5bf6a0e9c16af3fe7f181", + "reference": "414f951743f4aa1fd0f5bf6a0e9c16af3fe7f181", "shasum": "" }, "require": { - "monolog/monolog": "^1.22 || ^2.0 || ^3.0", - "php": ">=7.1.3", - "symfony/config": "~4.4 || ^5.0 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", - "symfony/http-kernel": "~4.4 || ^5.0 || ^6.0", - "symfony/monolog-bridge": "~4.4 || ^5.0 || ^6.0" + "monolog/monolog": "^1.25.1 || ^2.0 || ^3.0", + "php": ">=7.2.5", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/monolog-bridge": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "symfony/console": "~4.4 || ^5.0 || ^6.0", - "symfony/phpunit-bridge": "^5.2 || ^6.0", - "symfony/yaml": "~4.4 || ^5.0 || ^6.0" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^6.3 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "type": "symfony-bundle", "extra": { @@ -5078,7 +4759,7 @@ ], "support": { "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/v3.8.0" + "source": "https://github.com/symfony/monolog-bundle/tree/v3.10.0" }, "funding": [ { @@ -5094,25 +4775,25 @@ "type": "tidelift" } ], - "time": "2022-05-10T14:24:36+00:00" + "time": "2023-11-06T17:08:13+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.4.44", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "583f56160f716dd435f1cd721fd14b548f4bb510" + "reference": "22301f0e7fdeaacc14318928612dee79be99860e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/583f56160f716dd435f1cd721fd14b548f4bb510", - "reference": "583f56160f716dd435f1cd721fd14b548f4bb510", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/22301f0e7fdeaacc14318928612dee79be99860e", + "reference": "22301f0e7fdeaacc14318928612dee79be99860e", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -5145,7 +4826,79 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v4.4.44" + "source": "https://github.com/symfony/options-resolver/tree/v6.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-08-08T10:16:24+00:00" + }, + { + "name": "symfony/password-hasher", + "version": "v6.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/password-hasher.git", + "reference": "5189cdfe89a9acb56cc6d6d7a5233bfb180c7268" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/5189cdfe89a9acb56cc6d6d7a5233bfb180c7268", + "reference": "5189cdfe89a9acb56cc6d6d7a5233bfb180c7268", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "conflict": { + "symfony/security-core": "<5.4" + }, + "require-dev": { + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/security-core": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PasswordHasher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robin Chalas", + "email": "robin.chalas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides password hashing utilities", + "homepage": "https://symfony.com", + "keywords": [ + "hashing", + "password" + ], + "support": { + "source": "https://github.com/symfony/password-hasher/tree/v6.4.3" }, "funding": [ { @@ -5161,7 +4914,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T09:59:04+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5243,30 +4996,27 @@ "time": "2024-01-29T20:11:03+00:00" }, { - "name": "symfony/polyfill-intl-icu", - "version": "v1.27.0", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.29.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "a3d9148e2c363588e05abbdd4ee4f971f0a5330c" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/a3d9148e2c363588e05abbdd4ee4f971f0a5330c", - "reference": "a3d9148e2c363588e05abbdd4ee4f971f0a5330c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", "shasum": "" }, "require": { "php": ">=7.1" }, "suggest": { - "ext-intl": "For best performance and support of other locales than \"en\"" + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5277,14 +5027,8 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Intl\\Icu\\": "" - }, - "classmap": [ - "Resources/stubs" - ], - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5300,18 +5044,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's ICU-related data and classes", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "icu", + "grapheme", "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" }, "funding": [ { @@ -5327,35 +5071,30 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { - "name": "symfony/polyfill-intl-idn", - "version": "v1.28.0", + "name": "symfony/polyfill-intl-icu", + "version": "v1.29.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "ecaafce9f77234a6a449d29e49267ba10499116d" + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "07094a28851a49107f3ab4f9120ca2975a64b6e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/ecaafce9f77234a6a449d29e49267ba10499116d", - "reference": "ecaafce9f77234a6a449d29e49267ba10499116d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/07094a28851a49107f3ab4f9120ca2975a64b6e1", + "reference": "07094a28851a49107f3ab4f9120ca2975a64b6e1", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" + "php": ">=7.1" }, "suggest": { - "ext-intl": "For best performance" + "ext-intl": "For best performance and support of other locales than \"en\"" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5366,8 +5105,14 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - } + "Symfony\\Polyfill\\Intl\\Icu\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5375,30 +5120,26 @@ ], "authors": [ { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "description": "Symfony polyfill for intl's ICU-related data and classes", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "idn", + "icu", "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.29.0" }, "funding": [ { @@ -5414,20 +5155,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:30:37+00:00" + "time": "2024-01-29T20:12:16+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -5438,9 +5179,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5482,7 +5220,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -5498,20 +5236,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -5525,9 +5263,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5565,7 +5300,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -5581,20 +5316,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", "shasum": "" }, "require": { @@ -5602,9 +5337,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5641,7 +5373,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" }, "funding": [ { @@ -5657,20 +5389,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -5678,9 +5410,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5720,7 +5449,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -5736,20 +5465,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -5757,9 +5486,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5803,7 +5529,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -5819,30 +5545,28 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { - "name": "symfony/polyfill-php81", - "version": "v1.28.0", + "name": "symfony/polyfill-php83", + "version": "v1.29.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "86fcae159633351e5fd145d1c47de6c528f8caff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", - "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/86fcae159633351e5fd145d1c47de6c528f8caff", + "reference": "86fcae159633351e5fd145d1c47de6c528f8caff", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.1", + "symfony/polyfill-php80": "^1.14" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5853,7 +5577,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" + "Symfony\\Polyfill\\Php83\\": "" }, "classmap": [ "Resources/stubs" @@ -5873,7 +5597,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -5882,7 +5606,84 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/property-access", + "version": "v6.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "dd22c9247a16c712bfa128b3c90ebdd505102778" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/dd22c9247a16c712bfa128b3c90ebdd505102778", + "reference": "dd22c9247a16c712bfa128b3c90ebdd505102778", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/property-info": "^5.4|^6.0|^7.0" + }, + "require-dev": { + "symfony/cache": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property-path", + "reflection" + ], + "support": { + "source": "https://github.com/symfony/property-access/tree/v6.4.3" }, "funding": [ { @@ -5898,37 +5699,43 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { - "name": "symfony/property-access", - "version": "v4.4.44", + "name": "symfony/property-info", + "version": "v6.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/property-access.git", - "reference": "d49682f6f0764df725c95128213a38f7e0a9f358" + "url": "https://github.com/symfony/property-info.git", + "reference": "e96d740ab5ac39aa530c8eaa0720ea8169118e26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/d49682f6f0764df725c95128213a38f7e0a9f358", - "reference": "d49682f6f0764df725c95128213a38f7e0a9f358", + "url": "https://api.github.com/repos/symfony/property-info/zipball/e96d740ab5ac39aa530c8eaa0720ea8169118e26", + "reference": "e96d740ab5ac39aa530c8eaa0720ea8169118e26", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/inflector": "^3.4|^4.0|^5.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/string": "^5.4|^6.0|^7.0" }, - "require-dev": { - "symfony/cache": "^3.4|^4.0|^5.0" + "conflict": { + "phpdocumentor/reflection-docblock": "<5.2", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/dependency-injection": "<5.4", + "symfony/serializer": "<6.4" }, - "suggest": { - "psr/cache-implementation": "To cache access methods." + "require-dev": { + "phpdocumentor/reflection-docblock": "^5.2", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4|^7.0" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\PropertyAccess\\": "" + "Symfony\\Component\\PropertyInfo\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -5940,29 +5747,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "description": "Extracts information about PHP class' properties using metadata of popular sources", "homepage": "https://symfony.com", "keywords": [ - "access", - "array", - "extraction", - "index", - "injection", - "object", + "doctrine", + "phpdoc", "property", - "property path", - "reflection" + "symfony", + "type", + "validator" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v4.4.44" + "source": "https://github.com/symfony/property-info/tree/v6.4.3" }, "funding": [ { @@ -5978,46 +5782,40 @@ "type": "tidelift" } ], - "time": "2022-06-27T13:16:42+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/routing", - "version": "v4.4.44", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae" + "reference": "3b2957ad54902f0f544df83e3d58b38d7e8e5842" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/f7751fd8b60a07f3f349947a309b5bdfce22d6ae", - "reference": "f7751fd8b60a07f3f349947a309b5bdfce22d6ae", + "url": "https://api.github.com/repos/symfony/routing/zipball/3b2957ad54902f0f544df83e3d58b38d7e8e5842", + "reference": "3b2957ad54902f0f544df83e3d58b38d7e8e5842", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { - "symfony/config": "<4.2", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" + "doctrine/annotations": "<1.12", + "symfony/config": "<6.2", + "symfony/dependency-injection": "<5.4", + "symfony/yaml": "<5.4" }, "require-dev": { - "doctrine/annotations": "^1.10.4", + "doctrine/annotations": "^1.12|^2", "psr/log": "^1|^2|^3", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" + "symfony/config": "^6.2|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -6051,7 +5849,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v4.4.44" + "source": "https://github.com/symfony/routing/tree/v6.4.3" }, "funding": [ { @@ -6067,59 +5865,75 @@ "type": "tidelift" } ], - "time": "2022-07-20T09:59:04+00:00" + "time": "2024-01-30T13:55:02+00:00" }, { "name": "symfony/security-bundle", - "version": "v4.4.50", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "076fd2088ada33d760758d98ff07ddedbf567946" + "reference": "a53a9e1f6695447ce613aa8c9c698cfd012bd2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/076fd2088ada33d760758d98ff07ddedbf567946", - "reference": "076fd2088ada33d760758d98ff07ddedbf567946", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/a53a9e1f6695447ce613aa8c9c698cfd012bd2aa", + "reference": "a53a9e1f6695447ce613aa8c9c698cfd012bd2aa", "shasum": "" }, "require": { + "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=7.1.3", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/polyfill-php80": "^1.16", - "symfony/security-core": "^4.4", - "symfony/security-csrf": "^4.2|^5.0", - "symfony/security-guard": "^4.2|^5.0", - "symfony/security-http": "^4.4.50" + "php": ">=8.1", + "symfony/clock": "^6.3|^7.0", + "symfony/config": "^6.1|^7.0", + "symfony/dependency-injection": "^6.2|^7.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.2|^7.0", + "symfony/http-kernel": "^6.2", + "symfony/password-hasher": "^5.4|^6.0|^7.0", + "symfony/security-core": "^6.2|^7.0", + "symfony/security-csrf": "^5.4|^6.0|^7.0", + "symfony/security-http": "^6.3.6|^7.0", + "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "symfony/browser-kit": "<4.2", - "symfony/console": "<3.4", - "symfony/framework-bundle": "<4.4", - "symfony/ldap": "<4.4", - "symfony/twig-bundle": "<4.4" + "symfony/browser-kit": "<5.4", + "symfony/console": "<5.4", + "symfony/framework-bundle": "<6.4", + "symfony/http-client": "<5.4", + "symfony/ldap": "<5.4", + "symfony/serializer": "<6.4", + "symfony/twig-bundle": "<5.4", + "symfony/validator": "<6.4" }, "require-dev": { - "doctrine/annotations": "^1.10.4", - "symfony/asset": "^3.4|^4.0|^5.0", - "symfony/browser-kit": "^4.2|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dom-crawler": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/form": "^3.4|^4.0|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/serializer": "^4.4|^5.0", - "symfony/translation": "^3.4|^4.0|^5.0", - "symfony/twig-bridge": "^3.4|^4.0|^5.0", - "symfony/twig-bundle": "^4.4|^5.0", - "symfony/validator": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" + "symfony/asset": "^5.4|^6.0|^7.0", + "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/css-selector": "^5.4|^6.0|^7.0", + "symfony/dom-crawler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/form": "^5.4|^6.0|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/ldap": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/rate-limiter": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/twig-bridge": "^5.4|^6.0|^7.0", + "symfony/twig-bundle": "^5.4|^6.0|^7.0", + "symfony/validator": "^6.4|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0", + "twig/twig": "^2.13|^3.0.4", + "web-token/jwt-checker": "^3.1", + "web-token/jwt-signature-algorithm-ecdsa": "^3.1", + "web-token/jwt-signature-algorithm-eddsa": "^3.1", + "web-token/jwt-signature-algorithm-hmac": "^3.1", + "web-token/jwt-signature-algorithm-none": "^3.1", + "web-token/jwt-signature-algorithm-rsa": "^3.1" }, "type": "symfony-bundle", "autoload": { @@ -6147,7 +5961,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v4.4.50" + "source": "https://github.com/symfony/security-bundle/tree/v6.4.3" }, "funding": [ { @@ -6163,50 +5977,49 @@ "type": "tidelift" } ], - "time": "2023-01-24T10:39:54+00:00" + "time": "2024-01-28T15:49:46+00:00" }, { "name": "symfony/security-core", - "version": "v4.4.48", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "423ccb332784b236dfe6c5f396d0ac49db57c914" + "reference": "bb10f630cf5b1819ff80aa3ad57a09c61268fc48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/423ccb332784b236dfe6c5f396d0ac49db57c914", - "reference": "423ccb332784b236dfe6c5f396d0ac49db57c914", + "url": "https://api.github.com/repos/symfony/security-core/zipball/bb10f630cf5b1819ff80aa3ad57a09c61268fc48", + "reference": "bb10f630cf5b1819ff80aa3ad57a09c61268fc48", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1|^2", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1.6|^2" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/event-dispatcher-contracts": "^2.5|^3", + "symfony/password-hasher": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/ldap": "<4.4", - "symfony/security-guard": "<4.3" + "symfony/event-dispatcher": "<5.4", + "symfony/http-foundation": "<5.4", + "symfony/ldap": "<5.4", + "symfony/security-guard": "<5.4", + "symfony/translation": "<5.4.35|>=6.0,<6.3.12|>=6.4,<6.4.3|>=7.0,<7.0.3", + "symfony/validator": "<5.4" }, "require-dev": { - "psr/container": "^1.0|^2.0", + "psr/cache": "^1.0|^2.0|^3.0", + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/event-dispatcher": "^4.3", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/ldap": "^4.4|^5.0", - "symfony/translation": "^4.4|^5.0", - "symfony/validator": "^3.4.31|^4.3.4|^5.0" - }, - "suggest": { - "psr/container-implementation": "To instantiate the Security class", - "symfony/event-dispatcher": "", - "symfony/expression-language": "For using the expression voter", - "symfony/http-foundation": "", - "symfony/ldap": "For using LDAP integration", - "symfony/validator": "For using the user password constraint" + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/ldap": "^5.4|^6.0|^7.0", + "symfony/string": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4.35|~6.3.12|^6.4.3|^7.0.3", + "symfony/validator": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -6234,7 +6047,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v4.4.48" + "source": "https://github.com/symfony/security-core/tree/v6.4.3" }, "funding": [ { @@ -6250,36 +6063,31 @@ "type": "tidelift" } ], - "time": "2022-10-22T05:50:33+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/security-csrf", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "6728ed79d7f9aae3b86fca7ea554f1c46bae1e0b" + "reference": "e10257dd26f965d75e96bbfc27e46efd943f3010" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/6728ed79d7f9aae3b86fca7ea554f1c46bae1e0b", - "reference": "6728ed79d7f9aae3b86fca7ea554f1c46bae1e0b", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/e10257dd26f965d75e96bbfc27e46efd943f3010", + "reference": "e10257dd26f965d75e96bbfc27e46efd943f3010", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16", - "symfony/security-core": "^4.4|^5.0|^6.0" + "php": ">=8.1", + "symfony/security-core": "^5.4|^6.0|^7.0" }, "conflict": { - "symfony/http-foundation": "<5.3" + "symfony/http-foundation": "<5.4" }, "require-dev": { - "symfony/http-foundation": "^5.3|^6.0" - }, - "suggest": { - "symfony/http-foundation": "For using the class SessionTokenStorage." + "symfony/http-foundation": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -6307,7 +6115,7 @@ "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-csrf/tree/v5.4.35" + "source": "https://github.com/symfony/security-csrf/tree/v6.4.3" }, "funding": [ { @@ -6323,34 +6131,56 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { - "name": "symfony/security-guard", - "version": "v4.4.46", + "name": "symfony/security-http", + "version": "v6.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/security-guard.git", - "reference": "f199eb1b19db11ce254b891580728c45a7ccacfd" + "url": "https://github.com/symfony/security-http.git", + "reference": "d1962d08e02d620dccbaa28192498642500b5043" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-guard/zipball/f199eb1b19db11ce254b891580728c45a7ccacfd", - "reference": "f199eb1b19db11ce254b891580728c45a7ccacfd", + "url": "https://api.github.com/repos/symfony/security-http/zipball/d1962d08e02d620dccbaa28192498642500b5043", + "reference": "d1962d08e02d620dccbaa28192498642500b5043", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/security-core": "^3.4.22|^4.2.3|^5.0", - "symfony/security-http": "^4.4.1" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-foundation": "^6.2|^7.0", + "symfony/http-kernel": "^6.3|^7.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/property-access": "^5.4|^6.0|^7.0", + "symfony/security-core": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/clock": "<6.3", + "symfony/event-dispatcher": "<5.4.9|>=6,<6.0.9", + "symfony/http-client-contracts": "<3.0", + "symfony/security-bundle": "<5.4", + "symfony/security-csrf": "<5.4" }, "require-dev": { - "psr/log": "^1|^2|^3" + "psr/log": "^1|^2|^3", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/clock": "^6.3|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^3.0", + "symfony/rate-limiter": "^5.4|^6.0|^7.0", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/security-csrf": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4|^6.0|^7.0", + "web-token/jwt-checker": "^3.1", + "web-token/jwt-signature-algorithm-ecdsa": "^3.1" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Security\\Guard\\": "" + "Symfony\\Component\\Security\\Http\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -6370,10 +6200,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Security Component - Guard", + "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-guard/tree/v4.4.46" + "source": "https://github.com/symfony/security-http/tree/v6.4.3" }, "funding": [ { @@ -6389,50 +6219,45 @@ "type": "tidelift" } ], - "time": "2022-09-23T06:06:49+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { - "name": "symfony/security-http", - "version": "v4.4.50", + "name": "symfony/service-contracts", + "version": "v3.4.1", "source": { "type": "git", - "url": "https://github.com/symfony/security-http.git", - "reference": "7fa4a0cac16f02cb534a6e9adcdb17385f94004f" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/7fa4a0cac16f02cb534a6e9adcdb17385f94004f", - "reference": "7fa4a0cac16f02cb534a6e9adcdb17385f94004f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0", + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/http-foundation": "^3.4.40|^4.4.7|^5.0.7", - "symfony/http-kernel": "^4.4", - "symfony/polyfill-php80": "^1.16", - "symfony/property-access": "^3.4|^4.0|^5.0", - "symfony/security-core": "^4.4.8" + "php": ">=8.1", + "psr/container": "^1.1|^2.0" }, "conflict": { - "symfony/event-dispatcher": ">=5", - "symfony/security-csrf": "<3.4.11|~4.0,<4.0.11" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/routing": "^3.4|^4.0|^5.0", - "symfony/security-csrf": "^3.4.11|^4.0.11|^5.0" - }, - "suggest": { - "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", - "symfony/security-csrf": "For using tokens to protect authentication/logout attempts" + "ext-psr": "<1.1|>=2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\Security\\Http\\": "" + "Symfony\\Contracts\\Service\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "/Test/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -6441,18 +6266,26 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Security Component - HTTP Integration", + "description": "Generic abstractions related to writing services", "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "source": "https://github.com/symfony/security-http/tree/v4.4.50" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.1" }, "funding": [ { @@ -6468,47 +6301,50 @@ "type": "tidelift" } ], - "time": "2023-01-24T10:39:54+00:00" + "time": "2023-12-26T14:02:43+00:00" }, { - "name": "symfony/service-contracts", - "version": "v2.5.2", + "name": "symfony/string", + "version": "v6.4.3", "source": { "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "url": "https://github.com/symfony/string.git", + "reference": "7a14736fb179876575464e4658fce0c304e8c15b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/string/zipball/7a14736fb179876575464e4658fce0c304e8c15b", + "reference": "7a14736fb179876575464e4658fce0c304e8c15b", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "ext-psr": "<1.1|>=2" + "symfony/translation-contracts": "<2.5" }, - "suggest": { - "symfony/service-implementation": "" + "require-dev": { + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6524,18 +6360,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Generic abstractions related to writing services", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", "homepage": "https://symfony.com", "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/string/tree/v6.4.3" }, "funding": [ { @@ -6551,32 +6387,30 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2024-01-25T09:26:29+00:00" }, { "name": "symfony/templating", - "version": "v4.4.44", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/templating.git", - "reference": "2bfe94a5ebe0176612186e5f6b6a08a480c9e1f9" + "reference": "55a64595417d6eb54ca2ad100a2ee9ca82cf1c26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/templating/zipball/2bfe94a5ebe0176612186e5f6b6a08a480c9e1f9", - "reference": "2bfe94a5ebe0176612186e5f6b6a08a480c9e1f9", + "url": "https://api.github.com/repos/symfony/templating/zipball/55a64595417d6eb54ca2ad100a2ee9ca82cf1c26", + "reference": "55a64595417d6eb54ca2ad100a2ee9ca82cf1c26", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "~1.8" }, "require-dev": { "psr/log": "^1|^2|^3" }, - "suggest": { - "psr/log-implementation": "For using debug logging in loaders" - }, "type": "library", "autoload": { "psr-4": { @@ -6603,7 +6437,7 @@ "description": "Provides all the tools needed to build any kind of template system", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/templating/tree/v4.4.44" + "source": "https://github.com/symfony/templating/tree/v6.4.3" }, "funding": [ { @@ -6619,55 +6453,61 @@ "type": "tidelift" } ], - "time": "2022-06-27T13:16:42+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/translation", - "version": "v4.4.47", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "45036b1d53accc48fe9bab71ccd86d57eba0dd94" + "reference": "637c51191b6b184184bbf98937702bcf554f7d04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/45036b1d53accc48fe9bab71ccd86d57eba0dd94", - "reference": "45036b1d53accc48fe9bab71ccd86d57eba0dd94", + "url": "https://api.github.com/repos/symfony/translation/zipball/637c51191b6b184184bbf98937702bcf554f7d04", + "reference": "637c51191b6b184184bbf98937702bcf554f7d04", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^1.1.6|^2" + "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", + "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" }, "provide": { - "symfony/translation-implementation": "1.0|2.0" + "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { + "nikic/php-parser": "^4.18|^5.0", "psr/log": "^1|^2|^3", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { "Symfony\\Component\\Translation\\": "" }, @@ -6692,7 +6532,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v4.4.47" + "source": "https://github.com/symfony/translation/tree/v6.4.3" }, "funding": [ { @@ -6708,32 +6548,29 @@ "type": "tidelift" } ], - "time": "2022-10-03T15:15:11+00:00" + "time": "2024-01-29T13:11:52+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.5.2", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe" + "reference": "06450585bf65e978026bda220cdebca3f867fde7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/06450585bf65e978026bda220cdebca3f867fde7", + "reference": "06450585bf65e978026bda220cdebca3f867fde7", "shasum": "" }, "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/translation-implementation": "" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -6743,7 +6580,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6770,7 +6610,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/translation-contracts/tree/v3.4.1" }, "funding": [ { @@ -6786,81 +6626,73 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2023-12-26T14:02:43+00:00" }, { "name": "symfony/twig-bridge", - "version": "v4.4.51", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5" + "reference": "bf6b411a5d9a0ce6ea43cca0fcf5f05f5196a957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/83b021cd395053ed30327b9ee5d3fd60631f73f5", - "reference": "83b021cd395053ed30327b9ee5d3fd60631f73f5", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/bf6b411a5d9a0ce6ea43cca0fcf5f05f5196a957", + "reference": "bf6b411a5d9a0ce6ea43cca0fcf5f05f5196a957", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^1.43|^2.13|^3.0.4" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/translation-contracts": "^2.5|^3", + "twig/twig": "^2.13|^3.0.4" }, "conflict": { - "symfony/console": "<3.4", - "symfony/form": "<4.4", - "symfony/http-foundation": "<4.3", - "symfony/translation": "<4.2", - "symfony/workflow": "<4.3" + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/console": "<5.4", + "symfony/form": "<6.3", + "symfony/http-foundation": "<5.4", + "symfony/http-kernel": "<6.4", + "symfony/mime": "<6.2", + "symfony/serializer": "<6.4", + "symfony/translation": "<5.4", + "symfony/workflow": "<5.4" }, "require-dev": { - "egulias/email-validator": "^2.1.10|^3", - "symfony/asset": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/form": "^4.4.17", - "symfony/http-foundation": "^4.3|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^4.4|^5.0", - "symfony/mime": "^4.3|^5.0", + "egulias/email-validator": "^2.1.10|^3|^4", + "league/html-to-markdown": "^5.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/asset": "^5.4|^6.0|^7.0", + "symfony/asset-mapper": "^6.3|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/form": "^6.4|^7.0", + "symfony/html-sanitizer": "^6.1|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/mime": "^6.2|^7.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "^3.4|^4.0|^5.0", + "symfony/property-info": "^5.4|^6.0|^7.0", + "symfony/routing": "^5.4|^6.0|^7.0", "symfony/security-acl": "^2.8|^3.0", - "symfony/security-core": "^3.0|^4.0|^5.0", - "symfony/security-csrf": "^3.4|^4.0|^5.0", - "symfony/security-http": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2.1|^5.0", - "symfony/web-link": "^4.4|^5.0", - "symfony/workflow": "^4.3|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0", + "symfony/security-core": "^5.4|^6.0|^7.0", + "symfony/security-csrf": "^5.4|^6.0|^7.0", + "symfony/security-http": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4.3|^7.0.3", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/translation": "^6.1|^7.0", + "symfony/web-link": "^5.4|^6.0|^7.0", + "symfony/workflow": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0", "twig/cssinliner-extra": "^2.12|^3", "twig/inky-extra": "^2.12|^3", "twig/markdown-extra": "^2.12|^3" }, - "suggest": { - "symfony/asset": "For using the AssetExtension", - "symfony/expression-language": "For using the ExpressionExtension", - "symfony/finder": "", - "symfony/form": "For using the FormExtension", - "symfony/http-kernel": "For using the HttpKernelExtension", - "symfony/routing": "For using the RoutingExtension", - "symfony/security-core": "For using the SecurityExtension", - "symfony/security-csrf": "For using the CsrfExtension", - "symfony/security-http": "For using the LogoutUrlExtension", - "symfony/stopwatch": "For using the StopwatchExtension", - "symfony/templating": "For using the TwigEngine", - "symfony/translation": "For using the TranslationExtension", - "symfony/var-dumper": "For using the DumpExtension", - "symfony/web-link": "For using the WebLinkExtension", - "symfony/yaml": "For using the YamlExtension" - }, "type": "symfony-bridge", "autoload": { "psr-4": { @@ -6887,7 +6719,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v4.4.51" + "source": "https://github.com/symfony/twig-bridge/tree/v6.4.3" }, "funding": [ { @@ -6903,51 +6735,47 @@ "type": "tidelift" } ], - "time": "2023-11-09T21:17:38+00:00" + "time": "2024-01-30T08:32:12+00:00" }, { "name": "symfony/twig-bundle", - "version": "v4.4.41", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "164c1edc69f2c7ee337323efc78a8a8a263f45ff" + "reference": "2e63e50de2ade430191af0b5d21bfd6526fe3709" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/164c1edc69f2c7ee337323efc78a8a8a263f45ff", - "reference": "164c1edc69f2c7ee337323efc78a8a8a263f45ff", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/2e63e50de2ade430191af0b5d21bfd6526fe3709", + "reference": "2e63e50de2ade430191af0b5d21bfd6526fe3709", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/http-foundation": "^4.3|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/twig-bridge": "^4.4|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" + "composer-runtime-api": ">=2.1", + "php": ">=8.1", + "symfony/config": "^6.1|^7.0", + "symfony/dependency-injection": "^6.1|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^6.2", + "symfony/twig-bridge": "^6.4", + "twig/twig": "^2.13|^3.0.4" }, "conflict": { - "symfony/dependency-injection": "<4.1", - "symfony/framework-bundle": "<4.4", - "symfony/translation": "<4.2" + "symfony/framework-bundle": "<5.4", + "symfony/translation": "<5.4" }, "require-dev": { - "doctrine/annotations": "^1.10.4", - "doctrine/cache": "^1.0|^2.0", - "symfony/asset": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^4.2.5|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/form": "^3.4|^4.0|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/routing": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2|^5.0", - "symfony/web-link": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/asset": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/form": "^5.4|^6.0|^7.0", + "symfony/framework-bundle": "^5.4|^6.0|^7.0", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/web-link": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "symfony-bundle", "autoload": { @@ -6975,7 +6803,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v4.4.41" + "source": "https://github.com/symfony/twig-bundle/tree/v6.4.3" }, "funding": [ { @@ -6991,69 +6819,59 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:19:55+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/validator", - "version": "v4.4.48", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "54781a4c41efbd283b779110bf8ae7f263737775" + "reference": "9c1d8bb4edce5304fcefca7923741085f1ca5b60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/54781a4c41efbd283b779110bf8ae7f263737775", - "reference": "54781a4c41efbd283b779110bf8ae7f263737775", + "url": "https://api.github.com/repos/symfony/validator/zipball/9c1d8bb4edce5304fcefca7923741085f1ca5b60", + "reference": "9c1d8bb4edce5304fcefca7923741085f1ca5b60", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^1.1|^2" + "symfony/polyfill-php83": "^1.27", + "symfony/translation-contracts": "^2.5|^3" }, "conflict": { + "doctrine/annotations": "<1.13", "doctrine/lexer": "<1.1", - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/intl": "<4.3", - "symfony/translation": ">=5.0", - "symfony/yaml": "<3.4" + "symfony/dependency-injection": "<5.4", + "symfony/expression-language": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/intl": "<5.4", + "symfony/property-info": "<5.4", + "symfony/translation": "<5.4.35|>=6.0,<6.3.12|>=6.4,<6.4.3|>=7.0,<7.0.3", + "symfony/yaml": "<5.4" }, "require-dev": { - "doctrine/annotations": "^1.10.4", - "doctrine/cache": "^1.0|^2.0", - "egulias/email-validator": "^2.1.10|^3", - "symfony/cache": "^3.4|^4.0|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-client": "^4.3|^5.0", - "symfony/http-foundation": "^4.1|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^4.3|^5.0", - "symfony/mime": "^4.4|^5.0", - "symfony/property-access": "^3.4|^4.0|^5.0", - "symfony/property-info": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "psr/cache-implementation": "For using the mapping cache.", - "symfony/config": "", - "symfony/expression-language": "For using the Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For accessing properties within comparison constraints", - "symfony/property-info": "To automatically add NotNull and Type constraints", - "symfony/translation": "For translating validation errors.", - "symfony/yaml": "" + "doctrine/annotations": "^1.13|^2", + "egulias/email-validator": "^2.1.10|^3|^4", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/mime": "^5.4|^6.0|^7.0", + "symfony/property-access": "^5.4|^6.0|^7.0", + "symfony/property-info": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4.35|~6.3.12|^6.4.3|^7.0.3", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -7081,7 +6899,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v4.4.48" + "source": "https://github.com/symfony/validator/tree/v6.4.3" }, "funding": [ { @@ -7097,43 +6915,39 @@ "type": "tidelift" } ], - "time": "2022-10-25T13:54:11+00:00" + "time": "2024-01-29T15:01:07+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "ce4685b30e47d94dfc990c5566285ff99ddf012b" + "reference": "0435a08f69125535336177c29d56af3abc1f69da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ce4685b30e47d94dfc990c5566285ff99ddf012b", - "reference": "ce4685b30e47d94dfc990c5566285ff99ddf012b", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0435a08f69125535336177c29d56af3abc1f69da", + "reference": "0435a08f69125535336177c29d56af3abc1f69da", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/uid": "^5.1|^6.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^6.3|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/uid": "^5.4|^6.0|^7.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "bin": [ "Resources/bin/var-dump-server" ], @@ -7170,7 +6984,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.35" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.3" }, "funding": [ { @@ -7186,7 +7000,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:28:09+00:00" + "time": "2024-01-23T14:53:30+00:00" }, { "name": "symfony/var-exporter", @@ -7265,16 +7079,16 @@ }, { "name": "symfony/webpack-encore-bundle", - "version": "v1.16.1", + "version": "v1.17.2", "source": { "type": "git", "url": "https://github.com/symfony/webpack-encore-bundle.git", - "reference": "1862d71e483769b40278548a30e756ce13ef9d4c" + "reference": "471ebbc03072dad6e31840dc317bc634a32785f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/1862d71e483769b40278548a30e756ce13ef9d4c", - "reference": "1862d71e483769b40278548a30e756ce13ef9d4c", + "url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/471ebbc03072dad6e31840dc317bc634a32785f5", + "reference": "471ebbc03072dad6e31840dc317bc634a32785f5", "shasum": "" }, "require": { @@ -7318,7 +7132,7 @@ "description": "Integration with your Symfony app & Webpack Encore!", "support": { "issues": "https://github.com/symfony/webpack-encore-bundle/issues", - "source": "https://github.com/symfony/webpack-encore-bundle/tree/v1.16.1" + "source": "https://github.com/symfony/webpack-encore-bundle/tree/v1.17.2" }, "funding": [ { @@ -7334,35 +7148,39 @@ "type": "tidelift" } ], - "time": "2023-01-18T19:37:55+00:00" + "time": "2023-09-26T14:36:28+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.45", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d" + "reference": "e78db7f5c70a21f0417a31f414c4a95fe76c07e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d", - "reference": "aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e78db7f5c70a21f0417a31f414c4a95fe76c07e4", + "reference": "e78db7f5c70a21f0417a31f414c4a95fe76c07e4", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<3.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, + "bin": [ + "Resources/bin/yaml-lint" + ], "type": "library", "autoload": { "psr-4": { @@ -7389,7 +7207,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v4.4.45" + "source": "https://github.com/symfony/yaml/tree/v5.4.35" }, "funding": [ { @@ -7405,7 +7223,7 @@ "type": "tidelift" } ], - "time": "2022-08-02T15:47:23+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "twbs/bootstrap", @@ -7524,27 +7342,27 @@ }, { "name": "twig/extra-bundle", - "version": "v3.7.0", + "version": "v3.7.1", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49" + "reference": "f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49", - "reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3", + "reference": "f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/framework-bundle": "^4.4|^5.0|^6.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", "twig/twig": "^2.7|^3.0" }, "require-dev": { "league/commonmark": "^1.0|^2.0", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0", + "symfony/phpunit-bridge": "^5.4|^6.3", "twig/cache-extra": "^3.0", "twig/cssinliner-extra": "^2.12|^3.0", "twig/html-extra": "^2.12|^3.0", @@ -7582,7 +7400,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.7.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.7.1" }, "funding": [ { @@ -7594,7 +7412,7 @@ "type": "tidelift" } ], - "time": "2023-05-06T11:11:46+00:00" + "time": "2023-07-29T15:34:56+00:00" }, { "name": "twig/twig", @@ -10367,16 +10185,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.1", + "version": "3.8.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", - "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "shasum": "" }, "require": { @@ -10386,11 +10204,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -10405,21 +10223,45 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2022-06-18T07:21:10+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-01-11T20:47:48+00:00" }, { "name": "symfony/dotenv", @@ -10494,41 +10336,46 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.39.1", + "version": "v1.50.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "30c8ac13511f6df7bc9ac088f31d7a48ce6433c6" + "reference": "a1733f849b999460c308e66f6392fb09b621fa86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/30c8ac13511f6df7bc9ac088f31d7a48ce6433c6", - "reference": "30c8ac13511f6df7bc9ac088f31d7a48ce6433c6", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/a1733f849b999460c308e66f6392fb09b621fa86", + "reference": "a1733f849b999460c308e66f6392fb09b621fa86", "shasum": "" }, "require": { - "doctrine/inflector": "^1.2|^2.0", + "doctrine/inflector": "^2.0", "nikic/php-parser": "^4.11", - "php": ">=7.1.3", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "php": ">=8.0", + "symfony/config": "^5.4.7|^6.0", + "symfony/console": "^5.4.7|^6.0", + "symfony/dependency-injection": "^5.4.7|^6.0", "symfony/deprecation-contracts": "^2.2|^3", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0" + "symfony/filesystem": "^5.4.7|^6.0", + "symfony/finder": "^5.4.3|^6.0", + "symfony/framework-bundle": "^5.4.7|^6.0", + "symfony/http-kernel": "^5.4.7|^6.0", + "symfony/process": "^5.4.7|^6.0" + }, + "conflict": { + "doctrine/doctrine-bundle": "<2.4", + "doctrine/orm": "<2.10", + "symfony/doctrine-bridge": "<5.4" }, "require-dev": { "composer/semver": "^3.0", - "doctrine/doctrine-bundle": "^1.12.3|^2.0", - "doctrine/orm": "^2.3", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/phpunit-bridge": "^4.4|^5.0|^6.0", + "doctrine/doctrine-bundle": "^2.4", + "doctrine/orm": "^2.10.0", + "symfony/http-client": "^5.4.7|^6.0", + "symfony/phpunit-bridge": "^5.4.17|^6.0", "symfony/polyfill-php80": "^1.16.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/security-core": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/security-core": "^5.4.7|^6.0", + "symfony/yaml": "^5.4.3|^6.0", "twig/twig": "^2.0|^3.0" }, "type": "symfony-bundle", @@ -10556,13 +10403,14 @@ "homepage": "https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html", "keywords": [ "code generator", + "dev", "generator", "scaffold", "scaffolding" ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.39.1" + "source": "https://github.com/symfony/maker-bundle/tree/v1.50.0" }, "funding": [ { @@ -10578,7 +10426,7 @@ "type": "tidelift" } ], - "time": "2022-09-13T18:14:36+00:00" + "time": "2023-07-10T18:21:57+00:00" }, { "name": "symfony/phpunit-bridge", @@ -10663,20 +10511,20 @@ }, { "name": "symfony/process", - "version": "v4.4.44", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" + "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "url": "https://api.github.com/repos/symfony/process/zipball/cbc28e34015ad50166fc2f9c8962d28d0fe861eb", + "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-php80": "^1.16" }, "type": "library", @@ -10705,7 +10553,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v4.4.44" + "source": "https://github.com/symfony/process/tree/v5.4.35" }, "funding": [ { @@ -10721,7 +10569,7 @@ "type": "tidelift" } ], - "time": "2022-06-27T13:16:42+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/stopwatch", @@ -10787,38 +10635,38 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v4.4.47", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "c173202d8ce82fde63ec0953eaffdf065018b8f4" + "reference": "e78f98da7b4f842bab89368d53c962f5b2f9e49c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/c173202d8ce82fde63ec0953eaffdf065018b8f4", - "reference": "c173202d8ce82fde63ec0953eaffdf065018b8f4", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/e78f98da7b4f842bab89368d53c962f5b2f9e49c", + "reference": "e78f98da7b4f842bab89368d53c962f5b2f9e49c", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/config": "^4.2|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/polyfill-php80": "^1.16", - "symfony/routing": "^4.3|^5.0", - "symfony/twig-bundle": "^4.2|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" + "php": ">=8.1", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/twig-bundle": "^5.4|^6.0", + "twig/twig": "^2.13|^3.0.4" }, "conflict": { - "symfony/form": "<4.3", - "symfony/messenger": "<4.2" + "symfony/form": "<5.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<5.4", + "symfony/twig-bundle": ">=7.0" }, "require-dev": { - "symfony/browser-kit": "^4.3|^5.0", - "symfony/console": "^4.3|^5.0", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0" + "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/css-selector": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0" }, "type": "symfony-bundle", "autoload": { @@ -10845,8 +10693,11 @@ ], "description": "Provides a development tool that gives detailed information about the execution of any request", "homepage": "https://symfony.com", + "keywords": [ + "dev" + ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v4.4.47" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.3" }, "funding": [ { @@ -10862,7 +10713,7 @@ "type": "tidelift" } ], - "time": "2022-09-29T14:10:52+00:00" + "time": "2024-01-28T15:49:46+00:00" }, { "name": "theseer/tokenizer", @@ -10917,7 +10768,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "surfnet/stepup-middleware-client-bundle": 10 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/config/bundles.php b/config/bundles.php index 411968f5..67e9637b 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -7,7 +7,6 @@ JMS\TranslationBundle\JMSTranslationBundle::class => ['all' => true], Nelmio\SecurityBundle\NelmioSecurityBundle::class => ['all' => true], OpenConext\MonitorBundle\OpenConextMonitorBundle::class => ['all' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Surfnet\SamlBundle\SurfnetSamlBundle::class => ['all' => true], Surfnet\StepupBundle\SurfnetStepupBundle::class => ['all' => true], Surfnet\StepupMiddlewareClientBundle\SurfnetStepupMiddlewareClientBundle::class => ['all' => true], diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 4c4b0e61..a1b946b2 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -5,8 +5,6 @@ framework: form: ~ csrf_protection: ~ validation: { enable_annotations: true } - templating: - engines: ['twig', 'php'] default_locale: "%default_locale%" trusted_hosts: ~ session: @@ -17,3 +15,4 @@ framework: cookie_secure: true fragments: false http_method_override: true + error_controller: Surfnet\StepupRa\RaBundle\Controller\ExceptionController diff --git a/config/packages/jms_translation.yaml b/config/packages/jms_translation.yaml index 47744874..0728211d 100644 --- a/config/packages/jms_translation.yaml +++ b/config/packages/jms_translation.yaml @@ -2,9 +2,9 @@ jms_translation: locales: "%locales%" configs: default: - dirs: ["%kernel.root_dir%/../src", "%kernel.root_dir%/../templates", "%kernel.root_dir%/../vendor/surfnet/stepup-middleware-client-bundle", "%kernel.root_dir%/../vendor/surfnet/stepup-bundle"] + dirs: ["%kernel.project_dir%/src", "%kernel.project_dir%/templates", "%kernel.project_dir%/vendor/surfnet/stepup-middleware-client-bundle", "%kernel.project_dir%/vendor/surfnet/stepup-bundle"] output_dir: '%kernel.project_dir%/translations' ignored_domains: [] excluded_names: ['*TestCase.php', '*Test.php'] excluded_dirs: [cache, data, logs, Tests, vendor] - extractors: [] \ No newline at end of file + extractors: [] diff --git a/config/packages/sensio_framework_extra.yaml b/config/packages/sensio_framework_extra.yaml deleted file mode 100644 index 1821ccc0..00000000 --- a/config/packages/sensio_framework_extra.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sensio_framework_extra: - router: - annotations: false diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 7b64fce8..c44360dc 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -3,7 +3,6 @@ twig: '%kernel.project_dir%/templates': SurfnetStepupRaRa debug: "%kernel.debug%" strict_variables: "%kernel.debug%" - exception_controller: SurfnetStepupRaRaBundle:Exception:show date: format: "%date_format%" timezone: "%date_timezone%" diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php index 3ee43c31..b4f6a125 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php @@ -30,7 +30,7 @@ final class ExceptionController extends BaseExceptionController /** * @return array View parameters 'title' and 'description' */ - protected function getPageTitleAndDescription(Exception $exception): array + protected function getPageTitleAndDescription(\Throwable $exception): array { $translator = $this->getTranslator(); diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php index bbb4630d..a145e86d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php @@ -1,5 +1,7 @@ setDefinition( $providerId, - new ChildDefinition('ra.security.authentication.provider.saml'), + new ChildDefinition('self_service.security.authentication.provider.saml') ); $listenerId = 'security.authentication.listener.saml.' . $id; $container->setDefinition( $listenerId, - new ChildDefinition('ra.security.authentication.listener'), + new ChildDefinition('self_service.security.authentication.listener') ); $cookieHandlerId = 'security.logout.handler.cookie_clearing.' . $id; $cookieHandler = $container->setDefinition( $cookieHandlerId, - new ChildDefinition('security.logout.handler.cookie_clearing'), + new ChildDefinition('security.logout.handler.cookie_clearing') ); $cookieHandler->addArgument([]); return [$providerId, $listenerId, $defaultEntryPoint]; } - public function getPosition(): string + public function getKey(): string { - return 'pre_auth'; + return 'saml'; } - public function getKey(): string + public function addConfiguration(NodeDefinition $builder): void { - return 'saml'; } - public function addConfiguration(NodeDefinition $builder) + public function getPriority(): int + { + return -10; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string|array { + return $config; } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index ecb0112e..3ad60372 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -46,7 +46,7 @@ public function __construct( * * If needed, the username is the UUID of the identity so it can be fetched rather easy */ - public function loadUserByUsername($username) + public function loadUserByUsername($username): never { throw new RuntimeException(sprintf('Cannot Load User By Username "%s"', $username)); } diff --git a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php index 57b6f367..f6efc0b7 100644 --- a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php +++ b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php @@ -32,7 +32,7 @@ public function build(ContainerBuilder $container): void /** @var SecurityExtension $extension */ $extension = $container->getExtension('security'); - $extension->addSecurityListenerFactory(new SamlFactory()); + $extension->addAuthenticatorFactory(new SamlFactory()); $container->addCompilerPass(new GssfSessionBagSessionPass()); } From 99347934f5c1f5be15f268bb6b9ded9e80856b48 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 8 Feb 2024 12:24:56 +0100 Subject: [PATCH 081/202] Update dependencies --- composer.json | 40 +++--- composer.lock | 362 ++++++++++++++++++-------------------------------- symfony.lock | 6 - 3 files changed, 147 insertions(+), 261 deletions(-) diff --git a/composer.json b/composer.json index 19c50241..d09dd972 100644 --- a/composer.json +++ b/composer.json @@ -14,29 +14,29 @@ "require": { "php": "^8.2", "fortawesome/font-awesome": "~4.2.0", - "guzzlehttp/guzzle": "^6 || ^7", + "guzzlehttp/guzzle": "^7", "incenteev/composer-parameter-handler": "~2.0", "jms/translation-bundle": "^2.1", "knplabs/knp-paginator-bundle": "^5.9 || ^6.0", - "nelmio/security-bundle": "^2.12 || ^3.0", - "openconext/monitor-bundle": "^3.0 || ^4.0", - "surfnet/stepup-bundle": "^5.0 || ^6.0", - "surfnet/stepup-middleware-client-bundle": "^4.0 || ^5.0.0-beta", - "surfnet/stepup-saml-bundle": "^4.3.2 || ^6.0", - "symfony/asset": "4.4.* || ^5.1 || ^6.0", - "symfony/expression-language": "4.4.* || ^5.1 || ^6.0", + "nelmio/security-bundle": "^3.0", + "openconext/monitor-bundle": "^4.0", + "surfnet/stepup-bundle": "^6.0", + "surfnet/stepup-middleware-client-bundle": "^5.0.0-beta", + "surfnet/stepup-saml-bundle": "^6.0", + "symfony/asset": "^6.0", + "symfony/expression-language": "^6.0", "symfony/flex": "^v2.4.3", - "symfony/form": "4.4.* || ^5.1 || ^6.0", - "symfony/http-foundation": "^5.0 || ^6.0", + "symfony/form": "^6.0", + "symfony/http-foundation": "^6.0", "symfony/monolog-bundle": "^3.5", - "symfony/security-bundle": "4.4.* || ^5.1 || ^6.0", - "symfony/translation": "4.4.* || ^5.1 || ^6.0", - "symfony/twig-bundle": "4.4.* || ^5.1 || ^6.0", - "symfony/validator": "4.4.* || ^5.1 || ^6.0", + "symfony/security-bundle": "^6.0", + "symfony/translation": "^6.0", + "symfony/twig-bundle": "^6.0", + "symfony/validator": "^6.0", "symfony/webpack-encore-bundle": "^1.7", "twbs/bootstrap": "~3.3.0", "twig/extensions": "~1.5", - "twig/extra-bundle": "^2.12 || ^3.0", + "twig/extra-bundle": "^3.0", "twig/twig": "^2.12 || ^3.0", "ext-openssl": "*", "ext-dom": "*" @@ -44,7 +44,7 @@ "require-dev": { "matthiasnoback/symfony-config-test": "^4.0", "mockery/mockery": "^1.0", - "overtrue/phplint": "^2.3", + "overtrue/phplint": "^9.0", "phpmd/phpmd": "^2.6", "phpstan/extension-installer": "^1.3", "phpstan/phpstan-symfony": "^1.3", @@ -56,7 +56,7 @@ "symfony/maker-bundle": "^1.19", "symfony/phpunit-bridge": "^6.0", "symfony/stopwatch": "^5.1", - "symfony/web-profiler-bundle": "4.4.* || ^5.1 || ^6.0" + "symfony/web-profiler-bundle": "^6.0" }, "conflict": { "symfony/symfony": "*" @@ -126,12 +126,8 @@ "extra": { "symfony": { "allow-contrib": false, - "require": "4.4.* || ^5.0 || ^6.0" + "require": "6.4.*" }, - "symfony-app-dir": "app", - "symfony-var-dir": "var", - "symfony-bin-dir": "bin", - "symfony-web-dir": "web", "src-dir": "src/Surfnet", "incenteev-parameters": [ { diff --git a/composer.lock b/composer.lock index 2d3c691f..d4217f96 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e798a0b3cab869b4de2e9deb1f4e23b9", + "content-hash": "d2abfb0c1ec083bc716d1b0544927ce9", "packages": [ { "name": "beberlei/assert", @@ -2011,25 +2011,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.18.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -2037,7 +2039,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2061,9 +2063,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-12-10T21:03:43+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "openconext/monitor-bundle", @@ -3451,52 +3453,47 @@ }, { "name": "symfony/console", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931" + "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931", - "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931", + "url": "https://api.github.com/repos/symfony/console/zipball/2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", + "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0|^7.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -3530,7 +3527,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.35" + "source": "https://github.com/symfony/console/tree/v6.4.3" }, "funding": [ { @@ -3546,7 +3543,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:28:09+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/dependency-injection", @@ -4056,22 +4053,23 @@ }, { "name": "symfony/finder", - "version": "v5.4.35", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435" + "reference": "11d736e97f116ac375a81f96e662911a34cd50ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/abe6d6f77d9465fed3cd2d029b29d03b56b56435", - "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435", + "url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce", + "reference": "11d736e97f116ac375a81f96e662911a34cd50ce", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0|^7.0" }, "type": "library", "autoload": { @@ -4099,7 +4097,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.35" + "source": "https://github.com/symfony/finder/tree/v6.4.0" }, "funding": [ { @@ -4115,7 +4113,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2023-10-31T17:30:12+00:00" }, { "name": "symfony/flex", @@ -5391,82 +5389,6 @@ ], "time": "2024-01-29T20:11:03+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.29.0", @@ -7152,31 +7074,28 @@ }, { "name": "symfony/yaml", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e78db7f5c70a21f0417a31f414c4a95fe76c07e4" + "reference": "d75715985f0f94f978e3a8fa42533e10db921b90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e78db7f5c70a21f0417a31f414c4a95fe76c07e4", - "reference": "e78db7f5c70a21f0417a31f414c4a95fe76c07e4", + "url": "https://api.github.com/repos/symfony/yaml/zipball/d75715985f0f94f978e3a8fa42533e10db921b90", + "reference": "d75715985f0f94f978e3a8fa42533e10db921b90", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.3" + "symfony/console": "<5.4" }, "require-dev": { - "symfony/console": "^5.3|^6.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "symfony/console": "^5.4|^6.0|^7.0" }, "bin": [ "Resources/bin/yaml-lint" @@ -7207,7 +7126,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.35" + "source": "https://github.com/symfony/yaml/tree/v6.4.3" }, "funding": [ { @@ -7223,7 +7142,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "twbs/bootstrap", @@ -8084,73 +8003,38 @@ ], "time": "2023-03-08T13:26:56+00:00" }, - { - "name": "n98/junit-xml", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/cmuench/junit-xml.git", - "reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cmuench/junit-xml/zipball/0017dd92ac8cb619f02e32f4cffd768cfe327c73", - "reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "^9.5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "N98\\JUnitXml\\": "src/N98/JUnitXml" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Münch", - "email": "c.muench@netz98.de" - } - ], - "description": "JUnit XML Document generation library", - "support": { - "issues": "https://github.com/cmuench/junit-xml/issues", - "source": "https://github.com/cmuench/junit-xml/tree/1.1.0" - }, - "time": "2020-12-25T09:08:58+00:00" - }, { "name": "overtrue/phplint", - "version": "2.4.1", + "version": "9.1.2", "source": { "type": "git", "url": "https://github.com/overtrue/phplint.git", - "reference": "59affacd0b09a1460e39acf2c64c963ddbf734cf" + "reference": "7a9822c863d19fa8ec42f862c0e135da58b5cb4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/overtrue/phplint/zipball/59affacd0b09a1460e39acf2c64c963ddbf734cf", - "reference": "59affacd0b09a1460e39acf2c64c963ddbf734cf", + "url": "https://api.github.com/repos/overtrue/phplint/zipball/7a9822c863d19fa8ec42f862c0e135da58b5cb4b", + "reference": "7a9822c863d19fa8ec42f862c0e135da58b5cb4b", "shasum": "" }, "require": { + "ext-dom": "*", "ext-json": "*", - "n98/junit-xml": "1.1.0", - "php": ">=5.5.9", - "symfony/console": "^3.2|^4.0|^5.0", - "symfony/finder": "^3.0|^4.0|^5.0", - "symfony/process": "^3.3|^4.0|^5.0", - "symfony/yaml": "^3.0|^4.0|^5.0" + "ext-mbstring": "*", + "php": "^8.1", + "symfony/cache": "^6.4 || ^7.0", + "symfony/console": "^6.4 || ^7.0", + "symfony/event-dispatcher": "^6.4 || ^7.0", + "symfony/finder": "^6.4 || ^7.0", + "symfony/options-resolver": "^6.4 || ^7.0", + "symfony/process": "^6.4 || ^7.0", + "symfony/yaml": "^6.4 || ^7.0" }, "require-dev": { - "brainmaestro/composer-git-hooks": "^2.7", - "friendsofphp/php-cs-fixer": "^2.16", - "jakub-onderka/php-console-highlighter": "^0.3.2 || ^0.4" + "bamarni/composer-bin-plugin": "^1.4", + "brainmaestro/composer-git-hooks": "^2.8.5 || 3.0.0-alpha.1", + "jetbrains/phpstorm-stubs": "^2021.3 || ^2022.3 || ^2023.3", + "php-parallel-lint/php-console-highlighter": "^1.0" }, "bin": [ "bin/phplint" @@ -8159,11 +8043,15 @@ "extra": { "hooks": { "pre-commit": [ - "composer fix-style" + "composer style:fix", + "composer code:check" ], "pre-push": [ - "composer check-style" + "composer qa:check" ] + }, + "branch-alias": { + "dev-main": "9.1.x-dev" } }, "autoload": { @@ -8179,6 +8067,10 @@ { "name": "overtrue", "email": "anzhengchao@gmail.com" + }, + { + "name": "Laurent Laville", + "homepage": "https://github.com/llaville" } ], "description": "`phplint` is a tool that can speed up linting of php files by running several lint processes at once.", @@ -8186,13 +8078,20 @@ "check", "lint", "phplint", + "static analysis", "syntax" ], "support": { "issues": "https://github.com/overtrue/phplint/issues", - "source": "https://github.com/overtrue/phplint/tree/2.4.1" + "source": "https://github.com/overtrue/phplint/tree/9.1.2" }, - "time": "2021-06-02T16:18:33+00:00" + "funding": [ + { + "url": "https://github.com/overtrue", + "type": "github" + } + ], + "time": "2024-02-06T10:43:30+00:00" }, { "name": "pdepend/pdepend", @@ -10336,52 +10235,50 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.50.0", + "version": "v1.54.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "a1733f849b999460c308e66f6392fb09b621fa86" + "reference": "a8523cf35d777bf2d8cf5703fa73f378fdc27125" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/a1733f849b999460c308e66f6392fb09b621fa86", - "reference": "a1733f849b999460c308e66f6392fb09b621fa86", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/a8523cf35d777bf2d8cf5703fa73f378fdc27125", + "reference": "a8523cf35d777bf2d8cf5703fa73f378fdc27125", "shasum": "" }, "require": { "doctrine/inflector": "^2.0", - "nikic/php-parser": "^4.11", - "php": ">=8.0", - "symfony/config": "^5.4.7|^6.0", - "symfony/console": "^5.4.7|^6.0", - "symfony/dependency-injection": "^5.4.7|^6.0", + "nikic/php-parser": "^4.18|^5.0", + "php": ">=8.1", + "symfony/config": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", "symfony/deprecation-contracts": "^2.2|^3", - "symfony/filesystem": "^5.4.7|^6.0", - "symfony/finder": "^5.4.3|^6.0", - "symfony/framework-bundle": "^5.4.7|^6.0", - "symfony/http-kernel": "^5.4.7|^6.0", - "symfony/process": "^5.4.7|^6.0" + "symfony/filesystem": "^6.4|^7.0", + "symfony/finder": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0" }, "conflict": { - "doctrine/doctrine-bundle": "<2.4", - "doctrine/orm": "<2.10", - "symfony/doctrine-bridge": "<5.4" + "doctrine/doctrine-bundle": "<2.10", + "doctrine/orm": "<2.15" }, "require-dev": { "composer/semver": "^3.0", - "doctrine/doctrine-bundle": "^2.4", - "doctrine/orm": "^2.10.0", - "symfony/http-client": "^5.4.7|^6.0", - "symfony/phpunit-bridge": "^5.4.17|^6.0", - "symfony/polyfill-php80": "^1.16.0", - "symfony/security-core": "^5.4.7|^6.0", - "symfony/yaml": "^5.4.3|^6.0", - "twig/twig": "^2.0|^3.0" + "doctrine/doctrine-bundle": "^2.5.0", + "doctrine/orm": "^2.15|^3", + "symfony/http-client": "^6.4|^7.0", + "symfony/phpunit-bridge": "^6.4.1|^7.0", + "symfony/security-core": "^6.4|^7.0", + "symfony/yaml": "^6.4|^7.0", + "twig/twig": "^3.0|^4.x-dev" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-main": "1.0-dev" + "dev-main": "1.x-dev" } }, "autoload": { @@ -10410,7 +10307,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.50.0" + "source": "https://github.com/symfony/maker-bundle/tree/v1.54.0" }, "funding": [ { @@ -10426,7 +10323,7 @@ "type": "tidelift" } ], - "time": "2023-07-10T18:21:57+00:00" + "time": "2024-02-06T21:23:55+00:00" }, { "name": "symfony/phpunit-bridge", @@ -10511,21 +10408,20 @@ }, { "name": "symfony/process", - "version": "v5.4.35", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb" + "reference": "31642b0818bfcff85930344ef93193f8c607e0a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cbc28e34015ad50166fc2f9c8962d28d0fe861eb", - "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb", + "url": "https://api.github.com/repos/symfony/process/zipball/31642b0818bfcff85930344ef93193f8c607e0a3", + "reference": "31642b0818bfcff85930344ef93193f8c607e0a3", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -10553,7 +10449,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.35" + "source": "https://github.com/symfony/process/tree/v6.4.3" }, "funding": [ { @@ -10569,7 +10465,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/stopwatch", diff --git a/symfony.lock b/symfony.lock index b55b579c..a5163b27 100644 --- a/symfony.lock +++ b/symfony.lock @@ -101,9 +101,6 @@ "myclabs/deep-copy": { "version": "1.9.5" }, - "n98/junit-xml": { - "version": "1.0.0" - }, "nelmio/security-bundle": { "version": "2.4", "recipe": { @@ -448,9 +445,6 @@ "symfony/polyfill-php72": { "version": "v1.17.0" }, - "symfony/polyfill-php73": { - "version": "v1.17.1" - }, "symfony/polyfill-php80": { "version": "v1.17.1" }, From 7838b18f28e564494a737fcfb374a136abb883fb Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 09:52:49 +0100 Subject: [PATCH 082/202] Add route attribute --- config/routes.yaml | 3 - .../RaBundle/Controller/LocaleController.php | 7 + .../RaBundle/Controller/ProfileController.php | 28 ++- .../Controller/RaLocationController.php | 9 + .../Controller/RaManagementController.php | 26 +++ .../RaBundle/Controller/RaaController.php | 6 + .../Controller/RecoveryTokenController.php | 11 ++ .../RaBundle/Controller/SamlController.php | 3 + .../Controller/SecondFactorController.php | 21 +++ .../Controller/SecurityController.php | 6 + .../Controller/Vetting/GssfController.php | 21 +++ .../Controller/Vetting/SmsController.php | 11 ++ .../Controller/Vetting/YubikeyController.php | 7 + .../RaBundle/Controller/VettingController.php | 22 ++- .../Controller/VettingTypeHintController.php | 6 + .../RaBundle/Resources/config/routing.yml | 170 ------------------ 16 files changed, 180 insertions(+), 177 deletions(-) delete mode 100644 src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml diff --git a/config/routes.yaml b/config/routes.yaml index cd7bcf9a..c53b9618 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -7,9 +7,6 @@ openconext_monitor: resource: "@OpenConextMonitorBundle/Resources/config/routing.yml" prefix: / -surfnet_stepup_ra_ra: - resource: "@SurfnetStepupRaRaBundle/Resources/config/routing.yml" - logout: path: /logout methods: [POST] diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 065cb927..ccdfc3dc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -27,6 +27,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -40,6 +41,12 @@ public function __construct( { } + #[Route( + path: '/switch-locale', + name: 'ra_switch_locale', + requirements: ['return-url' => '.+'], + methods: ['POST'] + )] public function switchLocale(Request $request): RedirectResponse { $returnUrl = $request->query->get('return-url'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index 3ea0f8f5..7244a7b0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -22,23 +22,45 @@ use Surfnet\StepupRa\RaBundle\Service\ProfileService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Security; +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; -final class ProfileController extends AbstractController +#[AsController] +final class ProfileController { public function __construct( private readonly ProfileService $profileService, private readonly LoggerInterface $logger, + private readonly TokenInterface $token, + private readonly Environment $twig, ) { } + /** + * @throws SyntaxError + * @throws RuntimeError + * @throws LoaderError + */ + #[Route( + path: '/profile', + name: 'ra_profile', + methods: ['GET'], + )] public function profile(): Response { $this->logger->notice('Opening profile page'); - $identity = $this->getUser(); + $identity = $this->token->getUser(); $profile = $this->profileService->findByIdentityId($identity->id); - return $this->render('profile/profile.html.twig', ['profile' => $profile]); + return new Response( + $this->twig->render('profile/profile.html.twig', ['profile' => $profile])); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index c36bb916..fde9ea6d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -37,6 +37,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -55,6 +56,7 @@ public function __construct( { } + #[Route('/locations', name: 'ra_locations_manage', methods: ['GET', 'POST'])] public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -117,6 +119,7 @@ public function manage(Request $request): Response ]); } + #[Route('/locations/create/{institution}', name: 'ra_locations_create', methods: ['GET', 'POST'])] public function create(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -154,6 +157,11 @@ public function create(Request $request): Response ]); } + #[Route( + path: '/locations/{locationId}/change', + name: 'ra_locations_change', + methods: ['GET', 'POST'] + )] public function change(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -202,6 +210,7 @@ public function change(Request $request): Response ]); } + #[Route('/locations/remove', name: 'ra_locations_remove', methods: ['POST'])] public function remove(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index afca7d48..5f1291ac 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -41,6 +41,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -59,6 +60,11 @@ public function __construct( { } + #[Route( + path: '/management/ra', + name: 'ra_management_manage', + methods: ['GET'], + )] public function manage(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -111,6 +117,11 @@ public function manage(Request $request): Response ); } + #[Route( + path: '/management/search-ra-candidate', + name: 'ra_management_ra_candidate_search', + methods: ['GET', 'POST'], + )] public function raCandidateSearch(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -162,6 +173,11 @@ public function raCandidateSearch(Request $request): Response ); } + #[Route( + path: '/management/create-ra/{identityId}', + name: 'ra_management_create_ra', + methods: ['GET', 'POST'], + )] public function createRa(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -217,6 +233,11 @@ public function createRa(Request $request): Response * @param $identityId * @param $raInstitution */ + #[Route( + path: '/management/amend-ra-information/{identityId}/{raInstitution}', + name: 'ra_management_amend_ra_information', + methods: ['GET', 'POST'], + )] public function amendRaInformation(Request $request, $identityId, $raInstitution): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); @@ -262,6 +283,11 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution * @param $identityId * @param $raInstitution */ + #[Route( + path: '/management/retract-registration-authority/{identityId}/{raInstitution}', + name: 'ra_management_retract_registration_authority', + methods: ['GET', 'POST'], + )] public function retractRegistrationAuthority(Request $request, $identityId, $raInstitution): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index ac2ab452..280b19ba 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -29,6 +29,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; class RaaController extends AbstractController { @@ -41,6 +42,11 @@ public function __construct( { } + #[Route( + path: '/institution-configuration', + name: 'institution-configuration', + methods: ['GET', 'POST'], + )] public function institutionConfiguration(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 90bc812f..5c1a3313 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -30,6 +30,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; final class RecoveryTokenController extends AbstractController @@ -42,6 +43,11 @@ public function __construct( ) { } + #[Route( + path: '/recovery-tokens', + name: 'ra_recovery_tokens_search', + methods: ['GET', 'POST'] + )] public function search(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -96,6 +102,11 @@ public function search(Request $request): Response ); } + #[Route( + path: '/recovery-tokens/revoke', + name: 'ra_recovery_tokens_revoke', + methods: ['POST'] + )] public function revoke(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 72f57704..49eb62b7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -26,6 +26,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Surfnet\SamlBundle\Entity\ServiceProvider; +use Symfony\Component\Routing\Attribute\Route; class SamlController extends AbstractController { @@ -37,6 +38,7 @@ public function __construct( ) { } + #[Route('/saml/consume-assertion', name: 'ra_serviceprovider_consume_assertion', methods: ['POST'])] public function consumeAssertion(Request $httpRequest): Response { @@ -51,6 +53,7 @@ public function consumeAssertion(Request $httpRequest): Response ); } + #[Route('/saml/metadata', name: 'ra_saml_metadata', methods: ['GET'])] public function metadata(): XMLResponse { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index a20b2b3b..4bb47a32 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -34,6 +34,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -54,6 +55,11 @@ public function __construct( { } + #[Route( + path: '/second-factors', + name: 'ra_second_factors_search', + methods: ['GET', 'POST'] + )] public function search(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -123,6 +129,11 @@ public function export(SearchRaSecondFactorsCommand $command): Response return $this->secondFactorService->export($exportCommand); } + #[Route( + path: '/second-factors/revoke', + name: 'ra_second_factors_revoke', + methods: ['POST'] + )] public function revoke(Request $request): RedirectResponse { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -155,6 +166,16 @@ public function revoke(Request $request): RedirectResponse return $this->redirectToRoute('ra_second_factors_search'); } + #[Route( + path: '/second-factors/{identityId}/auditlog', + name: 'ra_second_factors_auditlog', + methods: ['GET'] + )] + #[Route( + path: '/recovery-tokens/{identityId}/auditlog', + name: 'ra_recovery_tokens_auditlog', + methods: ['GET'] + )] public function auditLog(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index 90ac8bd2..5680c444 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -22,6 +22,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Attribute\Route; class SecurityController extends AbstractController { @@ -31,6 +32,11 @@ public function __construct( { } + #[Route( + path: '/authentication/session-expired', + name: 'ra_security_session_expired', + methods: ['GET'], + )] public function sessionExpired(Request $request): Response { $redirectToUrl = $this diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index 59a7fc57..97013994 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -38,6 +38,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; /** * Orchestrates verification of GSSFs (Generic SAML Second Factors) through GSSPs (Generic SAML Stepup Providers). @@ -60,6 +61,11 @@ public function __construct( /** * Initiates verification of a GSSF. */ + #[Route( + path: '/vetting-procedure/{procedureId}/gssf/{provider}/initiate-verification', + name: 'ra_vetting_gssf_initiate', + methods: ['GET'] + )] public function initiate(string $procedureId, string $provider): Response { $this->assertSecondFactorEnabled($provider); @@ -77,6 +83,11 @@ public function initiate(string $procedureId, string $provider): Response return $this->renderInitiateForm($procedureId, $this->getProvider($provider)->getName()); } + #[Route( + path: '/vetting-procedure/{procedureId}/gssf/{provider}/authenticate', + name: 'ra_vetting_gssf_authenticate', + methods: ['POST'] + )] public function authenticate(string $procedureId, string $provider): Response { $this->assertSecondFactorEnabled($provider); @@ -118,6 +129,11 @@ public function authenticate(string $procedureId, string $provider): Response return $this->redirectBinding->createResponseFor($authnRequest); } + #[Route( + path: '/vetting-procedure/gssf/{provider}/verify', + name: 'ra_vetting_gssf_verify', + methods: ['POST'] + )] public function verify(Request $httpRequest, string $provider): Response { $this->assertSecondFactorEnabled($provider); @@ -189,6 +205,11 @@ public function verify(Request $httpRequest, string $provider): Response ); } + #[Route( + path: '/vetting-procedure/gssf/{provider}/metadata', + name: 'ra_vetting_gssf_metadata', + methods: ['GET'] + )] public function metadata(string $provider): XMLResponse { $this->assertSecondFactorEnabled($provider); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 1a62bb3f..46bf7071 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -31,6 +31,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; class SmsController extends SecondFactorController @@ -43,6 +44,11 @@ public function __construct( parent::__construct($logger); } + #[Route( + path: '/vetting-procedure/{procedureId}/send-sms-challenge', + name: 'ra_vetting_sms_send_challenge', + methods: ['GET', 'POST'], + )] public function sendChallenge(Request $request, string $procedureId): Response { $this->assertSecondFactorEnabled('sms'); @@ -111,6 +117,11 @@ public function sendChallenge(Request $request, string $procedureId): Response * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ + #[Route( + path: '/vetting-procedure/{procedureId}/verify-sms-challenge', + name: 'ra_vetting_sms_prove_possession', + methods: ['GET', 'POST'], + )] public function provePossession(Request $request, string $procedureId): Response { $this->assertSecondFactorEnabled('sms'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index a5e33b78..40a74917 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -23,10 +23,12 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; use Surfnet\StepupRa\RaBundle\Form\Type\VerifyYubikeyPublicIdType; +use Surfnet\StepupRa\RaBundle\Logger\ProcedureAwareLogger; use Surfnet\StepupRa\RaBundle\Service\VettingService; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; class YubikeyController extends SecondFactorController { @@ -38,6 +40,11 @@ public function __construct( parent::__construct($logger); } + #[Route( + path: '/vetting-procedure/{procedureId}/verify-yubikey', + name: 'ra_vetting_yubikey_verify', + methods: ['GET', 'POST'] + )] public function verify(Request $request, string $procedureId): Response { $this->assertSecondFactorEnabled('yubikey'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 00d762b5..27061c9d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -37,6 +37,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -54,11 +55,15 @@ public function __construct( ) { } - /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) https://www.pivotaltracker.com/story/show/135045063 * @SuppressWarnings(PHPMD.NPathComplexity) https://www.pivotaltracker.com/story/show/135045063 */ + #[Route( + path: '/', + name: 'ra_vetting_search', + methods: ['GET', 'POST'], + )] public function startProcedure(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -173,6 +178,11 @@ public function startProcedure(Request $request): Response } } + #[Route( + path: '/vetting-procedure/{procedureId}/cancel', + name: 'ra_vetting_cancel', + methods: ['POST'], + )] public function cancelProcedure($procedureId): RedirectResponse { $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); @@ -192,6 +202,11 @@ public function cancelProcedure($procedureId): RedirectResponse * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ + #[Route( + path: '/vetting-procedure/{procedureId}/verify-identity', + name: 'ra_vetting_verify_identity', + methods: ['GET', 'POST'], + )] public function verifyIdentity(Request $request, string $procedureId): Response { $this->denyAccessUnlessGranted('ROLE_RA'); @@ -277,6 +292,11 @@ public function verifyIdentity(Request $request, string $procedureId): Response } } + #[Route( + path: '/vetting-procedure/{procedureId}/completed', + name: 'ra_vetting_completed', + methods: ['GET'], + )] public function vettingCompleted(): Response { return $this->render('vetting/vetting_completed.html.twig'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index faa846fa..488617e2 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -30,6 +30,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Attribute\Route; class VettingTypeHintController extends AbstractController { @@ -50,6 +51,11 @@ public function __construct( /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) Given the two forms being handled in this action, cc is higher. */ + #[Route( + path: '/vetting-type-hint', + name: 'vetting_type_hint', + methods: ['GET', 'POST'] + )] public function vettingTypeHint(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RAA'); diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml deleted file mode 100644 index a19fec99..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/routing.yml +++ /dev/null @@ -1,170 +0,0 @@ -ra_saml_metadata: - path: /authentication/metadata - methods: [GET] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\SamlController::metadata } - -ra_serviceprovider_consume_assertion: - path: /authentication/consume-assertion - methods: [POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\SamlController::consumeAssertion } - -ra_locations_manage: - path: /locations - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::manage } - -ra_location_create: - path: /locations/create/{institution} - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::create } - -ra_location_change: - path: /locations/{locationId}/change - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::change } - -ra_location_remove: - path: /locations/remove - methods: [POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RaLocationController::remove } - -ra_second_factors_search: - path: /second-factors - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::search} - -ra_second_factor_revoke: - path: /second-factors/revoke - methods: [POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::revoke } - -ra_second_factor_auditlog: - path: /second-factors/{identityId}/auditlog - methods: [GET] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::auditLog } - -ra_recovery_tokens_search: - path: /recovery-tokens - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RecoveryTokenController::search } - -ra_recovery_tokens_revoke: - path: /recovery-tokens/revoke - methods: [POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\RecoveryTokenController::revoke } - -ra_recovery_tokens_auditlog: - path: /recovery-tokens/{identityId}/auditlog - methods: [ GET ] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\SecondFactorController::auditLog } - -ra_vetting_search: - path: / - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\VettingController::startProcedure } - -ra_vetting_cancel: - path: /vetting-procedure/{procedureId}/cancel - methods: [POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\VettingController::cancelProcedure } - -ra_vetting_yubikey_verify: - path: /vetting-procedure/{procedureId}/verify-yubikey - methods: [GET, POST] - defaults: { _controller: Surfnet\StepupRa\RaBundle\Controller\Vetting\YubikeyController::verify } - -ra_vetting_sms_send_challenge: - path: /vetting-procedure/{procedureId}/send-sms-challenge - methods: [GET, POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\SmsController::sendChallenge } - -ra_vetting_sms_prove_possession: - path: /vetting-procedure/{procedureId}/verify-sms-challenge - methods: [GET,POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\SmsController::provePossession} - -ra_vetting_gssf_initiate: - path: /vetting-procedure/{procedureId}/gssf/{provider}/initiate-verification - methods: [GET] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::initiate } - -ra_vetting_gssf_authenticate: - path: /vetting-procedure/{procedureId}/gssf/{provider}/authenticate - methods: [POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::authenticate} - -ra_vetting_gssf_verify: - path: /vetting-procedure/gssf/{provider}/verify - methods: [POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::verify } - -ra_vetting_gssf_metadata: - path: /vetting-procedure/gssf/{provider}/metadata - methods: [GET] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\Vetting\GssfController::metadata} - -ra_vetting_verify_identity: - path: /vetting-procedure/{procedureId}/verify-identity - methods: [GET, POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\VettingController::verifyIdentity } - -ra_vetting_completed: - path: /vetting-procedure/{procedureId}/completed - methods: [GET] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\VettingController::vettingCompleted} - -ra_management_manage: - path: /management/ra - methods: [GET] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::manage } - -ra_management_ra_candidate_search: - path: /management/search-ra-candidate - methods: [GET, POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::raCandidateSearch } - -ra_management_create_ra: - path: /management/create-ra/{identityId} - methods: [GET, POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::createRa } - -ra_management_amend_ra_information: - path: /management/amend-ra-information/{identityId}/{raInstitution} - methods: [GET, POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::amendRaInformation} - -ra_management_retract_registration_authority: - path: /management/retract-registration-authority/{identityId}/{raInstitution} - methods: [GET, POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\RaManagementController::retractRegistrationAuthority } - -institution-configuration: - path: /institution-configuration - methods: [GET, POST] - defaults: - _controller: \Surfnet\StepupRa\RaBundle\Controller\RaaController::institutionConfiguration - -vetting_type_hint: - path: /vetting-type-hint - methods: [GET, POST] - defaults: - _controller: \Surfnet\StepupRa\RaBundle\Controller\VettingTypeHintController::vettingTypeHint - -ra_switch_locale: - path: /switch-locale - methods: [POST] - defaults: { _controller: \Surfnet\StepupRa\RaBundle\Controller\LocaleController::switchLocale} - requirements: - 'return-url': '.+' - -ra_security_session_expired: - path: /authentication/session-expired - methods: [GET] - defaults: - _controller: \Surfnet\StepupRa\RaBundle\Controller\SecurityController::sessionExpired - -ra_profile: - path: /profile - methods: [GET] - defaults: - _controller: \Surfnet\StepupRa\RaBundle\Controller\ProfileController::profile From 3683b5750c90e4f492807e5930bbd89ac719e891 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 11:09:06 +0100 Subject: [PATCH 083/202] Add route attribute --- .../RaBundle/Controller/ProfileController.php | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index 7244a7b0..57486a8f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -22,32 +22,17 @@ use Surfnet\StepupRa\RaBundle\Service\ProfileService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\Routing\Attribute\Route; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Core\Security; -use Twig\Environment; -use Twig\Error\LoaderError; -use Twig\Error\RuntimeError; -use Twig\Error\SyntaxError; -#[AsController] -final class ProfileController +final class ProfileController extends AbstractController { public function __construct( private readonly ProfileService $profileService, private readonly LoggerInterface $logger, - private readonly TokenInterface $token, - private readonly Environment $twig, ) { } - /** - * @throws SyntaxError - * @throws RuntimeError - * @throws LoaderError - */ #[Route( path: '/profile', name: 'ra_profile', @@ -57,10 +42,10 @@ public function profile(): Response { $this->logger->notice('Opening profile page'); - $identity = $this->token->getUser(); + $identity = $this->getUser(); $profile = $this->profileService->findByIdentityId($identity->id); - return new Response( - $this->twig->render('profile/profile.html.twig', ['profile' => $profile])); + return + $this->render('profile/profile.html.twig', ['profile' => $profile]); } } From ecd526c7442ba13936d286df04128ee5a9bc98a3 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 11:54:00 +0100 Subject: [PATCH 084/202] Change config --- composer.json | 7 +- composer.lock | 225 ++++++------------ config/packages/security.yaml | 11 +- config/packages/surfnet_saml.yaml | 6 +- config/packages/twig.yaml | 2 +- config/packages/twig_extensions.yaml | 0 config/services.yaml | 22 +- src/Kernel.php | 7 - .../Controller/ExceptionController.php | 41 +++- .../Compiler/GssfSessionBagSessionPass.php | 37 --- .../RaBundle/Resources/config/security.yml | 4 +- .../RaBundle/Resources/config/services.yml | 25 +- .../Authentication/Provider/SamlProvider.php | 34 ++- .../StepupRa/RaBundle/Service/GssfService.php | 11 +- .../RaBundle/Service/IdentityService.php | 3 +- .../RaBundle/SurfnetStepupRaRaBundle.php | 2 - .../Compiler/StateHandlerSessionPass.php | 37 --- ...netStepupRaSamlStepupProviderExtension.php | 7 +- .../Resources/config/services.yml | 5 - ...urfnetStepupRaSamlStepupProviderBundle.php | 1 - symfony.lock | 12 - 21 files changed, 199 insertions(+), 300 deletions(-) delete mode 100644 config/packages/twig_extensions.yaml delete mode 100644 src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php delete mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php diff --git a/composer.json b/composer.json index d09dd972..2128bb8a 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,8 @@ "minimum-stability": "stable", "require": { "php": "^8.2", + "ext-dom": "*", + "ext-openssl": "*", "fortawesome/font-awesome": "~4.2.0", "guzzlehttp/guzzle": "^7", "incenteev/composer-parameter-handler": "~2.0", @@ -35,11 +37,8 @@ "symfony/validator": "^6.0", "symfony/webpack-encore-bundle": "^1.7", "twbs/bootstrap": "~3.3.0", - "twig/extensions": "~1.5", "twig/extra-bundle": "^3.0", - "twig/twig": "^2.12 || ^3.0", - "ext-openssl": "*", - "ext-dom": "*" + "twig/twig": "^3.0" }, "require-dev": { "matthiasnoback/symfony-config-test": "^4.0", diff --git a/composer.lock b/composer.lock index d4217f96..e6a9ceca 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d2abfb0c1ec083bc716d1b0544927ce9", + "content-hash": "071df17d9fdb094937404f3cfc5d55f1", "packages": [ { "name": "beberlei/assert", @@ -1678,38 +1678,38 @@ }, { "name": "knplabs/knp-components", - "version": "v3.6.0", + "version": "v4.3.0", "source": { "type": "git", "url": "https://github.com/KnpLabs/knp-components.git", - "reference": "145d74f3fbb24619a60a6f7e54aa4bd10862b07a" + "reference": "ac704489426b090ea0e7ff4d1dd06e26baa49ee7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/145d74f3fbb24619a60a6f7e54aa4bd10862b07a", - "reference": "145d74f3fbb24619a60a6f7e54aa4bd10862b07a", + "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/ac704489426b090ea0e7ff4d1dd06e26baa49ee7", + "reference": "ac704489426b090ea0e7ff4d1dd06e26baa49ee7", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0", - "symfony/event-dispatcher-contracts": "^2.0 || ^3.0", - "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0" + "php": "^8.0", + "symfony/event-dispatcher-contracts": "^3.0" }, "conflict": { - "doctrine/dbal": "<2.10" + "doctrine/dbal": "<3.1" }, "require-dev": { - "doctrine/mongodb-odm": "^2.0", - "doctrine/orm": "^2.7", - "doctrine/phpcr-odm": "^1.2", + "doctrine/mongodb-odm": "^2.4", + "doctrine/orm": "^2.12", + "doctrine/phpcr-odm": "^1.6", "ext-pdo_sqlite": "*", - "jackalope/jackalope-doctrine-dbal": "^1.2", + "jackalope/jackalope-doctrine-dbal": "^1.8", "phpunit/phpunit": "^9.5", "propel/propel1": "^1.7", "ruflin/elastica": "^7.0", "solarium/solarium": "^6.0", - "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0", - "symfony/property-access": "^4.4 || ^5.4 || ^6.0" + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/property-access": "^5.4 || ^6.0 || ^7.0" }, "suggest": { "doctrine/common": "to allow usage pagination with Doctrine ArrayCollection", @@ -1719,12 +1719,13 @@ "propel/propel1": "to allow usage pagination with Propel ORM", "ruflin/elastica": "to allow usage pagination with ElasticSearch Client", "solarium/solarium": "to allow usage pagination with Solarium Client", - "symfony/property-access": "To allow sorting arrays" + "symfony/http-foundation": "to retrieve arguments from Request", + "symfony/property-access": "to allow sorting arrays" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { @@ -1747,7 +1748,7 @@ } ], "description": "Knplabs component library", - "homepage": "http://github.com/KnpLabs/knp-components", + "homepage": "https://github.com/KnpLabs/knp-components", "keywords": [ "components", "knp", @@ -1757,41 +1758,41 @@ ], "support": { "issues": "https://github.com/KnpLabs/knp-components/issues", - "source": "https://github.com/KnpLabs/knp-components/tree/v3.6.0" + "source": "https://github.com/KnpLabs/knp-components/tree/v4.3.0" }, - "time": "2022-08-18T06:36:14+00:00" + "time": "2023-10-16T09:30:16+00:00" }, { "name": "knplabs/knp-paginator-bundle", - "version": "v5.9.0", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/KnpLabs/KnpPaginatorBundle.git", - "reference": "7879916a8af4f4d4668535cb0b71f55cc416da66" + "reference": "f51fe26df07a08c1b3f272474401ef8a008b190c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/7879916a8af4f4d4668535cb0b71f55cc416da66", - "reference": "7879916a8af4f4d4668535cb0b71f55cc416da66", + "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/f51fe26df07a08c1b3f272474401ef8a008b190c", + "reference": "f51fe26df07a08c1b3f272474401ef8a008b190c", "shasum": "" }, "require": { - "knplabs/knp-components": "^2.4 || ^3.0", - "php": "^7.3 || ^8.0", - "symfony/config": "^4.4 || ^5.4 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0", - "symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0", - "symfony/http-foundation": "^4.4 || ^5.4 || ^6.0", - "symfony/http-kernel": "^4.4 || ^5.4 || ^6.0", - "symfony/routing": "^4.4 || ^5.4 || ^6.0", - "symfony/translation": "^4.4 || ^5.4 || ^6.0", - "twig/twig": "^2.0 || ^3.0" + "knplabs/knp-components": "^4.1", + "php": "^8.1", + "symfony/config": "^6.3 || ^7.0", + "symfony/dependency-injection": "^6.3 || ^7.0", + "symfony/event-dispatcher": "^6.3 || ^7.0", + "symfony/http-foundation": "^6.3 || ^7.0", + "symfony/http-kernel": "^6.3 || ^7.0", + "symfony/routing": "^6.3 || ^7.0", + "symfony/translation": "^6.3 || ^7.0", + "twig/twig": "^3.0" }, "require-dev": { - "phpstan/phpstan": "^1.2", - "phpunit/phpunit": "^8.5 || ^9.5", - "symfony/expression-language": "^4.4 || ^5.4 || ^6.0", - "symfony/templating": "^4.4 || ^5.4 || ^6.0" + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", + "symfony/expression-language": "^6.3 || ^7.0", + "symfony/templating": "^6.3 || ^7.0" }, "type": "symfony-bundle", "extra": { @@ -1811,15 +1812,15 @@ "authors": [ { "name": "KnpLabs Team", - "homepage": "http://knplabs.com" + "homepage": "https://knplabs.com" }, { "name": "Symfony Community", - "homepage": "http://github.com/KnpLabs/KnpPaginatorBundle/contributors" + "homepage": "https://github.com/KnpLabs/KnpPaginatorBundle/contributors" } ], "description": "Paginator bundle for Symfony to automate pagination and simplify sorting and other features", - "homepage": "http://github.com/KnpLabs/KnpPaginatorBundle", + "homepage": "https://github.com/KnpLabs/KnpPaginatorBundle", "keywords": [ "bundle", "knp", @@ -1831,9 +1832,9 @@ ], "support": { "issues": "https://github.com/KnpLabs/KnpPaginatorBundle/issues", - "source": "https://github.com/KnpLabs/KnpPaginatorBundle/tree/v5.9.0" + "source": "https://github.com/KnpLabs/KnpPaginatorBundle/tree/v6.3.0" }, - "time": "2022-08-28T14:42:14+00:00" + "time": "2023-11-19T08:15:37+00:00" }, { "name": "monolog/monolog", @@ -2991,16 +2992,16 @@ }, { "name": "surfnet/stepup-saml-bundle", - "version": "6.0.4", + "version": "6.0.17", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-saml-bundle.git", - "reference": "381d7bcf45aa702f8e691a8103062da7afb8c4e9" + "reference": "d1ec60c2f50c0542d3026353176a2b389fe67239" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-saml-bundle/zipball/381d7bcf45aa702f8e691a8103062da7afb8c4e9", - "reference": "381d7bcf45aa702f8e691a8103062da7afb8c4e9", + "url": "https://api.github.com/repos/OpenConext/Stepup-saml-bundle/zipball/d1ec60c2f50c0542d3026353176a2b389fe67239", + "reference": "d1ec60c2f50c0542d3026353176a2b389fe67239", "shasum": "" }, "require": { @@ -3009,11 +3010,11 @@ "php": "^8.1", "robrichards/xmlseclibs": "^3.1.1", "simplesamlphp/saml2": "^4.6", - "symfony/dependency-injection": "5.4.*|^6", - "symfony/framework-bundle": "5.4.*|^6", - "symfony/security-bundle": "5.4.*|^6", - "symfony/templating": "5.4.*|^6", - "twig/twig": "^2|^3" + "symfony/dependency-injection": "^6.3", + "symfony/framework-bundle": "^6.3", + "symfony/security-bundle": "^6.3", + "symfony/templating": "^6.3", + "twig/twig": "^3" }, "require-dev": { "ext-zlib": "*", @@ -3028,7 +3029,7 @@ "sebastian/exporter": "^4.0.5", "sebastian/phpcpd": "^6.0", "squizlabs/php_codesniffer": "^3.7.1", - "symfony/phpunit-bridge": "5.4.*|^6" + "symfony/phpunit-bridge": "^6.3" }, "type": "symfony-bundle", "extra": { @@ -3047,7 +3048,7 @@ "license": [ "Apache-2.0" ], - "description": "A Symfony 5|6 bundle that integrates the simplesamlphp\\saml2 library with Symfony.", + "description": "A Symfony 6 bundle that integrates the simplesamlphp\\saml2 library with Symfony.", "keywords": [ "SAML2", "saml", @@ -3057,9 +3058,9 @@ ], "support": { "issues": "https://github.com/OpenConext/Stepup-saml-bundle/issues", - "source": "https://github.com/OpenConext/Stepup-saml-bundle/tree/6.0.4" + "source": "https://github.com/OpenConext/Stepup-saml-bundle/tree/6.0.17" }, - "time": "2023-10-10T07:52:25+00:00" + "time": "2024-01-23T16:56:47+00:00" }, { "name": "symfony/asset", @@ -7199,89 +7200,29 @@ }, "time": "2016-07-25T15:51:55+00:00" }, - { - "name": "twig/extensions", - "version": "v1.5.4", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig-extensions.git", - "reference": "57873c8b0c1be51caa47df2cdb824490beb16202" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/57873c8b0c1be51caa47df2cdb824490beb16202", - "reference": "57873c8b0c1be51caa47df2cdb824490beb16202", - "shasum": "" - }, - "require": { - "twig/twig": "^1.27|^2.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^3.4", - "symfony/translation": "^2.7|^3.4" - }, - "suggest": { - "symfony/translation": "Allow the time_diff output to be translated" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "autoload": { - "psr-0": { - "Twig_Extensions_": "lib/" - }, - "psr-4": { - "Twig\\Extensions\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Common additional features for Twig that do not directly belong in core", - "keywords": [ - "i18n", - "text" - ], - "support": { - "issues": "https://github.com/twigphp/Twig-extensions/issues", - "source": "https://github.com/twigphp/Twig-extensions/tree/master" - }, - "abandoned": true, - "time": "2018-12-05T18:34:18+00:00" - }, { "name": "twig/extra-bundle", - "version": "v3.7.1", + "version": "v3.8.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3" + "reference": "32807183753de0388c8e59f7ac2d13bb47311140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3", - "reference": "f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/32807183753de0388c8e59f7ac2d13bb47311140", + "reference": "32807183753de0388c8e59f7ac2d13bb47311140", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/framework-bundle": "^5.4|^6.0", - "symfony/twig-bundle": "^5.4|^6.0", - "twig/twig": "^2.7|^3.0" + "symfony/framework-bundle": "^5.4|^6.0|^7.0", + "symfony/twig-bundle": "^5.4|^6.0|^7.0", + "twig/twig": "^3.0" }, "require-dev": { "league/commonmark": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.4|^6.3", + "symfony/phpunit-bridge": "^6.4|^7.0", "twig/cache-extra": "^3.0", "twig/cssinliner-extra": "^2.12|^3.0", "twig/html-extra": "^2.12|^3.0", @@ -7319,7 +7260,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.7.1" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.8.0" }, "funding": [ { @@ -7331,42 +7272,34 @@ "type": "tidelift" } ], - "time": "2023-07-29T15:34:56+00:00" + "time": "2023-11-21T14:02:01+00:00" }, { "name": "twig/twig", - "version": "v2.16.0", + "version": "v3.8.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623" + "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/0c9cc7ef2e0ec6d20c5af1200522a89ba101f623", - "reference": "0c9cc7ef2e0ec6d20c5af1200522a89ba101f623", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", + "reference": "9d15f0ac07f44dc4217883ec6ae02fd555c6f71d", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.8" + "symfony/polyfill-php80": "^1.22" }, "require-dev": { - "psr/container": "^1.0", - "symfony/phpunit-bridge": "^5.4.9|^6.3" + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.3|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.16-dev" - } - }, "autoload": { - "psr-0": { - "Twig_": "lib/" - }, "psr-4": { "Twig\\": "src/" } @@ -7399,7 +7332,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v2.16.0" + "source": "https://github.com/twigphp/Twig/tree/v3.8.0" }, "funding": [ { @@ -7411,7 +7344,7 @@ "type": "tidelift" } ], - "time": "2023-12-22T07:22:15+00:00" + "time": "2023-11-21T18:54:41+00:00" }, { "name": "ua-parser/uap-php", @@ -10671,8 +10604,8 @@ "prefer-lowest": false, "platform": { "php": "^8.2", - "ext-openssl": "*", - "ext-dom": "*" + "ext-dom": "*", + "ext-openssl": "*" }, "platform-dev": [], "platform-overrides": { diff --git a/config/packages/security.yaml b/config/packages/security.yaml index c35c75c1..9ba1229a 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -10,8 +10,6 @@ security: default: pattern: ^/authentication/(metadata|session-expired)$ - logout_on_user_change: true - anonymous: ~ monitor: pattern: ^/(info|health)$ @@ -22,15 +20,10 @@ security: security: false saml_based: - saml: true - logout_on_user_change: true + custom_authenticators: + - Surfnet\SamlBundle\Security\Authentication\SamlAuthenticator logout: path: /logout - success_handler: "ra.security.authentication.handler.logout_success" - invalidate_session: true - csrf_token_generator: security.csrf.token_manager - csrf_parameter: 't' - csrf_token_id: 'registration_authority_logout_token' role_hierarchy: ROLE_SRAA: ROLE_RAA diff --git a/config/packages/surfnet_saml.yaml b/config/packages/surfnet_saml.yaml index 0a8e4da5..021d3015 100644 --- a/config/packages/surfnet_saml.yaml +++ b/config/packages/surfnet_saml.yaml @@ -1,4 +1,8 @@ +parameters: + acs_location_route_name: ra_serviceprovider_consume_assertion + surfnet_saml: + enable_authentication: true hosted: attribute_dictionary: ignore_unknown_attributes: true @@ -16,4 +20,4 @@ surfnet_saml: enabled: true entity_id: "%saml_remote_idp_entity_id%" sso_url: "%saml_remote_idp_sso_url%" - certificate: "%saml_remote_idp_certificate%" \ No newline at end of file + certificate: "%saml_remote_idp_certificate%" diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index c44360dc..48684c67 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,6 +1,6 @@ twig: paths: - '%kernel.project_dir%/templates': SurfnetStepupRaRa + '%kernel.project_dir%/templates': 'default' debug: "%kernel.debug%" strict_variables: "%kernel.debug%" date: diff --git a/config/packages/twig_extensions.yaml b/config/packages/twig_extensions.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/config/services.yaml b/config/services.yaml index f932a96d..0b40904d 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -15,6 +15,22 @@ services: resource: '../src/Surfnet/StepupRa/RaBundle/Controller/*' tags: [ 'controller.service_arguments' ] - twig.extension.text: # Required by JMSTranslationBundle - class: Twig_Extensions_Extension_Text - tags: [{ name: twig.extension }] + logger: + alias: 'monolog.logger' + public: true + + surfnet_saml.saml_provider: + class: Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider + arguments: + $identityService: '@ra.service.identity' + + Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider: + alias: surfnet_saml.saml_provider + + templating: + alias: 'twig' + + ra.service.gssf: + class: Surfnet\StepupRa\RaBundle\Service\GssfService + arguments: + - "@gssp.session.namespaced_attribute_bag" diff --git a/src/Kernel.php b/src/Kernel.php index 10e367d7..0b1a3b57 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -45,12 +45,5 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void - { - $confDir = $this->getProjectDir().'/config'; - $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php index b4f6a125..c14b6519 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php @@ -18,19 +18,24 @@ namespace Surfnet\StepupRa\RaBundle\Controller; -use Exception; +use DateTime; +use DateTimeInterface; use Surfnet\StepupBundle\Controller\ExceptionController as BaseExceptionController; +use Surfnet\StepupBundle\Exception\Art; use Surfnet\StepupRa\RaBundle\Exception\LoaTooLowException; use Surfnet\StepupRa\RaBundle\Exception\MissingRequiredAttributeException; use Surfnet\StepupRa\RaBundle\Exception\UserNotRaException; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; +use Throwable; final class ExceptionController extends BaseExceptionController { /** * @return array View parameters 'title' and 'description' */ - protected function getPageTitleAndDescription(\Throwable $exception): array + protected function getPageTitleAndDescription(Throwable $exception): array { $translator = $this->getTranslator(); @@ -58,4 +63,36 @@ protected function getPageTitleAndDescription(\Throwable $exception): array return parent::getPageTitleAndDescription($exception); } + + public function __invoke(Request $request, Throwable $exception): Response + { + $statusCode = $this->getStatusCode($exception); + + $template = '@default/bundles/TwigBundle/Exception/error.html.twig'; + if ($statusCode == 404) { + $template = '@default/bundles/TwigBundle/Exception/error404.html.twig'; + } + + $response = new Response('', $statusCode); + + $timestamp = (new DateTime)->format(DateTimeInterface::ATOM); + $hostname = $request->getHost(); + $requestId = $this->requestId; + $errorCode = Art::forException($exception); + $userAgent = $request->headers->get('User-Agent'); + $ipAddress = $request->getClientIp(); + + return $this->render( + $template, + [ + 'timestamp' => $timestamp, + 'hostname' => $hostname, + 'request_id' => $requestId->get(), + 'error_code' => $errorCode, + 'user_agent' => $userAgent, + 'ip_address' => $ipAddress, + ] + $this->getPageTitleAndDescription($exception), + $response + ); + } } diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php deleted file mode 100644 index 4550c737..00000000 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Compiler/GssfSessionBagSessionPass.php +++ /dev/null @@ -1,37 +0,0 @@ -getDefinition('session') - ->addMethodCall('registerBag', [new Reference('ra.service.gssf.namespaced_attribute_bag')]); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index 58afd693..7845a9ee 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -10,7 +10,7 @@ services: ra.security.authentication.provider.saml: class: Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider arguments: - - "@ra.service.identity" + - '@ra.service.identity' - "@ra.service.profile" - "@surfnet_saml.saml.attribute_dictionary" - "@logger" @@ -84,7 +84,7 @@ services: - "@security.authentication.manager" - "@surfnet_stepup.service.loa_resolution" - "@surfnet_saml.logger" - - "@templating" + - "@twig" # Session ra.security.authentication.session.session_storage: diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index 7884b430..052d7af5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -1,12 +1,19 @@ services: # To be compatible with loading services from the container instead of using DI, TODO, Utilize DI throughout the # application. - _defaults: { public: true } + _defaults: + autowire: true + autoconfigure: true + public: true logger: alias: 'monolog.logger' public: true + Surfnet\StepupRa\RaBundle\Controller\: + resource: '../../Controller/' + tags: ['controller.service_arguments'] + ra.service.command: class: Surfnet\StepupRa\RaBundle\Service\CommandService arguments: @@ -130,22 +137,6 @@ services: ra.service.gssf: class: Surfnet\StepupRa\RaBundle\Service\GssfService - arguments: - - "@ra.service.gssf.sessionbag" - - ra.service.gssf.sessionbag: - class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag - factory: ['@session', 'getBag'] - arguments: ['ra.service.gssf'] - - ra.service.gssf.namespaced_attribute_bag: - public: false - class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag - arguments: - - '__ra.service.gssf__' - - '/' - calls: - - [setName, ['ra.service.gssf']] ra.service.audit_log: class: Surfnet\StepupRa\RaBundle\Service\AuditLogService diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index be4b1019..048b6708 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -19,8 +19,11 @@ namespace Surfnet\StepupRa\RaBundle\Security\Authentication\Provider; use Psr\Log\LoggerInterface; +use SAML2\Assertion; use Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary; use Surfnet\SamlBundle\SAML2\Response\AssertionAdapter; +use Surfnet\SamlBundle\Security\Authentication\Provider\SamlProviderInterface; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Exception\MissingRequiredAttributeException; use Surfnet\StepupRa\RaBundle\Exception\UserNotRaException; use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; @@ -29,12 +32,14 @@ use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - The SamlProvider needs to test several authorizations in order * to determine the user may, or may not log in. This causes the coupling. */ -class SamlProvider implements AuthenticationProviderInterface +class SamlProvider implements SamlProviderInterface, UserProviderInterface { public function __construct( private readonly IdentityService $identityService, @@ -57,7 +62,7 @@ public function authenticate(TokenInterface $token): TokenInterface $identity = $this->identityService->findByNameIdAndInstitution($nameId, $institution); // if no identity can be found, we're done. - if (!$identity instanceof \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity) { + if (!$identity instanceof Identity) { throw new BadCredentialsException( 'Unable to find Identity matching the criteria. Has the identity been registered before?', ); @@ -138,4 +143,29 @@ public function supports(TokenInterface $token): bool { return $token instanceof SamlToken; } + + public function getNameId(Assertion $assertion): string + { + // TODO: Implement getNameId() method. + } + + public function getUser(Assertion $assertion): UserInterface + { + // TODO: Implement getUser() method. + } + + public function refreshUser(UserInterface $user) + { + // TODO: Implement refreshUser() method. + } + + public function supportsClass(string $class) + { + // TODO: Implement supportsClass() method. + } + + public function loadUserByIdentifier(string $identifier): UserInterface + { + // TODO: Implement loadUserByIdentifier() method. + } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index aad89747..5ae824f9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -27,19 +27,12 @@ public function __construct(private AttributeBagInterface $state) { } - /** - * @param string $gssfId - * @param string $procedureId - */ - public function startVerification($gssfId, $procedureId): void + public function startVerification(string $gssfId, string $procedureId): void { $this->state->set('current_verification', ['procedureId' => $procedureId, 'gssfId' => $gssfId]); } - /** - * @param string $gssfId - */ - public function verify($gssfId): VerificationResult + public function verify(string $gssfId): VerificationResult { $verification = $this->state->remove('current_verification'); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index 3ad60372..a4cee1a4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -46,7 +46,7 @@ public function __construct( * * If needed, the username is the UUID of the identity so it can be fetched rather easy */ - public function loadUserByUsername($username): never + public function loadUserByIdentifier($username): never { throw new RuntimeException(sprintf('Cannot Load User By Username "%s"', $username)); } @@ -144,4 +144,5 @@ public function switchLocale(SwitchLocaleCommand $command): bool return $result->isSuccessful(); } + } diff --git a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php index f6efc0b7..d9f8d496 100644 --- a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php +++ b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php @@ -33,7 +33,5 @@ public function build(ContainerBuilder $container): void /** @var SecurityExtension $extension */ $extension = $container->getExtension('security'); $extension->addAuthenticatorFactory(new SamlFactory()); - - $container->addCompilerPass(new GssfSessionBagSessionPass()); } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php deleted file mode 100644 index 81420b1c..00000000 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/StateHandlerSessionPass.php +++ /dev/null @@ -1,37 +0,0 @@ -getDefinition('session') - ->addMethodCall('registerBag', [new Reference('gssp.session.namespaced_attribute_bag')]); - } -} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index 9d50ec5a..7965f79f 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -1,5 +1,7 @@ processConfiguration($configuration, $configs); - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); foreach ($config['providers'] as $provider => $providerConfiguration) { // may seem a bit strange, but this prevents casing issue when getting/setting/creating provider // service definitions etc. + + assert(is_string($provider)); if ($provider !== strtolower((string) $provider)) { throw new InvalidConfigurationException('The provider name must be completely lowercase'); } @@ -76,7 +79,7 @@ private function loadProviderConfiguration( $this->createRemoteDefinition($provider, $configuration['remote'], $container); $stateHandlerDefinition = new Definition(StateHandler::class, [ - new Reference('gssp.sessionbag'), + new Reference('request_stack'), $provider ]); $container->setDefinition('gssp.provider.' . $provider . '.statehandler', $stateHandlerDefinition); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index 5d3aede6..2e885713 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -10,11 +10,6 @@ services: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository: alias: gssp.provider_repository - gssp.sessionbag: - class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag - factory: ['@session', 'getBag'] - arguments: ['gssp'] - gssp.session.namespaced_attribute_bag: public: false class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php index 85a7927c..579a4858 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php @@ -27,7 +27,6 @@ class SurfnetStepupRaSamlStepupProviderBundle extends Bundle { public function build(ContainerBuilder $container): void { - $container->addCompilerPass(new StateHandlerSessionPass()); $container->addCompilerPass(new ViewConfigCollectionPass()); } } diff --git a/symfony.lock b/symfony.lock index a5163b27..34042d4a 100644 --- a/symfony.lock +++ b/symfony.lock @@ -598,18 +598,6 @@ "twbs/bootstrap": { "version": "v3.3.7" }, - "twig/extensions": { - "version": "1.0", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "1.0", - "ref": "a86723ee8d8b2f9437c8ce60a5546a1c267da5ed" - }, - "files": [ - "config/packages/twig_extensions.yaml" - ] - }, "twig/extra-bundle": { "version": "v3.0.3" }, From 5ad2bfa548aad4d2cecec787f0e9fbba3e8ac354 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 11:54:28 +0100 Subject: [PATCH 085/202] Add error bundle --- config/routes/controllers.yaml | 7 ++++ .../TwigBundle/Exception/error.html.twig | 42 +++++++++++++++++++ .../TwigBundle/Exception/error404.html.twig | 15 +++++++ 3 files changed, 64 insertions(+) create mode 100644 config/routes/controllers.yaml create mode 100644 templates/bundles/TwigBundle/Exception/error.html.twig create mode 100644 templates/bundles/TwigBundle/Exception/error404.html.twig diff --git a/config/routes/controllers.yaml b/config/routes/controllers.yaml new file mode 100644 index 00000000..d9df70f6 --- /dev/null +++ b/config/routes/controllers.yaml @@ -0,0 +1,7 @@ +controllers: + resource: ../../src/Surfnet/StepupRa/RaBundle/Controller + type: attribute + +kernel: + resource: ../../src/Kernel.php + type: attribute diff --git a/templates/bundles/TwigBundle/Exception/error.html.twig b/templates/bundles/TwigBundle/Exception/error.html.twig new file mode 100644 index 00000000..7a25dcb5 --- /dev/null +++ b/templates/bundles/TwigBundle/Exception/error.html.twig @@ -0,0 +1,42 @@ +{% extends 'base.html.twig' %} + +{% block title %}{{ 'Error - ' ~ title }}{% endblock %} + +{% block content %} +

{{ description }}

+ + + + + + + + + + + + + + + + + + + {% if user_agent %} + + + + + {% endif %} + + + + +
{{ 'stepup.error.timestamp'|trans }}{{ timestamp }}
{{ 'stepup.error.hostname'|trans }}{{ hostname }}
{{ 'stepup.error.request_id'|trans }}{{ request_id }}
{{ 'stepup.error.error_code'|trans }}{{ error_code }}
{{ 'stepup.error.user_agent'|trans }}{{ user_agent }}
{{ 'stepup.error.ip_address'|trans }}{{ ip_address }}
+ +

{{ 'stepup.error.support_page.text'|trans({'%support_url%': global_view_parameters.supportUrl })|raw }}

+ + {# For now the back button is not shown on the error page until a more intelligent solution is thought of #} + {% block back_button %}{% endblock %} + +{% endblock %} diff --git a/templates/bundles/TwigBundle/Exception/error404.html.twig b/templates/bundles/TwigBundle/Exception/error404.html.twig new file mode 100644 index 00000000..185692a6 --- /dev/null +++ b/templates/bundles/TwigBundle/Exception/error404.html.twig @@ -0,0 +1,15 @@ +{% extends 'base.html.twig' %} + +{% block title %}{{ 'stepup.error.page_not_found.title'|trans }}{% endblock %} + +{% block content %} +

{{ 'stepup.error.page_not_found.text'|trans }}

+ +
+ +

{{ 'stepup.error.support_page.text'|trans({'%support_url%': global_view_parameters.supportUrl })|raw }}

+ + {# For now the back button is not shown on the error page until a more intelligent solution is thought of #} + {% block back_button %}{% endblock %} + +{% endblock %} From b229083434520522e2ac27bed9f3c4bffea17587 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 12:53:50 +0100 Subject: [PATCH 086/202] Fix phpcbf --- src/Kernel.php | 2 -- .../RaBundle/Controller/ExceptionController.php | 2 +- .../RaBundle/Controller/LocaleController.php | 5 ++--- .../RaBundle/Controller/ProfileController.php | 4 +--- .../RaBundle/Controller/RaLocationController.php | 6 ++---- .../RaBundle/Controller/RaManagementController.php | 4 +--- .../StepupRa/RaBundle/Controller/RaaController.php | 3 +-- .../Controller/RecoveryTokenController.php | 4 ++-- .../RaBundle/Controller/SecondFactorController.php | 12 +++++------- .../RaBundle/Controller/SecurityController.php | 3 +-- .../RaBundle/Controller/Vetting/GssfController.php | 8 ++++---- .../Controller/Vetting/SecondFactorController.php | 3 +-- .../RaBundle/Controller/Vetting/SmsController.php | 3 +++ .../Controller/Vetting/YubikeyController.php | 2 +- .../RaBundle/Controller/VettingController.php | 4 +++- .../Controller/VettingTypeHintController.php | 4 ++-- .../Exception/InvalidArgumentException.php | 11 ++++++++--- .../Form/Type/StartVettingProcedureType.php | 7 ++++++- .../Handler/LogoutSuccessHandler.php | 3 +-- .../RaBundle/Security/Factory/SamlFactory.php | 14 +++++++++----- .../StepupRa/RaBundle/Service/CommandService.php | 3 ++- .../StepupRa/RaBundle/Service/IdentityService.php | 5 ++--- .../StepupRa/RaBundle/Service/RaListingService.php | 3 +-- .../StepupRa/RaBundle/Service/VettingService.php | 2 +- .../YubikeySecondFactor/VerificationResult.php | 2 +- .../Twig/Extensions/Extension/SecondFactorType.php | 3 +-- src/Surfnet/StepupRa/RaBundle/VettingProcedure.php | 14 ++++++++++---- .../SurfnetStepupRaSamlStepupProviderExtension.php | 6 ++++-- .../SamlStepupProviderBundle/Provider/Metadata.php | 6 ++++-- 29 files changed, 80 insertions(+), 68 deletions(-) diff --git a/src/Kernel.php b/src/Kernel.php index 0b1a3b57..cefb541d 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -44,6 +44,4 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); } - - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php index c14b6519..5228af96 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php @@ -92,7 +92,7 @@ public function __invoke(Request $request, Throwable $exception): Response 'user_agent' => $userAgent, 'ip_address' => $ipAddress, ] + $this->getPageTitleAndDescription($exception), - $response + $response, ); } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index ccdfc3dc..3b2ef2e9 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -37,15 +37,14 @@ public function __construct( private readonly LoggerInterface $logger, private readonly UserProviderInterface $identityService, private readonly TranslatorInterface $translator, - ) - { + ) { } #[Route( path: '/switch-locale', name: 'ra_switch_locale', requirements: ['return-url' => '.+'], - methods: ['POST'] + methods: ['POST'], )] public function switchLocale(Request $request): RedirectResponse { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php index 57486a8f..6475f71a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -29,8 +29,7 @@ final class ProfileController extends AbstractController public function __construct( private readonly ProfileService $profileService, private readonly LoggerInterface $logger, - ) - { + ) { } #[Route( @@ -47,5 +46,4 @@ public function profile(): Response return $this->render('profile/profile.html.twig', ['profile' => $profile]); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php index fde9ea6d..b98bfc7c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -52,8 +52,7 @@ public function __construct( private readonly ProfileService $profileService, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator, - ) - { + ) { } #[Route('/locations', name: 'ra_locations_manage', methods: ['GET', 'POST'])] @@ -160,7 +159,7 @@ public function create(Request $request): Response #[Route( path: '/locations/{locationId}/change', name: 'ra_locations_change', - methods: ['GET', 'POST'] + methods: ['GET', 'POST'], )] public function change(Request $request): Response { @@ -247,5 +246,4 @@ private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 5f1291ac..62f8535d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -56,8 +56,7 @@ public function __construct( private readonly PaginatorInterface $paginator, private readonly TranslatorInterface $translator, private readonly RaService $raService, - ) - { + ) { } #[Route( @@ -338,5 +337,4 @@ private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php index 280b19ba..8e27b673 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -38,8 +38,7 @@ public function __construct( private readonly ProfileService $profileService, private readonly InstitutionListingService $institutionListingService, private readonly LoggerInterface $logger, - ) - { + ) { } #[Route( diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php index 5c1a3313..c9350225 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -46,7 +46,7 @@ public function __construct( #[Route( path: '/recovery-tokens', name: 'ra_recovery_tokens_search', - methods: ['GET', 'POST'] + methods: ['GET', 'POST'], )] public function search(Request $request): Response { @@ -105,7 +105,7 @@ public function search(Request $request): Response #[Route( path: '/recovery-tokens/revoke', name: 'ra_recovery_tokens_revoke', - methods: ['POST'] + methods: ['POST'], )] public function revoke(Request $request): RedirectResponse { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php index 4bb47a32..c17afb09 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -51,14 +51,13 @@ public function __construct( private readonly UserProviderInterface $identityService, private readonly AuditLogService $auditLogService, private readonly TranslatorInterface $translator, - ) - { + ) { } #[Route( path: '/second-factors', name: 'ra_second_factors_search', - methods: ['GET', 'POST'] + methods: ['GET', 'POST'], )] public function search(Request $request): Response { @@ -132,7 +131,7 @@ public function export(SearchRaSecondFactorsCommand $command): Response #[Route( path: '/second-factors/revoke', name: 'ra_second_factors_revoke', - methods: ['POST'] + methods: ['POST'], )] public function revoke(Request $request): RedirectResponse { @@ -169,12 +168,12 @@ public function revoke(Request $request): RedirectResponse #[Route( path: '/second-factors/{identityId}/auditlog', name: 'ra_second_factors_auditlog', - methods: ['GET'] + methods: ['GET'], )] #[Route( path: '/recovery-tokens/{identityId}/auditlog', name: 'ra_recovery_tokens_auditlog', - methods: ['GET'] + methods: ['GET'], )] public function auditLog(Request $request): Response { @@ -228,5 +227,4 @@ private function getCurrentUser(): Identity { return $this->container->get('security.token_storage')->getToken()->getUser(); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php index 5680c444..ad608585 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php @@ -28,8 +28,7 @@ class SecurityController extends AbstractController { public function __construct( private readonly SessionStorage $sessionStorage, - ) - { + ) { } #[Route( diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index 97013994..7b0693be 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -64,7 +64,7 @@ public function __construct( #[Route( path: '/vetting-procedure/{procedureId}/gssf/{provider}/initiate-verification', name: 'ra_vetting_gssf_initiate', - methods: ['GET'] + methods: ['GET'], )] public function initiate(string $procedureId, string $provider): Response { @@ -86,7 +86,7 @@ public function initiate(string $procedureId, string $provider): Response #[Route( path: '/vetting-procedure/{procedureId}/gssf/{provider}/authenticate', name: 'ra_vetting_gssf_authenticate', - methods: ['POST'] + methods: ['POST'], )] public function authenticate(string $procedureId, string $provider): Response { @@ -132,7 +132,7 @@ public function authenticate(string $procedureId, string $provider): Response #[Route( path: '/vetting-procedure/gssf/{provider}/verify', name: 'ra_vetting_gssf_verify', - methods: ['POST'] + methods: ['POST'], )] public function verify(Request $httpRequest, string $provider): Response { @@ -208,7 +208,7 @@ public function verify(Request $httpRequest, string $provider): Response #[Route( path: '/vetting-procedure/gssf/{provider}/metadata', name: 'ra_vetting_gssf_metadata', - methods: ['GET'] + methods: ['GET'], )] public function metadata(string $provider): XMLResponse { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php index fc43978e..a9c2e767 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php @@ -25,8 +25,7 @@ abstract class SecondFactorController extends AbstractController { public function __construct( private readonly LoggerInterface $logger, - ) - { + ) { } protected function assertSecondFactorEnabled(string $type): void diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 46bf7071..5bf7dbeb 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -34,6 +34,9 @@ use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class SmsController extends SecondFactorController { public function __construct( diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 40a74917..2a23a7cd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -43,7 +43,7 @@ public function __construct( #[Route( path: '/vetting-procedure/{procedureId}/verify-yubikey', name: 'ra_vetting_yubikey_verify', - methods: ['GET', 'POST'] + methods: ['GET', 'POST'], )] public function verify(Request $request, string $procedureId): Response { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 27061c9d..a1a7f925 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -39,6 +39,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; +use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\VerifiedSecondFactor; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -58,6 +59,7 @@ public function __construct( /** * @SuppressWarnings(PHPMD.CyclomaticComplexity) https://www.pivotaltracker.com/story/show/135045063 * @SuppressWarnings(PHPMD.NPathComplexity) https://www.pivotaltracker.com/story/show/135045063 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) https://www.pivotaltracker.com/story/show/135045063 */ #[Route( path: '/', @@ -84,7 +86,7 @@ public function startProcedure(Request $request): Response $secondFactor = $this->secondFactorService ->findVerifiedSecondFactorByRegistrationCode($command->registrationCode, $identity->id); - if (!$secondFactor instanceof \Surfnet\StepupMiddlewareClientBundle\Identity\Dto\VerifiedSecondFactor) { + if (!$secondFactor instanceof VerifiedSecondFactor) { $this->addFlash('error', 'ra.form.start_vetting_procedure.unknown_registration_code'); $this->logger->notice('Cannot start new vetting procedure, no second factor found'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php index 488617e2..888e83e0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -44,7 +44,7 @@ public function __construct( /** * @var string[] */ - private readonly array $locales = [], + private readonly array $locales = [], ) { } @@ -54,7 +54,7 @@ public function __construct( #[Route( path: '/vetting-type-hint', name: 'vetting_type_hint', - methods: ['GET', 'POST'] + methods: ['GET', 'POST'], )] public function vettingTypeHint(Request $request): Response { diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php index b18184c5..4c666a13 100644 --- a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php @@ -18,10 +18,15 @@ namespace Surfnet\StepupRa\RaBundle\Exception; -class InvalidArgumentException extends \InvalidArgumentException +use \InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidArgumentException extends BaseInvalidArgumentException { - public static function invalidType(string $expected, string $parameterName, mixed $parameter): InvalidArgumentException - { + public static function invalidType( + string $expected, + string $parameterName, + mixed $parameter, + ): InvalidArgumentException { $message = sprintf( 'Invalid argument type: "%s" expected, "%s" given for "%s"', $expected, diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php index 872d93ca..9f50dc7a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php @@ -33,7 +33,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->add('registrationCode', TextType::class, [ 'label' => /** @Ignore */ false, 'required' => true, - 'attr' => ['autofocus' => true, 'autocomplete' => 'off', 'placeholder' => 'ra.form.start_vetting_procedure.enter_activation_code_here', 'class' => 'fa-search'] + 'attr' => [ + 'autofocus' => true, + 'autocomplete' => 'off', + 'placeholder' => 'ra.form.start_vetting_procedure.enter_activation_code_here', + 'class' => 'fa-search', + ] ]); $builder->add('search', SubmitType::class, [ 'label' => 'ra.form.start_vetting_procedure.search', diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php index a5e4d15c..993b8caf 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php @@ -31,8 +31,7 @@ public function __construct( private TokenStorageInterface $tokenStorage, private array $logoutRedirectUrl, - ) - { + ) { } public function onLogoutSuccess(Request $request): RedirectResponse diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php index a145e86d..3f11bb88 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php @@ -32,19 +32,19 @@ public function create(ContainerBuilder $container, string $id, $config, $userPr $providerId = 'security.authentication.provider.saml.' . $id; $container->setDefinition( $providerId, - new ChildDefinition('self_service.security.authentication.provider.saml') + new ChildDefinition('self_service.security.authentication.provider.saml'), ); $listenerId = 'security.authentication.listener.saml.' . $id; $container->setDefinition( $listenerId, - new ChildDefinition('self_service.security.authentication.listener') + new ChildDefinition('self_service.security.authentication.listener'), ); $cookieHandlerId = 'security.logout.handler.cookie_clearing.' . $id; $cookieHandler = $container->setDefinition( $cookieHandlerId, - new ChildDefinition('security.logout.handler.cookie_clearing') + new ChildDefinition('security.logout.handler.cookie_clearing'), ); $cookieHandler->addArgument([]); @@ -65,8 +65,12 @@ public function getPriority(): int return -10; } - public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string|array - { + public function createAuthenticator( + ContainerBuilder $container, + string $firewallName, + array $config, + string $userProviderId, + ): string|array { return $config; } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php index a3b6387e..579f2b9c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php @@ -23,6 +23,7 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupMiddlewareClientBundle\Service\CommandService as MiddlewareCommandService; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Surfnet\StepupMiddlewareClient\Service\ExecutionResult; final readonly class CommandService { @@ -32,7 +33,7 @@ public function __construct( ) { } - public function execute(Command $command): \Surfnet\StepupMiddlewareClient\Service\ExecutionResult + public function execute(Command $command): ExecutionResult { /** @var Identity $identity */ $identity = $this->tokenStorage->getToken()->getUser(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index a4cee1a4..4d646c9a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -46,9 +46,9 @@ public function __construct( * * If needed, the username is the UUID of the identity so it can be fetched rather easy */ - public function loadUserByIdentifier($username): never + public function loadUserByIdentifier(string $identifier): never { - throw new RuntimeException(sprintf('Cannot Load User By Username "%s"', $username)); + throw new RuntimeException(sprintf('Cannot Load User By Username "%s"', $identifier)); } /** @@ -144,5 +144,4 @@ public function switchLocale(SwitchLocaleCommand $command): bool return $result->isSuccessful(); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php index c2a14f21..4a853c82 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php @@ -28,8 +28,7 @@ { public function __construct( private ApiRaListingService $apiRaListingService, - ) - { + ) { } /** diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index eddebbc9..a9fad2e5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -338,6 +338,6 @@ private function getProcedure(string $procedureId): ?VettingProcedure public function hasProcedure(string $procedureId): bool { - return $this->vettingProcedureRepository->retrieve($procedureId) instanceof \Surfnet\StepupRa\RaBundle\VettingProcedure; + return $this->vettingProcedureRepository->retrieve($procedureId) instanceof VettingProcedure; } } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php index 315c2b0f..bcebd43f 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php @@ -55,7 +55,7 @@ public function __construct($result, private readonly ?YubikeyPublicId $publicId public function didPublicIdMatch(): bool { - return $this->result === self::RESULT_PUBLIC_ID_MATCHED && $this->publicId instanceof \Surfnet\StepupBundle\Value\YubikeyPublicId; + return $this->result === self::RESULT_PUBLIC_ID_MATCHED && $this->publicId instanceof YubikeyPublicId; } public function wasOtpInvalid(): bool diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php index 353def6f..e55447cb 100644 --- a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php @@ -26,8 +26,7 @@ final class SecondFactorType extends AbstractExtension { public function __construct( private readonly SecondFactorTypeTranslationService $translator, - ) - { + ) { } public function getName(): string diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php index d938e2da..370a3289 100644 --- a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php +++ b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php @@ -24,6 +24,9 @@ use Surfnet\StepupRa\RaBundle\Exception\DomainException; use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; +/** + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ class VettingProcedure { private string $id; @@ -116,12 +119,15 @@ public function verifyIdentity(string $documentNumber, bool $identityVerified): private function isReadyForIdentityVerification(): bool { - return $this->isPossessionProvenOrCanItBeSkipped() && ($this->registrationCode !== null && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')); + return $this->isPossessionProvenOrCanItBeSkipped() && !empty($this->registrationCode); } private function isPossessionProvenOrCanItBeSkipped(): bool { - return ($this->inputSecondFactorIdentifier === $this->secondFactor->secondFactorIdentifier || $this->skipProvePossession); + return ( + $this->inputSecondFactorIdentifier === $this->secondFactor->secondFactorIdentifier + || $this->skipProvePossession + ); } /** @@ -141,8 +147,8 @@ public function vet(): void private function isReadyForVetting(): bool { return $this->isPossessionProvenOrCanItBeSkipped() - && ($this->registrationCode !== null && ($this->registrationCode !== null && $this->registrationCode !== '' && $this->registrationCode !== '0')) - && ($this->documentNumber !== null && ($this->documentNumber !== null && $this->documentNumber !== '' && $this->documentNumber !== '0')) + && !empty($this->registrationCode) + && !empty($this->documentNumber) && $this->identityVerified === true; } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index 7965f79f..9c385ada 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -36,6 +36,9 @@ use Surfnet\SamlBundle\Metadata\MetadataConfiguration; use Surfnet\SamlBundle\Metadata\MetadataFactory; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class SurfnetStepupRaSamlStepupProviderExtension extends Extension { @@ -120,8 +123,7 @@ private function createHostedDefinitions( array $configuration, array $routes, ContainerBuilder $container, - ): void - { + ): void { $hostedDefinition = $this->buildHostedEntityDefinition($provider, $configuration, $routes); $container->setDefinition('gssp.provider.' . $provider . '.hosted_entities', $hostedDefinition); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php index 6322d1e4..1c08629d 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php @@ -22,6 +22,8 @@ use LogicException; use Surfnet\SamlBundle\Signing\Signable; use Stringable; +use DOMElement; +use DOMNode; class Metadata implements Signable, Stringable { @@ -50,7 +52,7 @@ class Metadata implements Signable, Stringable */ public $document; - public function getRootDomElement(): ?\DOMElement + public function getRootDomElement(): ?DOMElement { if (!$this->document) { throw new LogicException('Cannot get the rootElement of Metadata before the document has been generated'); @@ -59,7 +61,7 @@ public function getRootDomElement(): ?\DOMElement return $this->document->documentElement; } - public function getAppendBeforeNode(): ?\DOMNode + public function getAppendBeforeNode(): ?DOMNode { if (!$this->document) { throw new LogicException( From 7da5796b5ff6d264275818a6ab5974506ddcf58d Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 14:10:11 +0100 Subject: [PATCH 087/202] Fix tests and config --- config/packages/security.yaml | 6 ++--- .../Authentication/Token/SamlToken.php | 22 +++++++------------ .../Authentication/Token/SamlTokenTest.php | 4 ++-- .../Tests/Security/Session/FakeSession.php | 8 +++---- .../Provider/ViewConfig.php | 4 +--- .../Tests/Provider/ViewConfigTest.php | 6 ++--- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 9ba1229a..7a44daf6 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -8,8 +8,8 @@ security: pattern: ^/(_(profiler|wdt)|css|images|js)/|^/_trans(/|$) security: false - default: - pattern: ^/authentication/(metadata|session-expired)$ + login_firewall: + pattern: ^/saml/metadata monitor: pattern: ^/(info|health)$ @@ -31,5 +31,5 @@ security: ROLE_RA: ROLE_USER access_control: - - { path: ^/authentication, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/saml, roles: PUBLIC_ACCESS, requires_channel: https } - { path: ^/, roles: ROLE_RA, requires_channel: https } diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php index 0cb7bcd1..6c878d64 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php @@ -31,7 +31,6 @@ public function __construct( array $roles = [], ) { parent::__construct($roles); - $this->setAuthenticated(count($roles)); } /** @@ -47,22 +46,17 @@ public function getLoa(): Loa return $this->loa; } - public function serialize(): array|string + public function __serialize(): array { - return serialize( - [ - parent::serialize(), - $this->loa, - ], - ); + return [ + 'parent_data' => parent::__serialize(), + 'loa' => $this->loa, + ]; } - public function unserialize($serialized): void + public function __unserialize(array $data): void { - [$parent, $this->loa, ] = unserialize( - $serialized, - ); - - parent::unserialize($parent); + parent::__unserialize($data['parent_data']); + $this->loa = $data['loa']; } } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php index 93e97b0e..fbc24c72 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php @@ -42,10 +42,10 @@ public function saml_token_is_correctly_serialized_and_unserialized() ['ROLE_RAA'], ); - $serialized = $samlToken->serialize(); + $serialized = $samlToken->__serialize(); $deserialized = new SamlToken(new Loa(Loa::LOA_2, 'http://some.url.tld/authentication/loa2')); - $deserialized->unserialize($serialized); + $deserialized->__unserialize($serialized); $this->assertEquals($samlToken, $deserialized); } diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php index cd2d7feb..cdb470c6 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php @@ -105,7 +105,7 @@ public function has($name): bool return array_key_exists($name, $this->sessionContent); } - public function get($name, $default = null) + public function get($name, $default = null): mixed { return $this->has($name) ? $this->sessionContent[$name] : $default; } @@ -125,7 +125,7 @@ public function replace(array $attributes): void $this->sessionContent = $attributes; } - public function remove($name) + public function remove($name): mixed { $return = null; if ($this->has($name)) { @@ -152,7 +152,7 @@ public function registerBag(SessionBagInterface $bag): void $this->bags[$bag->getName()] = $bag; } - public function getBag($name) + public function getBag($name): SessionBagInterface { if (array_key_exists($name, $this->bags)) { return $this->bags[$name]; @@ -161,7 +161,7 @@ public function getBag($name) return null; } - public function getMetadataBag() + public function getMetadataBag(): MetadataBag { if (isset($this->bags['_sf_meta'])) { return $this->bags['_sf_meta']; diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index 588c7063..a7c023fa 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -70,9 +70,7 @@ public function getPageTitle(): string private function getTranslation(array $translations): mixed { $currentLocale = $this->requestStack->getCurrentRequest()->getLocale(); - if (is_null($currentLocale)) { - throw new LogicException('The current language is not set'); - } + if (isset($translations[$currentLocale])) { return $translations[$currentLocale]; } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php index 3a3d1b94..6d0b4bf7 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php @@ -58,10 +58,10 @@ public function view_config_translates_correctly() */ public function translation_fails_when_no_current_language_set() { - $this->expectExceptionMessage("The current language is not set"); + $this->expectExceptionMessage("The requested translation is not available in this language"); $this->expectException(LogicException::class); - $viewConfig = $this->buildViewConfig(null); + $viewConfig = $this->buildViewConfig(''); $viewConfig->getExplanation(); } @@ -78,7 +78,7 @@ public function view_config_cannot_serve_french_translations() $viewConfig->getGssfIdMismatch(); } - private function buildViewConfig(?string $locale = ''): ViewConfig + private function buildViewConfig(string $locale = ''): ViewConfig { $request = m::mock(RequestStack::class); $request->shouldReceive('getCurrentRequest->getLocale')->andReturn($locale)->byDefault(); From ef2f692356cf41a43c9d2a68e1cf4bc85b8ee6fa Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 16:30:57 +0100 Subject: [PATCH 088/202] Fix tests and config --- composer.json | 2 + composer.lock | 78 +++++++++++++- config/packages/framework.yaml | 8 +- config/packages/security.yaml | 5 +- config/routes/dev/jms_translation.yaml | 8 +- .../Command/AccreditCandidateCommand.php | 8 +- ...egistrationAuthorityInformationCommand.php | 8 +- .../Command/ChangeRaLocationCommand.php | 54 +++------- .../Command/CreateRaLocationCommand.php | 12 +-- .../Command/ExportRaSecondFactorsCommand.php | 19 +--- .../Command/SearchRaCandidatesCommand.php | 19 +--- .../Command/SearchRaListingCommand.php | 17 ++- .../Command/SearchRaLocationsCommand.php | 13 +-- .../Command/SearchRaSecondFactorsCommand.php | 23 ++-- .../Command/SearchRecoveryTokensCommand.php | 19 +--- .../Command/StartVettingProcedureCommand.php | 4 +- .../Command/VerifyIdentityCommand.php | 14 +-- .../Command/VerifyYubikeyOtpCommand.php | 4 +- .../Command/VerifyYubikeyPublicIdCommand.php | 4 +- .../RaBundle/Controller/SamlController.php | 8 +- .../ProcessSamlAuthenticationHandler.php | 100 ------------------ .../Authentication/Provider/SamlProvider.php | 34 +++--- templates/form/fields.html.twig | 12 +-- 23 files changed, 187 insertions(+), 286 deletions(-) delete mode 100644 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ProcessSamlAuthenticationHandler.php diff --git a/composer.json b/composer.json index 2128bb8a..e4ca11a0 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "php": "^8.2", "ext-dom": "*", "ext-openssl": "*", + "doctrine/annotations": "^2.0", "fortawesome/font-awesome": "~4.2.0", "guzzlehttp/guzzle": "^7", "incenteev/composer-parameter-handler": "~2.0", @@ -29,6 +30,7 @@ "symfony/expression-language": "^6.0", "symfony/flex": "^v2.4.3", "symfony/form": "^6.0", + "symfony/framework-bundle": "6.4.*", "symfony/http-foundation": "^6.0", "symfony/monolog-bundle": "^3.5", "symfony/security-bundle": "^6.0", diff --git a/composer.lock b/composer.lock index e6a9ceca..3802efd9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "071df17d9fdb094937404f3cfc5d55f1", + "content-hash": "334c89209483af18881cb5dc547cdc8c", "packages": [ { "name": "beberlei/assert", @@ -196,6 +196,82 @@ ], "time": "2023-12-18T12:05:55+00:00" }, + { + "name": "doctrine/annotations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^2 || ^3", + "ext-tokenizer": "*", + "php": "^7.2 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^2.0", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^5.4 || ^6", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/2.0.1" + }, + "time": "2023-02-02T22:02:53+00:00" + }, { "name": "doctrine/cache", "version": "2.2.0", diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index a1b946b2..430fabdf 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -3,16 +3,22 @@ framework: translator: { fallback: "%default_locale%" } secret: "%secret%" form: ~ + handle_all_throwables: true + annotations: + enabled: false csrf_protection: ~ - validation: { enable_annotations: true } + validation: { enable_attributes: true } default_locale: "%default_locale%" trusted_hosts: ~ session: # handler_id set to null will use default session handler from php.ini handler_id: ~ name: sess_ra + cookie_samesite: lax cookie_httponly: true cookie_secure: true fragments: false http_method_override: true error_controller: Surfnet\StepupRa\RaBundle\Controller\ExceptionController + php_errors: + log: true diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 7a44daf6..a0a18b15 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,7 +1,7 @@ security: providers: - middleware: - id: ra.service.identity + saml-provider: + id: Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider firewalls: dev: @@ -32,4 +32,5 @@ security: access_control: - { path: ^/saml, roles: PUBLIC_ACCESS, requires_channel: https } + - { path: ^/authentication, roles: PUBLIC_ACCESS, requires_channel: https } - { path: ^/, roles: ROLE_RA, requires_channel: https } diff --git a/config/routes/dev/jms_translation.yaml b/config/routes/dev/jms_translation.yaml index f16557c1..70cf7207 100644 --- a/config/routes/dev/jms_translation.yaml +++ b/config/routes/dev/jms_translation.yaml @@ -1,4 +1,4 @@ -JMSTranslationBundle_ui: - resource: "@JMSTranslationBundle/Controller/" - type: annotation - prefix: /_trans +#JMSTranslationBundle_ui: +# resource: "@JMSTranslationBundle/Controller/" +# type: attribute +# prefix: /_trans diff --git a/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php index 2d390ad9..3f183c46 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php @@ -27,14 +27,10 @@ class AccreditCandidateCommand public string $institution; - /** - * @Assert\NotBlank(message="ra.accredit_candidate.location.may_not_be_blank") - */ + #[Assert\NotBlank(message: 'ra.accredit_candidate.location.may_not_be_blank')] public string $location; - /** - * @Assert\NotBlank(message="ra.accredit_candidate.contact_information.may_not_be_blank") - */ + #[Assert\NotBlank(message: 'ra.accredit_candidate.contact_information.may_not_be_blank')] public string $contactInformation; public RoleAtInstitution $roleAtInstitution; diff --git a/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php index 24ce7b85..92726bd8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php @@ -24,14 +24,10 @@ class AmendRegistrationAuthorityInformationCommand { public string $identityId; - /** - * @Assert\NotBlank(message="ra.amend_ra_information.location") - */ + #[Assert\NotBlank(message: 'ra.amend_ra_information.location')] public string $location; - /** - * @Assert\NotBlank(message="ra.amend_ra_information.contact_information") - */ + #[Assert\NotBlank(message: 'ra.amend_ra_information.contact_information')] public string $contactInformation; public string $institution; diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php index a38a5b3f..54d31c7c 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php @@ -1,5 +1,7 @@ tokenStorage->getToken() === null - && $this->samlInteractionProvider->isSamlAuthenticationInitiated() - ) { - $expectedInResponseTo = $this->authenticationStateHandler->getRequestId(); - $logger = $this->authenticationLogger->forAuthentication($expectedInResponseTo); - - $logger->notice('No authenticated user and AuthnRequest pending, attempting to process SamlResponse'); - - $assertion = $this->samlInteractionProvider->processSamlResponse($event->getRequest()); - - if (!InResponseTo::assertEquals($assertion, $expectedInResponseTo)) { - $logger->error('Unknown or unexpected InResponseTo in SAMLResponse'); - - throw new AuthenticationException('Unknown or unexpected InResponseTo in SAMLResponse'); - } - - $logger->notice('Successfully processed SAMLResponse, attempting to authenticate'); - - $loa = $this->loaResolutionService->getLoa($assertion->getAuthnContextClassRef()); - - $token = new SamlToken($loa); - $token->assertion = $assertion; - - $authToken = $this->authenticationManager->authenticate($token); - - $this->authenticatedSession->logAuthenticationMoment(); - $this->tokenStorage->setToken($authToken); - - // migrate the session to prevent session hijacking - $this->authenticatedSession->migrate(); - - $event->setResponse(new RedirectResponse($this->authenticatedSession->getCurrentRequestUri())); - - $logger->notice('Authentication succeeded, redirecting to original location'); - - return; - } - - $this->nextHandler?->process($event); - } - - public function setNext(AuthenticationHandler $handler): void - { - $this->nextHandler = $handler; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index 048b6708..fd750408 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -18,18 +18,20 @@ namespace Surfnet\StepupRa\RaBundle\Security\Authentication\Provider; +use BadMethodCallException; use Psr\Log\LoggerInterface; use SAML2\Assertion; use Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary; use Surfnet\SamlBundle\SAML2\Response\AssertionAdapter; use Surfnet\SamlBundle\Security\Authentication\Provider\SamlProviderInterface; +use Surfnet\StepupBundle\Service\LoaResolutionService; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Exception\MissingRequiredAttributeException; use Surfnet\StepupRa\RaBundle\Exception\UserNotRaException; +use Surfnet\StepupRa\RaBundle\Security\AuthenticatedIdentity; use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; -use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\User\UserInterface; @@ -46,6 +48,7 @@ public function __construct( private readonly ProfileService $profileService, private readonly AttributeDictionary $attributeDictionary, private readonly LoggerInterface $logger, + private readonly LoaResolutionService $loaResolutionService, ) { } @@ -53,9 +56,9 @@ public function __construct( * @SuppressWarnings(PHPMD.NPathComplexity) - The authorization tests cause the complexity to raise, could and * @SuppressWarnings(PHPMD.CyclomaticComplexity) might be changed by introducing additional utility classes. */ - public function authenticate(TokenInterface $token): TokenInterface + public function getUser(Assertion $assertion): UserInterface { - $translatedAssertion = $this->attributeDictionary->translate($token->assertion); + $translatedAssertion = $this->attributeDictionary->translate($assertion); $nameId = $translatedAssertion->getNameID(); $institution = $this->getSingleStringValue('schacHomeOrganization', $translatedAssertion); @@ -93,11 +96,12 @@ public function authenticate(TokenInterface $token): TokenInterface } } - // set the token - $authenticatedToken = new SamlToken($token->getLoa(), $roles); - $authenticatedToken->setUser($identity); + $authenticatedIdentity = new AuthenticatedIdentity($identity); + $loa = $this->loaResolutionService->getLoa($assertion->getAuthnContextClassRef()); + $authenticatedToken = new SamlToken($loa, $roles); + $authenticatedToken->setUser($authenticatedIdentity); - return $authenticatedToken; + return $authenticatedIdentity; } private function getSingleStringValue($attribute, AssertionAdapter $translatedAssertion): string @@ -146,26 +150,22 @@ public function supports(TokenInterface $token): bool public function getNameId(Assertion $assertion): string { - // TODO: Implement getNameId() method. - } - - public function getUser(Assertion $assertion): UserInterface - { - // TODO: Implement getUser() method. + return $this->attributeDictionary->translate($assertion)->getNameID(); } - public function refreshUser(UserInterface $user) + public function refreshUser(UserInterface $user): UserInterface { // TODO: Implement refreshUser() method. + return $user; } - public function supportsClass(string $class) + public function supportsClass(string $class): bool { - // TODO: Implement supportsClass() method. + return $class === AuthenticatedIdentity::class; } public function loadUserByIdentifier(string $identifier): UserInterface { - // TODO: Implement loadUserByIdentifier() method. + throw new BadMethodCallException('Use `getUser` to load a user by username'); } } diff --git a/templates/form/fields.html.twig b/templates/form/fields.html.twig index fec7da93..6d018b78 100644 --- a/templates/form/fields.html.twig +++ b/templates/form/fields.html.twig @@ -7,7 +7,7 @@ {%- endblock form_group_class %} {% block anchor_widget %} - {% spaceless %} + {% apply spaceless %} {% if label is empty %} {% set label = name|humanize %} {% endif %} @@ -16,11 +16,11 @@ {% endif %} {{ label|trans({}, translation_domain) }} - {% endspaceless %} + {% endapply %} {% endblock anchor_widget %} {% block anchor_row %} - {% spaceless %} + {% apply spaceless %} {% if button_offset is defined and button_offset is not empty %} {% set attr = attr|merge({'for': id, 'class': button_offset }) %}
@@ -33,7 +33,7 @@ {{ form_widget(form) }}
{% endif %} - {% endspaceless %} + {% endapply %} {% endblock anchor_row %} {% block ra_role_at_institution_widget %} @@ -56,12 +56,12 @@ {% endblock button_group_row %} {%- block otp_widget -%} - {% spaceless %} + {% apply spaceless %}
- {% endspaceless %} + {% endapply %} {%- endblock otp_widget -%} From 6756582fad127b2c0a833fb2fc6f1a6a9851171d Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 16:31:12 +0100 Subject: [PATCH 089/202] Fix tests and config --- .../Security/AuthenticatedIdentity.php | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php diff --git a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php new file mode 100644 index 00000000..d02adde6 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php @@ -0,0 +1,90 @@ +originalIdentity; + } + + public function getUsername(): string + { + return $this->originalIdentity->id ?: ''; + } + + /** + * @inheritDoc + */ + public function getRoles(): array + { + // You can customize this method based on your application's logic. + return ['ROLE_USER']; + } + + /** + * @inheritDoc + */ + public function getPassword(): ?string + { + // You may not store the password in this DTO, return null. + return null; + } + + /** + * @inheritDoc + */ + public function getSalt(): ?string + { + // You may not store a salt in this DTO, return null. + return null; + } + + /** + * @inheritDoc + */ + public function eraseCredentials(): array + { + return []; + } + + /** + * Allow access to the original Identity instance if needed. + */ + public function getOriginalIdentity(): Identity + { + return $this->originalIdentity; + } + + public function getUserIdentifier(): string + { + $parts = explode(':', $this->originalIdentity->nameId); + return end($parts); + } +} From e1c8aafe0101129c6cc9f49d504ea83f98762958 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 17:02:08 +0100 Subject: [PATCH 090/202] Avoid null return --- .../Tests/Security/Session/FakeSession.php | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php index cdb470c6..c69d0362 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php @@ -18,31 +18,20 @@ namespace Surfnet\StepupRa\RaBundle\Tests\Security\Session; +use RuntimeException; use Symfony\Component\HttpFoundation\Session\SessionBagInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; class FakeSession implements SessionInterface { - /** - * @var array - */ - private $sessionContent = []; - - /** - * @var string - */ - private $sessionId = 'fake_session'; - - /** - * @var string - */ - private $sessionName = 'fake_session'; - - /** - * @var array - */ - private $bags = []; + private array $sessionContent = []; + + private string $sessionId = 'fake_session'; + + private string $sessionName = 'fake_session'; + + private array $bags = []; public function __construct() { @@ -158,15 +147,11 @@ public function getBag($name): SessionBagInterface return $this->bags[$name]; } - return null; + throw new RuntimeException("Session parameter {name} not found"); } public function getMetadataBag(): MetadataBag { - if (isset($this->bags['_sf_meta'])) { - return $this->bags['_sf_meta']; - } - - return $this->bags['_sf_meta'] = new MetadataBag(); + return $this->bags['_sf_meta'] ?? ($this->bags['_sf_meta'] = new MetadataBag()); } } From e27385d357b60d7bebf3e989fb1c77692dc6f632 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 17:02:44 +0100 Subject: [PATCH 091/202] Rename varname --- .../Security/Authentication/Provider/SamlProvider.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index fd750408..c94b20c4 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -104,15 +104,15 @@ public function getUser(Assertion $assertion): UserInterface return $authenticatedIdentity; } - private function getSingleStringValue($attribute, AssertionAdapter $translatedAssertion): string + private function getSingleStringValue(string $attributeName, AssertionAdapter $translatedAssertion): string { - $values = $translatedAssertion->getAttributeValue($attribute); + $values = $translatedAssertion->getAttributeValue($attributeName); if (empty($values)) { throw new MissingRequiredAttributeException( sprintf( 'Missing a required SAML attribute. This application requires the "%s" attribute to function.', - $attribute, + $attributeName, ), ); } @@ -122,7 +122,7 @@ private function getSingleStringValue($attribute, AssertionAdapter $translatedAs $this->logger->warning(sprintf( 'Found "%d" values for attribute "%s", using first value', count($values), - $attribute, + $attributeName, )); } @@ -131,7 +131,7 @@ private function getSingleStringValue($attribute, AssertionAdapter $translatedAs if (!is_string($value)) { $message = sprintf( 'First value of attribute "%s" must be a string, "%s" given', - $attribute, + $attributeName, get_debug_type($value), ); From 442b886861112bcd2accad6b74489cb23765846f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 17:35:07 +0100 Subject: [PATCH 092/202] Replace files according rules --- {public => assets}/fonts/FontAwesome.otf | Bin .../fonts/fontawesome-webfont.eot | Bin .../fonts/fontawesome-webfont.svg | 0 .../fonts/fontawesome-webfont.ttf | Bin .../fonts/fontawesome-webfont.woff | Bin {public => assets}/images/header-logo.png | Bin bin/console | 42 ++------ composer.json | 8 +- composer.lock | 93 ++++++++++++++++-- config/bootstrap.php | 34 +++++-- config/openconext/parameters.yaml.dist | 4 + package.json | 1 + public/index.php | 45 +++++---- src/Kernel.php | 54 ++++------ webpack.config.js | 6 ++ yarn.lock | 12 ++- 16 files changed, 188 insertions(+), 111 deletions(-) rename {public => assets}/fonts/FontAwesome.otf (100%) rename {public => assets}/fonts/fontawesome-webfont.eot (100%) rename {public => assets}/fonts/fontawesome-webfont.svg (100%) rename {public => assets}/fonts/fontawesome-webfont.ttf (100%) rename {public => assets}/fonts/fontawesome-webfont.woff (100%) rename {public => assets}/images/header-logo.png (100%) diff --git a/public/fonts/FontAwesome.otf b/assets/fonts/FontAwesome.otf similarity index 100% rename from public/fonts/FontAwesome.otf rename to assets/fonts/FontAwesome.otf diff --git a/public/fonts/fontawesome-webfont.eot b/assets/fonts/fontawesome-webfont.eot similarity index 100% rename from public/fonts/fontawesome-webfont.eot rename to assets/fonts/fontawesome-webfont.eot diff --git a/public/fonts/fontawesome-webfont.svg b/assets/fonts/fontawesome-webfont.svg similarity index 100% rename from public/fonts/fontawesome-webfont.svg rename to assets/fonts/fontawesome-webfont.svg diff --git a/public/fonts/fontawesome-webfont.ttf b/assets/fonts/fontawesome-webfont.ttf similarity index 100% rename from public/fonts/fontawesome-webfont.ttf rename to assets/fonts/fontawesome-webfont.ttf diff --git a/public/fonts/fontawesome-webfont.woff b/assets/fonts/fontawesome-webfont.woff similarity index 100% rename from public/fonts/fontawesome-webfont.woff rename to assets/fonts/fontawesome-webfont.woff diff --git a/public/images/header-logo.png b/assets/images/header-logo.png similarity index 100% rename from public/images/header-logo.png rename to assets/images/header-logo.png diff --git a/bin/console b/bin/console index 5de0e1c5..44e1fdbd 100755 --- a/bin/console +++ b/bin/console @@ -1,42 +1,18 @@ #!/usr/bin/env php getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -require dirname(__DIR__).'/config/bootstrap.php'; - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists(Debug::class)) { - Debug::enable(); - } -} - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$application = new Application($kernel); -$application->run($input); + return new Application($kernel); +}; diff --git a/composer.json b/composer.json index e4ca11a0..5a164f75 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "The SURFnet Step-up Registration Authority application allows Registration Authorities to vet identities by combining a real-world identity, federated identity and a token.", "autoload": { "psr-4": { - "Surfnet\\StepupRa\\": "src\\Surfnet\\StepupRa" + "Surfnet\\": "src\\Surfnet" }, "classmap": [ "src/Kernel.php" @@ -33,6 +33,7 @@ "symfony/framework-bundle": "6.4.*", "symfony/http-foundation": "^6.0", "symfony/monolog-bundle": "^3.5", + "symfony/runtime": "6.4.*", "symfony/security-bundle": "^6.0", "symfony/translation": "^6.0", "symfony/twig-bundle": "^6.0", @@ -50,7 +51,7 @@ "phpstan/extension-installer": "^1.3", "phpstan/phpstan-symfony": "^1.3", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.19.5", + "rector/rector": "^1.0", "slevomat/coding-standard": "^8.13", "squizlabs/php_codesniffer": "^3.4", "symfony/dotenv": "^5.1", @@ -116,7 +117,8 @@ "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "symfony/runtime": true }, "optimize-autoloader": true, "sort-packages": true, diff --git a/composer.lock b/composer.lock index 3802efd9..4c07092b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "334c89209483af18881cb5dc547cdc8c", + "content-hash": "8057d0f55e2a0dea356bebe5336b1e4e", "packages": [ { "name": "beberlei/assert", @@ -5866,6 +5866,85 @@ ], "time": "2024-01-30T13:55:02+00:00" }, + { + "name": "symfony/runtime", + "version": "v6.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/runtime.git", + "reference": "5682281d26366cd3bf0648cec69de0e62cca7fa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/runtime/zipball/5682281d26366cd3bf0648cec69de0e62cca7fa0", + "reference": "5682281d26366cd3bf0648cec69de0e62cca7fa0", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0|^2.0", + "php": ">=8.1" + }, + "conflict": { + "symfony/dotenv": "<5.4" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "symfony/console": "^5.4.9|^6.0.9|^7.0", + "symfony/dotenv": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Symfony\\Component\\Runtime\\Internal\\ComposerPlugin" + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Runtime\\": "", + "Symfony\\Runtime\\Symfony\\Component\\": "Internal/" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Enables decoupling PHP applications from global state", + "homepage": "https://symfony.com", + "keywords": [ + "runtime" + ], + "support": { + "source": "https://github.com/symfony/runtime/tree/v6.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-23T14:51:35+00:00" + }, { "name": "symfony/security-bundle", "version": "v6.4.3", @@ -9008,16 +9087,16 @@ }, { "name": "rector/rector", - "version": "0.19.8", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947" + "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/de3b3bb159abd704b144aa86fb244f7f1f4ac947", - "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/362258a1f6369fc88d02d469a5478d220f78b0e6", + "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6", "shasum": "" }, "require": { @@ -9052,7 +9131,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.8" + "source": "https://github.com/rectorphp/rector/tree/1.0.0" }, "funding": [ { @@ -9060,7 +9139,7 @@ "type": "github" } ], - "time": "2024-02-05T10:59:13+00:00" + "time": "2024-02-06T13:38:07+00:00" }, { "name": "sebastian/cli-parser", diff --git a/config/bootstrap.php b/config/bootstrap.php index 7c2cf308..ee3db896 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -1,16 +1,30 @@ handle($request); -$response->send(); -$kernel->terminate($request, $response); +return function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); +}; diff --git a/src/Kernel.php b/src/Kernel.php index cefb541d..ada59e0e 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -1,47 +1,35 @@ getProjectDir().'/config/bundles.php'; - foreach ($contents as $class => $envs) { - if ($envs[$this->environment] ?? $envs['all'] ?? false) { - yield new $class(); - } - } - } - + // see https://symfony.com/doc/current/reference/configuration/kernel.html#kernel-project-dir public function getProjectDir(): string { - return dirname(__DIR__); - } - - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void - { - $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); - $container->setParameter('container.dumper.inline_class_loader', PHP_VERSION_ID < 70400 || $this->debug); - $container->setParameter('container.dumper.inline_factories', true); - $confDir = $this->getProjectDir().'/config'; - - $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); + return dirname(__DIR__, 1); } } diff --git a/webpack.config.js b/webpack.config.js index f800a98a..177da831 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,6 +9,12 @@ if (!Encore.isRuntimeEnvironmentConfigured()) { Encore // directory where compiled assets will be stored .setOutputPath('public/build/') + .copyFiles([ + { + from: './assets/images', + to: './images/[path][name].[ext]', + } + ]) // public path used by the web server to access the output path .setPublicPath('/build') // only needed for CDN's or sub-directory deploy diff --git a/yarn.lock b/yarn.lock index 6eb05c9c..9b957c36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1094,7 +1094,7 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@symfony/webpack-encore@^4": +"@symfony/webpack-encore@^4.6.1": version "4.6.1" resolved "https://registry.yarnpkg.com/@symfony/webpack-encore/-/webpack-encore-4.6.1.tgz#a3ced0baf1b02feb6d1a564906aff0e479b07259" integrity sha512-JbOjy0P6P9pcbgVE3nceFnCCneRO+tbcLUkQh9rpPj/sHtFl12foSjHz6uY93ZGZGAvTyqEslie+4MlD/rUtnQ== @@ -2570,6 +2570,14 @@ faye-websocket@^0.11.3: dependencies: websocket-driver ">=0.5.1" +file-loader@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d" + integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw== + dependencies: + loader-utils "^2.0.0" + schema-utils "^3.0.0" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -4324,7 +4332,7 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -schema-utils@^3.1.1, schema-utils@^3.2.0: +schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== From fe56cc303821e818a1fd335ee7f7c3e529bc8b14 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 17:40:20 +0100 Subject: [PATCH 093/202] Correct copyright year --- .../StepupRa/RaBundle/Command/ChangeRaLocationCommand.php | 2 +- .../StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php | 2 +- .../StepupRa/RaBundle/Command/RevokeRecoveryTokenCommand.php | 2 +- .../StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php | 2 +- .../StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php | 2 +- src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php | 2 +- .../StepupRa/RaBundle/Controller/RaLocationController.php | 2 +- .../StepupRa/RaBundle/Controller/RaManagementController.php | 2 +- .../StepupRa/RaBundle/Controller/Vetting/GssfController.php | 2 +- src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php | 2 +- .../Form/Type/AmendRegistrationAuthorityInformationType.php | 2 +- .../StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php | 2 +- src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php | 2 +- .../StepupRa/RaBundle/Form/Type/CreateRaLocationType.php | 2 +- src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php | 2 +- .../StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php | 2 +- .../StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php | 2 +- src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php | 2 +- .../StepupRa/RaBundle/Security/AuthenticatedIdentity.php | 2 +- .../Security/Authentication/SamlAuthenticationStateHandler.php | 2 +- .../RaBundle/Security/Authentication/Session/SessionStorage.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/CommandService.php | 2 +- .../StepupRa/RaBundle/Service/Gssf/VerificationResult.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/GssfService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/RaService.php | 2 +- .../StepupRa/RaBundle/Service/YubikeyVerificationResult.php | 2 +- src/Surfnet/StepupRa/RaBundle/Tests/Value/DateTimeTest.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../SurfnetStepupRaSamlStepupProviderExtension.php | 2 +- .../StepupRa/SamlStepupProviderBundle/Provider/Metadata.php | 2 +- .../StepupRa/SamlStepupProviderBundle/Provider/Provider.php | 2 +- .../SamlStepupProviderBundle/Provider/ProviderRepository.php | 2 +- .../StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php index 54d31c7c..5bc7087b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php @@ -3,7 +3,7 @@ declare(strict_types=1); /** - * Copyright 2016 SURFnet bv + * Copyright 2014 SURFnet bv * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php index f7d87872..a8a8c4c7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php @@ -1,7 +1,7 @@ Date: Mon, 12 Feb 2024 17:41:24 +0100 Subject: [PATCH 094/202] Remove more than 1 blank line --- src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php | 1 - src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php | 1 - .../StepupRa/RaBundle/Repository/VettingProcedureRepository.php | 1 - .../Authentication/Handler/ExplicitSessionTimeoutHandler.php | 1 - src/Surfnet/StepupRa/RaBundle/Service/VettingService.php | 2 -- .../Tests/Security/Session/SessionLifetimeGuardTest.php | 2 -- 6 files changed, 8 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index a1a7f925..84c1d9f0 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -151,7 +151,6 @@ public function startProcedure(Request $request): Response ->forProcedure($procedureId) ->notice(sprintf('Starting new Vetting Procedure for second factor of type "%s"', $secondFactor->type)); - if ($this->vettingService->isProvePossessionSkippable($procedureId)) { $this->container->get('ra.procedure_logger') ->forProcedure($procedureId) diff --git a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php index 38b104e0..41c6ec96 100644 --- a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php +++ b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php @@ -85,7 +85,6 @@ public function log($level, $message, array $context = []): void $this->logger->log($level, $message, $this->enrichContext($context)); } - /** * Adds the procedure to the log context. * @throws RuntimeException diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php index d43dc379..5bc456da 100644 --- a/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php +++ b/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php @@ -26,7 +26,6 @@ interface VettingProcedureRepository { public function store(VettingProcedure $vettingProcedure); - public function retrieve(string $id): ?VettingProcedure; public function remove(string $id): mixed; diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php index c26000d4..926f0fc7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php @@ -66,7 +66,6 @@ public function process(RequestEvent $event): void implode(' and ', $invalidatedBy), )); - $token = $this->tokenStorage->getToken(); $request = $event->getRequest(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index a9fad2e5..5582e5f8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -244,7 +244,6 @@ public function verifyGssfId(string $gssfId): GssfVerificationResult return $result; } - /** * @throws UnknownVettingProcedureException * @throws DomainException @@ -310,7 +309,6 @@ public function getSecondFactorIdentifier(string $procedureId): string return $this->getProcedure($procedureId)->getSecondFactor()->secondFactorIdentifier; } - /** * @throws UnknownVettingProcedureException */ diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php index ad0d8588..3599d5a5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php @@ -111,7 +111,6 @@ public function an_authentication_session_with_a_lifetime_of_exactly_the_absolut $this->assertTrue($sessionLifetimeGuard->sessionLifetimeWithinAbsoluteLimit($sessionWithinTimeFrame)); } - /** * @test * @group security @@ -160,7 +159,6 @@ public function an_authentication_session_with_an_interaction_after_exactly_the_ $this->assertTrue($sessionLifetimeGuard->sessionLifetimeWithinRelativeLimit($sessionWithinTimeFrame)); } - /** * @test * @group security From 09e3a2362836c00aa140554b3fb94a200b1fb2b0 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 12 Feb 2024 17:43:51 +0100 Subject: [PATCH 095/202] Disable dotenv --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5a164f75..44a74b64 100644 --- a/composer.json +++ b/composer.json @@ -127,11 +127,13 @@ } }, "extra": { + "runtime": { + "disable_dotenv": true + }, "symfony": { "allow-contrib": false, "require": "6.4.*" }, - "src-dir": "src/Surfnet", "incenteev-parameters": [ { "file": "config/openconext/parameters.yaml" From 86ecdb3b03956412b745c05f7371416fa74cebfb Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 15:31:53 +0100 Subject: [PATCH 096/202] Use Dependency Injection --- config/services.yaml | 4 ++ .../RaBundle/Controller/SamlController.php | 8 +++- .../Controller/Vetting/GssfController.php | 21 +++++----- .../Vetting/SecondFactorController.php | 39 ------------------- .../Controller/Vetting/SmsController.php | 17 ++++---- .../Controller/Vetting/YubikeyController.php | 13 ++++--- .../RaBundle/Service/IdentityService.php | 2 +- 7 files changed, 40 insertions(+), 64 deletions(-) delete mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php diff --git a/config/services.yaml b/config/services.yaml index 0b40904d..73451c38 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -11,6 +11,10 @@ services: autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. public: true + Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService: + + Surfnet\StepupRa\RaBundle\Logger\ProcedureAwareLogger: + Surfnet\StepupRa\RaBundle\Controller\: resource: '../src/Surfnet/StepupRa/RaBundle/Controller/*' tags: [ 'controller.service_arguments' ] diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php index 9b1b2f5a..5f34b739 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -38,15 +38,19 @@ public function __construct( ) { } - #[Route('/authentication/consume-assertion', name: 'ra_serviceprovider_consume_assertion', methods: ['POST'])] + #[Route( + path: '/authentication/consume-assertion', + name: 'ra_serviceprovider_consume_assertion', + methods: ['POST'] + )] public function consumeAssertion(Request $httpRequest): Response { - $assertion = $this->postBinding->processResponse( $httpRequest, $this->remoteIdp, $this->hostedServiceProvider, ); + return $this->render( 'saml/consume_assertion.html.twig', ['assertion' => $assertion], diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index 7545eb32..37fbc364 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -31,9 +31,12 @@ use Surfnet\StepupBundle\Value\Provider\ViewConfigCollection; use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; use Surfnet\StepupRa\RaBundle\Form\Type\InitiateGssfType; +use Surfnet\StepupRa\RaBundle\Logger\ProcedureAwareLogger; +use Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService; use Surfnet\StepupRa\RaBundle\Service\VettingService; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -44,7 +47,7 @@ * Orchestrates verification of GSSFs (Generic SAML Second Factors) through GSSPs (Generic SAML Stepup Providers). * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -final class GssfController extends SecondFactorController +final class GssfController extends AbstractController { public function __construct( private readonly ProviderRepository $providerRepository, @@ -54,8 +57,9 @@ public function __construct( private readonly PostBinding $postBinding, private readonly AttributeDictionary $attributeDictionary, private readonly ViewConfigCollection $collection, + private readonly SecondFactorAssertionService $secondFactorAssertionService, + private readonly ProcedureAwareLogger $procedureAwareLogger, ) { - parent::__construct($logger); } /** @@ -68,11 +72,11 @@ public function __construct( )] public function initiate(string $procedureId, string $provider): Response { - $this->assertSecondFactorEnabled($provider); + $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); $this->denyAccessUnlessGranted('ROLE_RA'); - $procedureLogger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); $procedureLogger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); if (!$this->vettingService->hasProcedure($procedureId)) { @@ -90,11 +94,11 @@ public function initiate(string $procedureId, string $provider): Response )] public function authenticate(string $procedureId, string $provider): Response { - $this->assertSecondFactorEnabled($provider); + $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); $this->denyAccessUnlessGranted('ROLE_RA'); - $procedureLogger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); $procedureLogger->notice('Generating GSSF verification request', ['provider' => $provider]); if (!$this->vettingService->hasProcedure($procedureId)) { @@ -136,7 +140,7 @@ public function authenticate(string $procedureId, string $provider): Response )] public function verify(Request $httpRequest, string $provider): Response { - $this->assertSecondFactorEnabled($provider); + $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); $provider = $this->getProvider($provider); @@ -212,7 +216,7 @@ public function verify(Request $httpRequest, string $provider): Response )] public function metadata(string $provider): XMLResponse { - $this->assertSecondFactorEnabled($provider); + $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); $provider = $this->getProvider($provider); @@ -237,7 +241,6 @@ private function getProvider(string $provider): Provider } private function renderInitiateForm(string $procedureId, string $provider, array $parameters = []): Response { - $secondFactorConfig = $this->collection->getByIdentifier($provider); $form = $this->createForm( diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php deleted file mode 100644 index a9c2e767..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SecondFactorController.php +++ /dev/null @@ -1,39 +0,0 @@ -getParameter('surfnet_stepup_ra.enabled_second_factors'))) { - $this->logger->warning('A controller action was called for a disabled second factor'); - - throw $this->createNotFoundException(); - } - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 5bf7dbeb..3b630690 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -26,7 +26,10 @@ use Surfnet\StepupBundle\Value\PhoneNumber\InternationalPhoneNumber; use Surfnet\StepupRa\RaBundle\Form\Type\SendSmsChallengeType; use Surfnet\StepupRa\RaBundle\Form\Type\VerifyPhoneNumberType; +use Surfnet\StepupRa\RaBundle\Logger\ProcedureAwareLogger; +use Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService; use Surfnet\StepupRa\RaBundle\Service\VettingService; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\SubmitButton; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -37,14 +40,14 @@ /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class SmsController extends SecondFactorController +class SmsController extends AbstractController { public function __construct( private readonly VettingService $vettingService, private readonly TranslatorInterface $translator, - LoggerInterface $logger, + private readonly SecondFactorAssertionService $secondFactorAssertionService, + private readonly ProcedureAwareLogger $procedureAwareLogger, ) { - parent::__construct($logger); } #[Route( @@ -54,11 +57,11 @@ public function __construct( )] public function sendChallenge(Request $request, string $procedureId): Response { - $this->assertSecondFactorEnabled('sms'); + $this->secondFactorAssertionService->assertSecondFactorEnabled('sms'); $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->procedureAwareLogger->forProcedure($procedureId); $logger->notice('Received request for Send SMS Challenge page'); if (!$this->vettingService->hasProcedure($procedureId)) { @@ -127,9 +130,9 @@ public function sendChallenge(Request $request, string $procedureId): Response )] public function provePossession(Request $request, string $procedureId): Response { - $this->assertSecondFactorEnabled('sms'); + $this->secondFactorAssertionService->assertSecondFactorEnabled('sms'); $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->procedureAwareLogger->forProcedure($procedureId); $logger->notice('Received request for Proof of Possession of SMS Second Factor page'); $vettingService = $this->vettingService; diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 2a23a7cd..54b2f1fd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -24,20 +24,21 @@ use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; use Surfnet\StepupRa\RaBundle\Form\Type\VerifyYubikeyPublicIdType; use Surfnet\StepupRa\RaBundle\Logger\ProcedureAwareLogger; +use Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService; use Surfnet\StepupRa\RaBundle\Service\VettingService; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; -class YubikeyController extends SecondFactorController +class YubikeyController extends AbstractController { public function __construct( private readonly VettingService $vettingService, - LoggerInterface $logger, - // TODO: with sf 6 autowire attribute for procedureAwareLogger + private readonly SecondFactorAssertionService $secondFactorAssertionService, + private readonly ProcedureAwareLogger $procedureAwareLogger, ) { - parent::__construct($logger); } #[Route( @@ -47,11 +48,11 @@ public function __construct( )] public function verify(Request $request, string $procedureId): Response { - $this->assertSecondFactorEnabled('yubikey'); + $this->secondFactorAssertionService->assertSecondFactorEnabled('yubikey'); $this->denyAccessUnlessGranted('ROLE_RA'); - $procedureLogger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); $procedureLogger->notice('Requested Yubikey Verfication'); if (!$this->vettingService->hasProcedure($procedureId)) { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php index 4d646c9a..20f3ea72 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -54,7 +54,7 @@ public function loadUserByIdentifier(string $identifier): never /** * For now this functionality is disabled, unsure if actually needed */ - public function refreshUser(UserInterface $user) + public function refreshUser(UserInterface $user): UserInterface { throw new RuntimeException(sprintf('Cannot Refresh User "%s"', $user->getUsername())); } From c916f1a0974e5940b0942ad4baf3583535e6c0e6 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 16:23:40 +0100 Subject: [PATCH 097/202] Use Dependency Injection --- .../Gssf/GssfAuthenticateController.php | 93 ++++++ .../Vetting/Gssf/GssfInitiateFormService.php | 72 +++++ .../GssfInitiateVerificationController.php | 73 +++++ .../Vetting/Gssf/GssfMetadataController.php | 56 ++++ .../Vetting/Gssf/GssfVerifyController.php | 129 +++++++++ .../Controller/Vetting/GssfController.php | 269 ------------------ .../Controller/Vetting/YubikeyController.php | 2 +- .../Service/SecondFactorAssertionService.php | 43 +++ .../SecondFactorAssertionServiceTest.php | 62 ++++ .../Provider/ProviderRepository.php | 7 + 10 files changed, 536 insertions(+), 270 deletions(-) create mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php delete mode 100644 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php new file mode 100644 index 00000000..6cf5b5cd --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php @@ -0,0 +1,93 @@ +secondFactorAssertionService->assertSecondFactorEnabled($provider); + + $this->denyAccessUnlessGranted('ROLE_RA'); + + $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); + $procedureLogger->notice('Generating GSSF verification request', ['provider' => $provider]); + + if (!$this->vettingService->hasProcedure($procedureId)) { + $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); + throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); + } + + $provider = $this->providerRepository->get($provider); + + $authnRequest = AuthnRequestFactory::createNewRequest( + $provider->getServiceProvider(), + $provider->getRemoteIdentityProvider(), + ); + + $authnRequest->setSubject($this->vettingService->getSecondFactorIdentifier($procedureId)); + + $stateHandler = $provider->getStateHandler(); + $stateHandler->setRequestId($authnRequest->getRequestId()); + + $procedureLogger->notice( + sprintf( + 'Sending AuthnRequest with request ID: "%s" to GSSP "%s" at "%s"', + $authnRequest->getRequestId(), + $provider->getName(), + $provider->getRemoteIdentityProvider()->getSsoUrl(), + ), + ['provider' => $provider], + ); + + $this->vettingService->startGssfVerification($procedureId); + + return $this->redirectBinding->createResponseFor($authnRequest); + } + +} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php new file mode 100644 index 00000000..0a39f8a1 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php @@ -0,0 +1,72 @@ +collection->getByIdentifier($providerName); + + $form = $this->formFactory->create( + InitiateGssfType::class, + null, + [ + 'procedureId' => $procedureId, + 'provider' => $providerName, + /** @Ignore from translation message extraction */ + 'label' => $secondFactorConfig->getInitiate() + ], + ); + + $templateParameters = array_merge( + $parameters, + [ + 'form' => $form->createView(), + 'procedureId' => $procedureId, + 'provider' => $providerName, + 'secondFactorConfig' => $secondFactorConfig + ], + ); + + return new Response( + $this->twig->render( + '@default/vetting/gssf/initiate.html.twig', + $templateParameters + ) + ); + } + +} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php new file mode 100644 index 00000000..c080521d --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php @@ -0,0 +1,73 @@ +secondFactorAssertionService->assertSecondFactorEnabled($provider); + + $this->denyAccessUnlessGranted('ROLE_RA'); + + $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); + $procedureLogger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); + + if (!$this->vettingService->hasProcedure($procedureId)) { + $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); + throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); + } + + return $this->gssfInitiateFormService->renderInitiateForm( + procedureId: $procedureId, + providerName: $this->providerRepository->get($provider)->getName() + ); + } + +} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php new file mode 100644 index 00000000..458d4b62 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php @@ -0,0 +1,56 @@ +secondFactorAssertionService->assertSecondFactorEnabled($providerName); + + $provider = $this->providerRepository->get($providerName); + + /** @var MetadataFactory $factory */ + $factory = $this->container->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); + + return new XMLResponse($factory->generate()); + } + +} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php new file mode 100644 index 00000000..d1f5319f --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php @@ -0,0 +1,129 @@ +secondFactorAssertionService->assertSecondFactorEnabled($provider); + + $provider = $this->providerRepository->get($provider); + + $this->logger->notice( + sprintf('Received GSSP "%s" SAMLResponse through Gateway, attempting to process', $provider->getName()), + ); + + try { + $assertion = $this->postBinding->processResponse( + $httpRequest, + $provider->getRemoteIdentityProvider(), + $provider->getServiceProvider(), + ); + } catch (Exception $exception) { + $provider->getStateHandler()->clear(); + $this->logger->error( + sprintf('Could not process received Response, error: "%s"', $exception->getMessage()), + ); + + throw new BadRequestHttpException( + 'Could not process received SAML response, cannot return to vetting procedure', + ); + } + + $expectedResponseTo = $provider->getStateHandler()->getRequestId(); + $provider->getStateHandler()->clear(); + + if (!InResponseTo::assertEquals($assertion, $expectedResponseTo)) { + $this->logger->critical(sprintf( + 'Received Response with unexpected InResponseTo: %s', + ($expectedResponseTo ? 'expected "' . $expectedResponseTo . '"' : ' no response expected'), + )); + + throw new BadRequestHttpException('Received unexpected SAML response, cannot return to vetting procedure'); + } + + $this->logger->notice( + sprintf('Processed GSSP "%s" SAMLResponse received through Gateway successfully', $provider->getName()), + ); + + $gssfId = $this->attributeDictionary->translate($assertion)->getNameID(); + + $result = $this->vettingService->verifyGssfId($gssfId); + + if ($result->isSuccess()) { + $this->logger->notice('GSSP possession proven successfully'); + + return $this->redirectToRoute('ra_vetting_verify_identity', ['procedureId' => $result->getProcedureId()]); + } + + if (!$result->getProcedureId()) { + // Should be unreachable statement, because the request ID is compared to the response ID a few lines before + // this. + throw new RuntimeException('Procedure ID for GSSF verification procedure could not be recovered.'); + } + + $this->logger->notice( + 'Unable to prove possession of correct GSSF: ' . + 'GSSF ID registered in Self-Service does not match current GSSF ID', + ); + + return $this->gssfInitiateFormService->renderInitiateForm( + $result->getProcedureId(), + $provider->getName(), + ['gssfIdMismatch' => true], + ); + } + +} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php deleted file mode 100644 index 37fbc364..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ /dev/null @@ -1,269 +0,0 @@ -secondFactorAssertionService->assertSecondFactorEnabled($provider); - - $this->denyAccessUnlessGranted('ROLE_RA'); - - $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); - $procedureLogger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); - - if (!$this->vettingService->hasProcedure($procedureId)) { - $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); - throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); - } - - return $this->renderInitiateForm($procedureId, $this->getProvider($provider)->getName()); - } - - #[Route( - path: '/vetting-procedure/{procedureId}/gssf/{provider}/authenticate', - name: 'ra_vetting_gssf_authenticate', - methods: ['POST'], - )] - public function authenticate(string $procedureId, string $provider): Response - { - $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); - - $this->denyAccessUnlessGranted('ROLE_RA'); - - $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); - $procedureLogger->notice('Generating GSSF verification request', ['provider' => $provider]); - - if (!$this->vettingService->hasProcedure($procedureId)) { - $procedureLogger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); - throw new NotFoundHttpException(sprintf('Vetting procedure "%s" not found', $procedureId)); - } - - $provider = $this->getProvider($provider); - - $authnRequest = AuthnRequestFactory::createNewRequest( - $provider->getServiceProvider(), - $provider->getRemoteIdentityProvider(), - ); - - $authnRequest->setSubject($this->vettingService->getSecondFactorIdentifier($procedureId)); - - $stateHandler = $provider->getStateHandler(); - $stateHandler->setRequestId($authnRequest->getRequestId()); - - $procedureLogger->notice( - sprintf( - 'Sending AuthnRequest with request ID: "%s" to GSSP "%s" at "%s"', - $authnRequest->getRequestId(), - $provider->getName(), - $provider->getRemoteIdentityProvider()->getSsoUrl(), - ), - ['provider' => $provider], - ); - - $this->vettingService->startGssfVerification($procedureId); - - return $this->redirectBinding->createResponseFor($authnRequest); - } - - #[Route( - path: '/vetting-procedure/gssf/{provider}/verify', - name: 'ra_vetting_gssf_verify', - methods: ['POST'], - )] - public function verify(Request $httpRequest, string $provider): Response - { - $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); - - $provider = $this->getProvider($provider); - - $this->logger->notice( - sprintf('Received GSSP "%s" SAMLResponse through Gateway, attempting to process', $provider->getName()), - ); - - try { - $assertion = $this->postBinding->processResponse( - $httpRequest, - $provider->getRemoteIdentityProvider(), - $provider->getServiceProvider(), - ); - } catch (Exception $exception) { - $provider->getStateHandler()->clear(); - $this->logger->error( - sprintf('Could not process received Response, error: "%s"', $exception->getMessage()), - ); - - throw new BadRequestHttpException( - 'Could not process received SAML response, cannot return to vetting procedure', - ); - } - - $expectedResponseTo = $provider->getStateHandler()->getRequestId(); - $provider->getStateHandler()->clear(); - - if (!InResponseTo::assertEquals($assertion, $expectedResponseTo)) { - $this->logger->critical(sprintf( - 'Received Response with unexpected InResponseTo: %s', - ($expectedResponseTo ? 'expected "' . $expectedResponseTo . '"' : ' no response expected'), - )); - - throw new BadRequestHttpException('Received unexpected SAML response, cannot return to vetting procedure'); - } - - $this->logger->notice( - sprintf('Processed GSSP "%s" SAMLResponse received through Gateway successfully', $provider->getName()), - ); - - $gssfId = $this->attributeDictionary->translate($assertion)->getNameID(); - - $result = $this->vettingService->verifyGssfId($gssfId); - - if ($result->isSuccess()) { - $this->logger->notice('GSSP possession proven successfully'); - - return $this->redirectToRoute('ra_vetting_verify_identity', ['procedureId' => $result->getProcedureId()]); - } - - if (!$result->getProcedureId()) { - // Should be unreachable statement, because the request ID is compared to the response ID a few lines before - // this. - throw new RuntimeException('Procedure ID for GSSF verification procedure could not be recovered.'); - } - - $this->logger->notice( - 'Unable to prove possession of correct GSSF: ' . - 'GSSF ID registered in Self-Service does not match current GSSF ID', - ); - - return $this->renderInitiateForm( - $result->getProcedureId(), - $provider->getName(), - ['gssfIdMismatch' => true], - ); - } - - #[Route( - path: '/vetting-procedure/gssf/{provider}/metadata', - name: 'ra_vetting_gssf_metadata', - methods: ['GET'], - )] - public function metadata(string $provider): XMLResponse - { - $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); - - $provider = $this->getProvider($provider); - - /** @var MetadataFactory $factory */ - $factory = $this->container->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); - - return new XMLResponse($factory->generate()); - } - - /** - * @throws NotFoundHttpException - */ - private function getProvider(string $provider): Provider - { - if (!$this->providerRepository->has($provider)) { - $this->logger->info(sprintf('Requested GSSP "%s" does not exist or is not registered', $provider)); - - throw new NotFoundHttpException('Requested provider does not exist'); - } - - return $this->providerRepository->get($provider); - } - private function renderInitiateForm(string $procedureId, string $provider, array $parameters = []): Response - { - $secondFactorConfig = $this->collection->getByIdentifier($provider); - - $form = $this->createForm( - InitiateGssfType::class, - null, - [ - 'procedureId' => $procedureId, - 'provider' => $provider, - /** @Ignore from translation message extraction */ - 'label' => $secondFactorConfig->getInitiate() - ], - ); - - $templateParameters = array_merge( - $parameters, - [ - 'form' => $form->createView(), - 'procedureId' => $procedureId, - 'provider' => $provider, - 'secondFactorConfig' => $secondFactorConfig - ], - ); - - return $this->render('vetting/gssf/initiate.html.twig', $templateParameters); - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php index 54b2f1fd..73f4a680 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -46,7 +46,7 @@ public function __construct( name: 'ra_vetting_yubikey_verify', methods: ['GET', 'POST'], )] - public function verify(Request $request, string $procedureId): Response + public function __invoke(Request $request, string $procedureId): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled('yubikey'); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php new file mode 100644 index 00000000..c56d4d88 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php @@ -0,0 +1,43 @@ +parameterBag->get('surfnet_stepup_ra.enabled_second_factors'))) { + $this->logger->warning('A controller action was called for a disabled second factor'); + + throw new NotFoundHttpException; + } + } +} diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php new file mode 100644 index 00000000..4336fff4 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php @@ -0,0 +1,62 @@ +parameterBag = $this->createMock(ParameterBagInterface::class); + $this->logger = $this->createMock(LoggerInterface::class); + $this->service = new SecondFactorAssertionService($this->parameterBag, $this->logger); + } + + /** + * @test + */ + public function assertSecondFactorEnabled_should_throw_exception_when_second_factor_disabled() + { + $type = 'sms'; + + $this->parameterBag->expects($this->once()) + ->method('get') + ->with('surfnet_stepup_ra.enabled_second_factors') + ->willReturn(['email', 'app']); + + $this->logger->expects($this->once()) + ->method('warning') + ->with('A controller action was called for a disabled second factor'); + + $this->expectException(NotFoundHttpException::class); + + $this->service->assertSecondFactorEnabled($type); + } + + /** + * @test + */ + public function assertSecondFactorEnabled_should_not_throw_exception_when_second_factor_enabled() + { + $type = 'sms'; + + $this->parameterBag->expects($this->once()) + ->method('get') + ->with('surfnet_stepup_ra.enabled_second_factors') + ->willReturn(['sms', 'app']); + + $this->logger->expects($this->never()) + ->method('warning'); + + $this->service->assertSecondFactorEnabled($type); + } +} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php index 4fa8d25b..47d90227 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php @@ -20,11 +20,17 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle\Provider; +use Psr\Log\LoggerInterface; use Surfnet\StepupRa\SamlStepupProviderBundle\Exception\InvalidConfigurationException; use Surfnet\StepupRa\SamlStepupProviderBundle\Exception\UnknownProviderException; final class ProviderRepository { + + public function __construct(private LoggerInterface $logger) + { + } + /** * @var Provider[] */ @@ -50,6 +56,7 @@ public function has(string $providerName): bool public function get(string $providerName): Provider { if (!$this->has($providerName)) { + $this->logger->info(sprintf('Requested GSSP "%s" does not exist or is not registered', $providerName)); throw UnknownProviderException::create($providerName, array_keys($this->providers)); } From 6853c09ae3cb215aa89754ea39c3b1dc2e2727cd Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 17:10:07 +0100 Subject: [PATCH 098/202] Create MetadataCollection --- .../Vetting/Gssf/GssfMetadataController.php | 6 +- ...netStepupRaSamlStepupProviderExtension.php | 19 +++++-- .../MetadataFactoryNotFoundException.php | 25 +++++++++ .../Provider/MetadataFactoryCollection.php | 56 +++++++++++++++++++ .../Resources/config/services.yml | 2 + .../MetadataFactoryCollectionTest.php | 54 ++++++++++++++++++ 6 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php create mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/MetadataFactoryCollection.php create mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php index 458d4b62..5709c267 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php @@ -19,8 +19,8 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting\Gssf; use Surfnet\SamlBundle\Http\XMLResponse; -use Surfnet\SamlBundle\Metadata\MetadataFactory; use Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\MetadataFactoryCollection; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Routing\Attribute\Route; @@ -33,6 +33,7 @@ final class GssfMetadataController extends AbstractController public function __construct( private readonly ProviderRepository $providerRepository, private readonly SecondFactorAssertionService $secondFactorAssertionService, + private readonly MetadataFactoryCollection $metadataFactoryCollection, ) { } @@ -47,8 +48,7 @@ public function __invoke(string $providerName): XMLResponse $provider = $this->providerRepository->get($providerName); - /** @var MetadataFactory $factory */ - $factory = $this->container->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); + $factory = $this->metadataFactoryCollection->getByIdentifier($provider->getName()); return new XMLResponse($factory->generate()); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index fd5a5b82..2bc19491 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -20,6 +20,7 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle\DependencyInjection; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\MetadataFactoryCollection; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -169,7 +170,11 @@ private function buildHostedEntityDefinition($provider, array $configuration, ar /** * @param string $provider */ - private function createRemoteDefinition($provider, array $configuration, ContainerBuilder $container): void + private function createRemoteDefinition( + string $provider, + array $configuration, + ContainerBuilder $container + ): void { $definition = new Definition(IdentityProvider::class, [ [ @@ -205,13 +210,19 @@ private function createMetadataDefinition( $container->setDefinition('gssp.provider.' . $provider . 'metadata.configuration', $metadataConfiguration); $metadataFactory = new Definition(MetadataFactory::class, [ - new Reference('templating'), + new Reference('twig'), new Reference('router'), new Reference('surfnet_saml.signing_service'), new Reference('gssp.provider.' . $provider . 'metadata.configuration') ]); - $metadataFactory->setPublic(true); - $container->setDefinition('gssp.provider.' . $provider . '.metadata.factory', $metadataFactory); + $metadataFactoryServiceId = 'gssp.provider.' . $provider . '.metadata.factory'; + $container->setDefinition($metadataFactoryServiceId, $metadataFactory); + // Should not be read from container directly, use MetadataFactoryCollection instead + // @deprecated: this service should not be used anymore + $metadataFactory->setPublic(false); + + $container = $container->getDefinition(MetadataFactoryCollection::class); + $container->addMethodCall('add', [$provider, new Reference($metadataFactoryServiceId)]); } private function createRouteConfig($provider, $routeName): array diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php new file mode 100644 index 00000000..5c4a4c7e --- /dev/null +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php @@ -0,0 +1,25 @@ + + */ + private array $metadataFactoryCollection = []; + + public function getByIdentifier(string $provider): MetadataFactory + { + if (!$this->has($provider)) { + throw new MetadataFactoryNotFoundException( + message: "The provider {$provider} does not exist in the collection" + ); + } + + return $this->metadataFactoryCollection[$provider]; + } + + private function has(string $provider): bool + { + return array_key_exists($provider, $this->metadataFactoryCollection); + } + + public function add(string $provider, MetadataFactory $factory): void + { + if ($this->has($provider)) { + return; + } + $this->metadataFactoryCollection[$provider] = $factory; + } +} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index 2e885713..f2d1f85f 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -4,6 +4,8 @@ services: autoconfigure: true public: true + Surfnet\StepupRa\SamlStepupProviderBundle\Provider\MetadataFactoryCollection: + gssp.provider_repository: public: true class: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php new file mode 100644 index 00000000..222c61c0 --- /dev/null +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php @@ -0,0 +1,54 @@ +createMock(MetadataFactory::class); + + $collection->add($identifier, $factory); + + $this->assertSame($factory, $collection->getByIdentifier($identifier)); + } + + /** + * @test + */ + public function exception_is_thrown_when_retrieving_non_existent_provider(): void + { + $identifier = 'provider1'; + $this->expectException(MetadataFactoryNotFoundException::class); + $this->expectExceptionMessage("The provider {$identifier} does not exist in the collection"); + + $collection = new MetadataFactoryCollection(); + $collection->getByIdentifier($identifier); + } +} From ea9f5ba804c1a4405f9223910533b2af0c22ad87 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 16:23:40 +0100 Subject: [PATCH 099/202] Use Dependency Injection --- .../Vetting/Gssf/GssfInitiateFormService.php | 3 +- .../GssfInitiateVerificationController.php | 2 +- .../Vetting/Gssf/GssfMetadataController.php | 30 +++++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php index 0a39f8a1..438120dd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php @@ -20,7 +20,6 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting\Gssf; -use JMS\TranslationBundle\Annotation\Ignore; use Surfnet\StepupBundle\Value\Provider\ViewConfigCollection; use Surfnet\StepupRa\RaBundle\Form\Type\InitiateGssfType; use Symfony\Component\Form\FormFactoryInterface; @@ -63,7 +62,7 @@ public function renderInitiateForm(string $procedureId, string $providerName, ar return new Response( $this->twig->render( - '@default/vetting/gssf/initiate.html.twig', + 'vetting/gssf/initiate.html.twig', $templateParameters ) ); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php index c080521d..3aecc38e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php @@ -50,7 +50,7 @@ public function __construct( name: 'ra_vetting_gssf_initiate', methods: ['GET'], )] - public function __invoke(string $procedureId, string $provider): Response + public function initiate(string $procedureId, string $provider): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php index 5709c267..88d1dea7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php @@ -18,22 +18,26 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting\Gssf; +use Psr\Log\LoggerInterface; use Surfnet\SamlBundle\Http\XMLResponse; +use Surfnet\SamlBundle\Metadata\MetadataFactory; use Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService; -use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\MetadataFactoryCollection; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; /** * Orchestrates verification of GSSFs (Generic SAML Second Factors) through GSSPs (Generic SAML Stepup Providers). + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ final class GssfMetadataController extends AbstractController { public function __construct( private readonly ProviderRepository $providerRepository, + private readonly LoggerInterface $logger, private readonly SecondFactorAssertionService $secondFactorAssertionService, - private readonly MetadataFactoryCollection $metadataFactoryCollection, ) { } @@ -42,15 +46,29 @@ public function __construct( name: 'ra_vetting_gssf_metadata', methods: ['GET'], )] - public function __invoke(string $providerName): XMLResponse + public function metadata(string $provider): XMLResponse { - $this->secondFactorAssertionService->assertSecondFactorEnabled($providerName); + $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); - $provider = $this->providerRepository->get($providerName); + $provider = $this->getProvider($provider); - $factory = $this->metadataFactoryCollection->getByIdentifier($provider->getName()); + /** @var MetadataFactory $factory */ + $factory = $this->container->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); return new XMLResponse($factory->generate()); } + /** + * @throws NotFoundHttpException + */ + private function getProvider(string $provider): Provider + { + if (!$this->providerRepository->has($provider)) { + $this->logger->info(sprintf('Requested GSSP "%s" does not exist or is not registered', $provider)); + + throw new NotFoundHttpException('Requested provider does not exist'); + } + + return $this->providerRepository->get($provider); + } } From d0f63fc7cde531951a7b55653e7920af04fef5ed Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 17:20:01 +0100 Subject: [PATCH 100/202] Remove obsolete config after renaming the service --- config/services.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 73451c38..0f8b1e0d 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -31,9 +31,6 @@ services: Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider: alias: surfnet_saml.saml_provider - templating: - alias: 'twig' - ra.service.gssf: class: Surfnet\StepupRa\RaBundle\Service\GssfService arguments: From 3083c7ec752c2bbe31e0ba57d24adf12bc6c5ebd Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 21:01:28 +0100 Subject: [PATCH 101/202] Add phpstan rule to detect debug statements --- ci/qa/phpstan | 5 + ci/qa/phpstan-baseline.php | 1185 +++++++++++++++++++++++++++ ci/qa/phpstan-update-baseline | 5 + ci/qa/phpstan.neon | 12 + src/Surfnet/NoDebugFunctionRule.php | 54 ++ 5 files changed, 1261 insertions(+) create mode 100755 ci/qa/phpstan create mode 100644 ci/qa/phpstan-baseline.php create mode 100755 ci/qa/phpstan-update-baseline create mode 100644 ci/qa/phpstan.neon create mode 100644 src/Surfnet/NoDebugFunctionRule.php diff --git a/ci/qa/phpstan b/ci/qa/phpstan new file mode 100755 index 00000000..16ea2edf --- /dev/null +++ b/ci/qa/phpstan @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd $(dirname $0)/../../ + +vendor/bin/phpstan analyze --memory-limit=-1 --no-ansi -c ./ci/qa/phpstan.neon diff --git a/ci/qa/phpstan-baseline.php b/ci/qa/phpstan-baseline.php new file mode 100644 index 00000000..83cba150 --- /dev/null +++ b/ci/qa/phpstan-baseline.php @@ -0,0 +1,1185 @@ + '#^Class Surfnet\\\\NoDebugFunctionRule implements generic interface PHPStan\\\\Rules\\\\Rule but does not specify its types\\: TNodeType$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/NoDebugFunctionRule.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Assert\\:\\:keysAre\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Assert.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Assert\\:\\:keysAre\\(\\) has parameter \\$expectedKeys with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Assert.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Assert\\:\\:keysAre\\(\\) has parameter \\$propertyPath with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Assert.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand\\:\\:\\$availableInstitutions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$institutionFilterOptions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$institutionFilterOptions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaListingCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$raInstitutionFilterOptions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaListingCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaSecondFactorsCommand\\:\\:\\$institutionFilterOptions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRecoveryTokensCommand\\:\\:\\$institutionFilterOptions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SelectInstitutionCommand\\:\\:\\$availableInstitutions type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SelectInstitutionCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__get\\(\\) has parameter \\$name with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__isset\\(\\) has parameter \\$name with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__set\\(\\) has parameter \\$value with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:assertValidLanguageInName\\(\\) has parameter \\$name with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:setHints\\(\\) has parameter \\$hints with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\ExceptionController\\:\\:getPageTitleAndDescription\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface\\:\\:switchLocale\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\LocaleController\\:\\:__construct\\(\\) has parameter \\$identityService with generic interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface but does not specify its types\\: TUser$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Negated boolean expression is always false\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$url of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:redirect\\(\\) expects string, bool\\|float\\|int\\|string\\|null given\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupBundle\\\\Command\\\\SwitchLocaleCommand\\:\\:\\$identityId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$id on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$id of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaLocationService\\:\\:find\\(\\) expects string, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\ProfileService\\:\\:findByIdentityId\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\CreateRaLocationCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\CreateRaLocationCommand\\:\\:\\$institution \\(string\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\RemoveRaLocationCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaLocationsCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaLocationsCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$actorInstitution\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Form\\\\FormInterface\\:\\:isClicked\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$id on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$institution on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$institutions on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaCandidateInstitutions\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$raCandidate on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaCandidateInstitutions\\|null\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot cast mixed to int\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\RaManagementController\\:\\:amendRaInformation\\(\\) has parameter \\$identityId with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\RaManagementController\\:\\:amendRaInformation\\(\\) has parameter \\$raInstitution with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\RaManagementController\\:\\:retractRegistrationAuthority\\(\\) has parameter \\$identityId with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\RaManagementController\\:\\:retractRegistrationAuthority\\(\\) has parameter \\$raInstitution with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Negated boolean expression is always false\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaCandidateService\\:\\:getRaCandidate\\(\\) expects string, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand\\:\\:\\$identityId \\(string\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\ProfileService\\:\\:findByIdentityId\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot cast mixed to int\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\RevokeRecoveryTokenCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRecoveryTokensCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRecoveryTokensCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRecoveryTokensCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Form\\\\FormInterface\\:\\:getClickedButton\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface\\:\\:findById\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot cast mixed to int\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\SecondFactorController\\:\\:__construct\\(\\) has parameter \\$identityService with generic interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface but does not specify its types\\: TUser$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\RevokeSecondFactorCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaSecondFactorsCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaSecondFactorsCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaSecondFactorsCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchSecondFactorAuditLogCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchSecondFactorAuditLogCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Surfnet\\\\StepupBundle\\\\Value\\\\Provider\\\\ViewConfigInterface\\:\\:getInitiate\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\Vetting\\\\Gssf\\\\GssfInitiateFormService\\:\\:renderInitiateForm\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$gssfId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\VettingService\\:\\:verifyGssfId\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method forProcedure\\(\\) on mixed\\.$#', + 'count' => 4, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\VettingController\\:\\:cancelProcedure\\(\\) has parameter \\$procedureId with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#2 \\$actorId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\SecondFactorService\\:\\:findVerifiedSecondFactorByRegistrationCode\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\StartVettingProcedureCommand\\:\\:\\$authorityId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\ProfileService\\:\\:findByIdentityId\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:\\$identityId \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Static property Surfnet\\\\StepupRa\\\\RaBundle\\\\DateTime\\\\DateTime\\:\\:\\$now is never written, only read\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method integerNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface\\:\\:setLocale\\(\\)\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:__construct\\(\\) has parameter \\$code with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:__construct\\(\\) has parameter \\$constraints with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:__construct\\(\\) has parameter \\$message with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:__construct\\(\\) has parameter \\$propertyPath with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:__construct\\(\\) has parameter \\$value with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:getConstraints\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:getPropertyPath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Exception\\\\AssertionFailedException\\:\\:getValue\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Form\\\\Extension\\\\RaRoleChoiceList\\:\\:buildChoices\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Form\\\\Extension\\\\RaRoleChoiceList\\:\\:create\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Form\\\\Extension\\\\RaRoleChoiceList\\:\\:getChoices\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Form\\\\Extension\\\\SecondFactorTypeChoiceList\\:\\:create\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$availableInstitutions on mixed\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$institutionFilterOptions on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php', +]; +$ignoreErrors[] = [ + 'message' => '#^PHPDoc tag @var has invalid value \\(\\$command SearchRaCandidatesCommand\\)\\: Unexpected token "\\$command", expected type at offset 9$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$availableInstitutions on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$locales on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Logger\\\\ProcedureAwareLogger\\:\\:enrichContext\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Logger\\\\ProcedureAwareLogger\\:\\:enrichContext\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Repository\\\\SessionVettingProcedureRepository\\:\\:retrieve\\(\\) should return Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Repository\\\\VettingProcedureRepository\\:\\:store\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\AuthenticatedIdentity\\:\\:eraseCredentials\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\AuthenticatedSessionStateHandler\\:\\:setCurrentRequestUri\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/AuthenticatedSessionStateHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to method logout\\(\\) on an unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\CookieClearingLogoutHandler\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to method logout\\(\\) on an unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\SessionLogoutHandler\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\Storage\\\\TokenStorageInterface\\:\\:setToken\\(\\) invoked with 0 parameters, 1 required\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\$cookieClearingLogoutHandler of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:__construct\\(\\) has invalid type Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\CookieClearingLogoutHandler\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\$sessionLogoutHandler of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:__construct\\(\\) has invalid type Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\SessionLogoutHandler\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:\\$cookieClearingLogoutHandler has unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\CookieClearingLogoutHandler as its type\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:\\$sessionLogoutHandler has unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\SessionLogoutHandler as its type\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$requestId of method Surfnet\\\\SamlBundle\\\\Monolog\\\\SamlAuthenticationLogger\\:\\:forAuthentication\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$preferredLocale on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$authorizations on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$isSraa on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Provider\\\\SamlProvider implements generic interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface but does not specify its types\\: TUser$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Provider\\\\SamlProvider\\:\\:getNameId\\(\\) should return string but returns string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$array of function reset expects array\\|object, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\ProfileService\\:\\:findByIdentityId\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$loa of class Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Token\\\\SamlToken constructor expects Surfnet\\\\StepupBundle\\\\Value\\\\Loa, Surfnet\\\\StepupBundle\\\\Value\\\\Loa\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$loaIdentifier of method Surfnet\\\\StepupBundle\\\\Service\\\\LoaResolutionService\\:\\:getLoa\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$nameId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\IdentityService\\:\\:findByNameIdAndInstitution\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\SamlAuthenticationStateHandler\\:\\:setRequestId\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\SamlInteractionProvider\\:\\:\\$loaResolutionService is never read, only written\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Unreachable statement \\- code above always terminates\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Session\\\\SessionStorage\\:\\:getCurrentRequestUri\\(\\) should return string but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Session\\\\SessionStorage\\:\\:getRequestId\\(\\) should return string\\|null but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$string of static method Surfnet\\\\StepupRa\\\\RaBundle\\\\Value\\\\DateTime\\:\\:fromString\\(\\) expects string, mixed given\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Token\\\\SamlToken\\:\\:__unserialize\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Factory\\\\SamlFactory\\:\\:create\\(\\) has parameter \\$config with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Factory\\\\SamlFactory\\:\\:create\\(\\) has parameter \\$defaultEntryPoint with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Factory\\\\SamlFactory\\:\\:create\\(\\) has parameter \\$userProvider with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Factory\\\\SamlFactory\\:\\:create\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Factory\\\\SamlFactory\\:\\:createAuthenticator\\(\\) should return array\\\\|string but returns array\\\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$orderBy of method Surfnet\\\\StepupMiddlewareClient\\\\Identity\\\\Dto\\\\SecondFactorAuditLogSearchQuery\\:\\:setOrderBy\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/CommandService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access offset \'gssfId\' on mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/GssfService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access offset \'procedureId\' on mixed\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/GssfService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$procedureId of static method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\Gssf\\\\VerificationResult\\:\\:verificationFailed\\(\\) expects string, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/GssfService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$procedureId of static method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\Gssf\\\\VerificationResult\\:\\:verificationSucceeded\\(\\) expects string, mixed given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/GssfService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getUsername\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\IdentityService implements generic interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface but does not specify its types\\: TUser$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\IdentityService\\:\\:supportsClass\\(\\) has parameter \\$class with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\InstitutionConfigurationOptionsServiceInterface\\:\\:getInstitutionConfigurationOptionsFor\\(\\) has parameter \\$institution with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\InstitutionListingService\\:\\:getAll\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\AccreditIdentityCommand\\:\\:\\$raInstitution \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\AccreditIdentityCommand\\:\\:\\$role \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Left side of && is always true\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$raInstitution of method Surfnet\\\\StepupMiddlewareClient\\\\Identity\\\\Dto\\\\RaListingSearchQuery\\:\\:setRaInstitution\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$role of method Surfnet\\\\StepupMiddlewareClient\\\\Identity\\\\Dto\\\\RaListingSearchQuery\\:\\:setRole\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaSecondFactorExport\\:\\:export\\(\\) has parameter \\$fileName with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$stream of function fflush expects resource, resource\\|false given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$stream of function fputcsv expects resource, resource\\|false given\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaSecondFactorService\\:\\:buildQuery\\(\\) has parameter \\$command with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaSecondFactorService\\:\\:buildQuery\\(\\) has parameter \\$query with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaSecondFactorService\\:\\:search\\(\\) should return Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaSecondFactorCollection but returns Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaSecondFactorCollection\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$collection of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaSecondFactorExport\\:\\:export\\(\\) expects Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaSecondFactorExportCollection, Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaSecondFactorExportCollection\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\AppointRoleCommand\\:\\:\\$role \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#2 \\$haystack of function in_array expects array, array\\|bool\\|float\\|int\\|string\\|UnitEnum\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getElements\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\VerifiedSecondFactorCollection\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\SecondFactorService\\:\\:findVerifiedSecondFactorByRegistrationCode\\(\\) should return Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\VerifiedSecondFactor\\|null but returns Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\VerifiedSecondFactor\\|false\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getAuthorityId\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getDocumentNumber\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getRegistrationCode\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getSecondFactor\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 17, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getYubikeyPublicId\\(\\) on Surfnet\\\\StepupBundle\\\\Value\\\\YubikeyPublicId\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method isIdentityVerified\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method isProvePossessionSkippable\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method verifyIdentity\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method verifySecondFactorIdentifier\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method vet\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\VettingService\\:\\:getProcedure\\(\\) never returns null so it can be removed from the return type\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$procedureId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\VettingService\\:\\:getProcedure\\(\\) expects string, string\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$vettingProcedure of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Repository\\\\VettingProcedureRepository\\:\\:store\\(\\) expects Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure, Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null given\\.$#', + 'count' => 4, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\VetSecondFactorCommand\\:\\:\\$documentNumber \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\VetSecondFactorCommand\\:\\:\\$identityVerified \\(bool\\) does not accept bool\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\VetSecondFactorCommand\\:\\:\\$provePossessionSkipped \\(bool\\) does not accept bool\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\VetSecondFactorCommand\\:\\:\\$registrationCode \\(string\\) does not accept string\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getYubikeyPublicId\\(\\) on Surfnet\\\\StepupBundle\\\\Value\\\\YubikeyPublicId\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Twig\\\\Extensions\\\\Extension\\\\SecondFactorType\\:\\:translateSecondFactorType\\(\\) has parameter \\$secondFactorType with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Static property Surfnet\\\\StepupRa\\\\RaBundle\\\\Value\\\\DateTime\\:\\:\\$now is never written, only read\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Value/DateTime.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method scalarNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$rootNode of method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\Configuration\\:\\:addProvidersSection\\(\\) expects Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\ArrayNodeDefinition, Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$rootNode of method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\Configuration\\:\\:addRoutesSection\\(\\) expects Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\ArrayNodeDefinition, Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:buildHostedEntityDefinition\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:buildHostedEntityDefinition\\(\\) has parameter \\$routes with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createHostedDefinitions\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createHostedDefinitions\\(\\) has parameter \\$routes with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createMetadataDefinition\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createMetadataDefinition\\(\\) has parameter \\$routes with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createRemoteDefinition\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createRouteConfig\\(\\) has parameter \\$provider with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createRouteConfig\\(\\) has parameter \\$routeName with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:createRouteConfig\\(\\) return type has no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:loadProviderConfiguration\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:loadProviderConfiguration\\(\\) has parameter \\$provider with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:loadProviderConfiguration\\(\\) has parameter \\$routes with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Exception\\\\InvalidArgumentException\\:\\:invalidType\\(\\) has parameter \\$expectedType with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Exception\\\\InvalidArgumentException\\:\\:invalidType\\(\\) has parameter \\$parameter with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Exception\\\\InvalidArgumentException\\:\\:invalidType\\(\\) has parameter \\$value with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Exception\\\\UnknownProviderException\\:\\:create\\(\\) has parameter \\$knownProviders with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Exception\\\\UnknownProviderException\\:\\:create\\(\\) has parameter \\$unknownProvider with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$childNodes on DOMElement\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Negated boolean expression is always false\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getLocale\\(\\) on Symfony\\\\Component\\\\HttpFoundation\\\\Request\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:__construct\\(\\) has parameter \\$explanation with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:__construct\\(\\) has parameter \\$gssfIdMismatch with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:__construct\\(\\) has parameter \\$initiate with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:__construct\\(\\) has parameter \\$pageTitle with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:__construct\\(\\) has parameter \\$title with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:getExplanation\\(\\) should return string but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:getGssfIdMismatch\\(\\) should return string but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:getInitiate\\(\\) should return string but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:getPageTitle\\(\\) should return string but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:getTitle\\(\\) should return string but returns mixed\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Provider\\\\ViewConfig\\:\\:getTranslation\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:get\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:get\\(\\) has parameter \\$key with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:set\\(\\) has parameter \\$key with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:set\\(\\) has parameter \\$value with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', +]; + +return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; diff --git a/ci/qa/phpstan-update-baseline b/ci/qa/phpstan-update-baseline new file mode 100755 index 00000000..b232cda9 --- /dev/null +++ b/ci/qa/phpstan-update-baseline @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd $(dirname $0)/../../ + +vendor/bin/phpstan analyse --memory-limit=-1 --no-ansi -c ./ci/qa/phpstan.neon --generate-baseline ./ci/qa/phpstan-baseline.php diff --git a/ci/qa/phpstan.neon b/ci/qa/phpstan.neon new file mode 100644 index 00000000..309b30f3 --- /dev/null +++ b/ci/qa/phpstan.neon @@ -0,0 +1,12 @@ +includes: + - ./phpstan-baseline.php + - ../../vendor/phpstan/phpstan-symfony/extension.neon +rules: + - Surfnet\NoDebugFunctionRule +parameters: + level: 9 + paths: + - ../../src + excludePaths: + - ../../src/Surfnet/StepupRa/RaBundle/Tests + - ../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests diff --git a/src/Surfnet/NoDebugFunctionRule.php b/src/Surfnet/NoDebugFunctionRule.php new file mode 100644 index 00000000..f3a22ade --- /dev/null +++ b/src/Surfnet/NoDebugFunctionRule.php @@ -0,0 +1,54 @@ + + */ + public function processNode(Node $node, Scope $scope): array + { + if (!$node instanceof FuncCall) { + return []; + } + + if ($node->name instanceof Node\Name) { + $functionName = $node->name->toString(); + if (in_array($functionName, ['dd', 'dump', 'var_dump', 'print_r', 'exit', 'die'])) { + return ["Do not use {$functionName} function"]; + } + } + + return []; + } +} From 15df0c29dfcf9638ea551e3bc5c6ea8079fe6cd2 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 13 Feb 2024 21:11:38 +0100 Subject: [PATCH 102/202] Change early returns --- src/Surfnet/NoDebugFunctionRule.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Surfnet/NoDebugFunctionRule.php b/src/Surfnet/NoDebugFunctionRule.php index f3a22ade..f5cae130 100644 --- a/src/Surfnet/NoDebugFunctionRule.php +++ b/src/Surfnet/NoDebugFunctionRule.php @@ -42,11 +42,13 @@ public function processNode(Node $node, Scope $scope): array return []; } - if ($node->name instanceof Node\Name) { - $functionName = $node->name->toString(); - if (in_array($functionName, ['dd', 'dump', 'var_dump', 'print_r', 'exit', 'die'])) { - return ["Do not use {$functionName} function"]; - } + if (!$node->name instanceof Node\Name) { + return []; + } + + $functionName = $node->name->toString(); + if (in_array($functionName, ['dd', 'dump', 'var_dump', 'print_r', 'exit', 'die'])) { + return ["Do not use {$functionName} function"]; } return []; From 7af745827297c2f44ae0b3729504ff00d6b5cb17 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 28 Feb 2024 17:00:59 +0100 Subject: [PATCH 103/202] Remove getIdentity call --- config/packages/smoketest/framework.yaml | 2 +- config/packages/test/framework.yaml | 4 ++-- .../StepupRa/RaBundle/Controller/VettingController.php | 8 +------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/config/packages/smoketest/framework.yaml b/config/packages/smoketest/framework.yaml index 848c0a29..0175ac4b 100644 --- a/config/packages/smoketest/framework.yaml +++ b/config/packages/smoketest/framework.yaml @@ -4,7 +4,7 @@ imports: framework: test: ~ session: - storage_id: session.storage.mock_file + storage_factory_id: session.storage.factory.mock_file profiler: collect: false php_errors: diff --git a/config/packages/test/framework.yaml b/config/packages/test/framework.yaml index c2e33539..dbf8bf02 100644 --- a/config/packages/test/framework.yaml +++ b/config/packages/test/framework.yaml @@ -1,6 +1,6 @@ framework: test: ~ session: - storage_id: session.storage.mock_file + storage_factory_id: session.storage.factory.mock_file profiler: - collect: false \ No newline at end of file + collect: false diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 84c1d9f0..7359b730 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -69,7 +69,6 @@ public function __construct( public function startProcedure(Request $request): Response { $this->denyAccessUnlessGranted('ROLE_RA'); - $identity = $this->getIdentity(); $this->logger->notice('Vetting Procedure Search started'); @@ -113,7 +112,7 @@ public function startProcedure(Request $request): Response /** @var SamlToken $token */ $token = $this->container->get('security.token_storage')->getToken(); - $command->authorityId = $this->getIdentity()->id; + $command->authorityId = $this->getUser()->getIdentity()->id; $command->authorityLoa = $token->getLoa(); $command->secondFactor = $secondFactor; @@ -302,9 +301,4 @@ public function vettingCompleted(): Response { return $this->render('vetting/vetting_completed.html.twig'); } - - private function getIdentity(): Identity - { - return $this->container->get('security.token_storage')->getToken()->getUser(); - } } From 2d9699a4bcff4342bebba74ca2894f8b9aaf6c03 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 28 Feb 2024 17:03:18 +0100 Subject: [PATCH 104/202] Add AuthenticatedIdentity --- .../StepupRa/RaBundle/Controller/VettingController.php | 1 - .../Security/Authentication/Provider/SamlProvider.php | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 7359b730..2917e348 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -21,7 +21,6 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Service\SecondFactorTypeService; use Surfnet\StepupBundle\Value\SecondFactorType; -use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand; use Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand; use Surfnet\StepupRa\RaBundle\Exception\DomainException; diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index c94b20c4..98ab52e8 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -32,6 +32,8 @@ use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; +use Symfony\Component\DependencyInjection\Attribute\AsAlias; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\User\UserInterface; @@ -96,7 +98,7 @@ public function getUser(Assertion $assertion): UserInterface } } - $authenticatedIdentity = new AuthenticatedIdentity($identity); + $authenticatedIdentity = new AuthenticatedIdentity($identity, $roles); $loa = $this->loaResolutionService->getLoa($assertion->getAuthnContextClassRef()); $authenticatedToken = new SamlToken($loa, $roles); $authenticatedToken->setUser($authenticatedIdentity); From 74618bc80dc447ca7377fde46ce113d0055f5cb1 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 28 Feb 2024 17:03:31 +0100 Subject: [PATCH 105/202] Add roles via contructor --- .../Security/AuthenticatedIdentity.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php index 12f276d6..7f43c5bc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php @@ -23,9 +23,12 @@ use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Symfony\Component\Security\Core\User\UserInterface; -readonly class AuthenticatedIdentity implements UserInterface +class AuthenticatedIdentity implements UserInterface { - public function __construct(private Identity $originalIdentity) + public function __construct( + private readonly Identity $originalIdentity, + private readonly array $roles = [], + ) { } @@ -39,13 +42,15 @@ public function getUsername(): string return $this->originalIdentity->id ?: ''; } - /** - * @inheritDoc - */ public function getRoles(): array { - // You can customize this method based on your application's logic. - return ['ROLE_USER']; + $allRoles = $this->roles; + + // user always has ROLE_USER at least + if (!in_array('ROLE_USER', $this->roles)) { + $allRoles[] = 'ROLE_USER'; + } + return $allRoles; } /** From eafd71037c6ef8774a22f152cb028480cd188fad Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 29 Feb 2024 12:19:19 +0100 Subject: [PATCH 106/202] Using ICU format for translations --- .../{messages.en_GB.xliff => messages+intl-icu.en_GB.xliff} | 6 +++--- .../{messages.nl_NL.xliff => messages+intl-icu.nl_NL.xliff} | 6 +++--- ...lidators.en_GB.xliff => validators+intl-icu.en_GB.xliff} | 0 ...lidators.nl_NL.xliff => validators+intl-icu.nl_NL.xliff} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename translations/{messages.en_GB.xliff => messages+intl-icu.en_GB.xliff} (99%) rename translations/{messages.nl_NL.xliff => messages+intl-icu.nl_NL.xliff} (99%) rename translations/{validators.en_GB.xliff => validators+intl-icu.en_GB.xliff} (100%) rename translations/{validators.nl_NL.xliff => validators+intl-icu.nl_NL.xliff} (100%) diff --git a/translations/messages.en_GB.xliff b/translations/messages+intl-icu.en_GB.xliff similarity index 99% rename from translations/messages.en_GB.xliff rename to translations/messages+intl-icu.en_GB.xliff index b2509e61..1cb4ea7a 100644 --- a/translations/messages.en_GB.xliff +++ b/translations/messages+intl-icu.en_GB.xliff @@ -949,7 +949,7 @@ ra.management.search.text.number_results - {0}no results found.|{1}%count% result found.|]1,Inf]%count% results found. + {count,plural,=0 {No results found.}one{# result found.}other{# results found.}} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/manage.html.twig @@ -1236,7 +1236,7 @@ ra.recovery_token.search.text.number_of_recovery_tokens - {0}no results found.|{1}%count% result found.|]1,Inf]%count% results found. + {count,plural,=0 {No results found.}one{# result found.}other{# results found.}} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/recovery_token/search.html.twig @@ -1372,7 +1372,7 @@ ra.second_factor.search.text.number_of_second_factors - {0}no results found.|{1}%count% result found.|]1,Inf]%count% results found. + {count,plural,=0 {No results found.}one{# result found.}other{# results found.}} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/second_factor/search.html.twig diff --git a/translations/messages.nl_NL.xliff b/translations/messages+intl-icu.nl_NL.xliff similarity index 99% rename from translations/messages.nl_NL.xliff rename to translations/messages+intl-icu.nl_NL.xliff index aa382ed8..5d9131ba 100644 --- a/translations/messages.nl_NL.xliff +++ b/translations/messages+intl-icu.nl_NL.xliff @@ -949,7 +949,7 @@ ra.management.search.text.number_results - {0}geen resultaten gevonden.|{1}%count% resultaat gevonden.|]1,Inf]%count% resultaten gevonden. + {count,plural,=0 {Geen resultaten gevonden.}one{# resultaat gevonden.}other{# resultaten gevonden.}} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/ra_management/manage.html.twig @@ -1236,7 +1236,7 @@ ra.recovery_token.search.text.number_of_recovery_tokens - {0}geen resultaten gevonden.|{1}%count% resultaat gevonden.|]1,Inf]%count% resultaten gevonden. + {count,plural,=0 {Geen resultaten gevonden.}one{# resultaat gevonden.}other{# resultaten gevonden.}} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/recovery_token/search.html.twig @@ -1372,7 +1372,7 @@ ra.second_factor.search.text.number_of_second_factors - {0}geen resultaten gevonden.|{1}%count% resultaat gevonden.|]1,Inf]%count% resultaten gevonden. + {count,plural,=0 {Geen resultaten gevonden.}one{# resultaat gevonden.}other{# resultaten gevonden.}} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/second_factor/search.html.twig diff --git a/translations/validators.en_GB.xliff b/translations/validators+intl-icu.en_GB.xliff similarity index 100% rename from translations/validators.en_GB.xliff rename to translations/validators+intl-icu.en_GB.xliff diff --git a/translations/validators.nl_NL.xliff b/translations/validators+intl-icu.nl_NL.xliff similarity index 100% rename from translations/validators.nl_NL.xliff rename to translations/validators+intl-icu.nl_NL.xliff From 249ad6a1f9bd00046284278b66ba360855d08b19 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 4 Mar 2024 11:58:04 +0100 Subject: [PATCH 107/202] Remove dead code --- .../Authentication/Provider/SamlProvider.php | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index 98ab52e8..c49bdf09 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -24,17 +24,12 @@ use Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary; use Surfnet\SamlBundle\SAML2\Response\AssertionAdapter; use Surfnet\SamlBundle\Security\Authentication\Provider\SamlProviderInterface; -use Surfnet\StepupBundle\Service\LoaResolutionService; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Exception\MissingRequiredAttributeException; use Surfnet\StepupRa\RaBundle\Exception\UserNotRaException; use Surfnet\StepupRa\RaBundle\Security\AuthenticatedIdentity; -use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; -use Symfony\Component\DependencyInjection\Attribute\AsAlias; -use Symfony\Component\DependencyInjection\Attribute\Autowire; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; @@ -50,7 +45,7 @@ public function __construct( private readonly ProfileService $profileService, private readonly AttributeDictionary $attributeDictionary, private readonly LoggerInterface $logger, - private readonly LoaResolutionService $loaResolutionService, + ) { } @@ -98,12 +93,7 @@ public function getUser(Assertion $assertion): UserInterface } } - $authenticatedIdentity = new AuthenticatedIdentity($identity, $roles); - $loa = $this->loaResolutionService->getLoa($assertion->getAuthnContextClassRef()); - $authenticatedToken = new SamlToken($loa, $roles); - $authenticatedToken->setUser($authenticatedIdentity); - - return $authenticatedIdentity; + return new AuthenticatedIdentity($identity, $roles); } private function getSingleStringValue(string $attributeName, AssertionAdapter $translatedAssertion): string @@ -145,11 +135,6 @@ private function getSingleStringValue(string $attributeName, AssertionAdapter $t return $value; } - public function supports(TokenInterface $token): bool - { - return $token instanceof SamlToken; - } - public function getNameId(Assertion $assertion): string { return $this->attributeDictionary->translate($assertion)->getNameID(); @@ -157,7 +142,6 @@ public function getNameId(Assertion $assertion): string public function refreshUser(UserInterface $user): UserInterface { - // TODO: Implement refreshUser() method. return $user; } From ea388e885d58f48851107ba13b4f3d33e17d5fa5 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 4 Mar 2024 13:27:52 +0100 Subject: [PATCH 108/202] Remove deprecated transchoice --- templates/ra_management/manage.html.twig | 2 +- templates/recovery_token/search.html.twig | 2 +- templates/second_factor/search.html.twig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/ra_management/manage.html.twig b/templates/ra_management/manage.html.twig index 12117892..2e9e46f6 100644 --- a/templates/ra_management/manage.html.twig +++ b/templates/ra_management/manage.html.twig @@ -7,7 +7,7 @@ {{ form(form) }} {% if raList|length > 0 %} -
{{ 'ra.management.search.text.number_results'|transchoice(numberOfResults, {'count': numberOfResults}) }}
+
{{ 'ra.management.search.text.number_results'|trans({'count': numberOfResults}) }}
{% endif %}
diff --git a/templates/recovery_token/search.html.twig b/templates/recovery_token/search.html.twig index 6c75aeb4..a7b99de6 100644 --- a/templates/recovery_token/search.html.twig +++ b/templates/recovery_token/search.html.twig @@ -8,7 +8,7 @@ {{ form(form) }} {% if recoveryTokens.elements|length > 0 %} -
{{ 'ra.recovery_token.search.text.number_of_recovery_tokens'|transchoice(numberOfRecoveryTokens, {'count': numberOfRecoveryTokens}) }}
+
{{ 'ra.recovery_token.search.text.number_of_recovery_tokens'|trans({'count': numberOfRecoveryTokens}) }}
{% endif %}
diff --git a/templates/second_factor/search.html.twig b/templates/second_factor/search.html.twig index c72e62dd..ada7f560 100644 --- a/templates/second_factor/search.html.twig +++ b/templates/second_factor/search.html.twig @@ -8,7 +8,7 @@ {{ form(form) }} {% if secondFactors.elements|length > 0 %} -
{{ 'ra.second_factor.search.text.number_of_second_factors'|transchoice(numberOfSecondFactors, {'count': numberOfSecondFactors}) }}
+
{{ 'ra.second_factor.search.text.number_of_second_factors'|trans({'count': numberOfSecondFactors}) }}
{% endif %}
From 133f90f6a5bab983d712912e466df57718e866c6 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 09:24:29 +0100 Subject: [PATCH 109/202] Add Loa to Authenticated Identity --- .../StepupRa/RaBundle/Security/AuthenticatedIdentity.php | 7 +++++++ .../Security/Authentication/Provider/SamlProvider.php | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php index 7f43c5bc..5443c83d 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php @@ -20,6 +20,7 @@ namespace Surfnet\StepupRa\RaBundle\Security; +use Surfnet\StepupBundle\Value\Loa; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Symfony\Component\Security\Core\User\UserInterface; @@ -27,6 +28,7 @@ class AuthenticatedIdentity implements UserInterface { public function __construct( private readonly Identity $originalIdentity, + private readonly Loa $loa, private readonly array $roles = [], ) { @@ -42,6 +44,11 @@ public function getUsername(): string return $this->originalIdentity->id ?: ''; } + public function getLoa(): Loa + { + return $this->loa; + } + public function getRoles(): array { $allRoles = $this->roles; diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php index c49bdf09..f4185a4b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php @@ -24,12 +24,14 @@ use Surfnet\SamlBundle\SAML2\Attribute\AttributeDictionary; use Surfnet\SamlBundle\SAML2\Response\AssertionAdapter; use Surfnet\SamlBundle\Security\Authentication\Provider\SamlProviderInterface; +use Surfnet\StepupBundle\Service\LoaResolutionService; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Exception\MissingRequiredAttributeException; use Surfnet\StepupRa\RaBundle\Exception\UserNotRaException; use Surfnet\StepupRa\RaBundle\Security\AuthenticatedIdentity; use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Surfnet\StepupRa\RaBundle\Service\ProfileService; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; @@ -41,11 +43,12 @@ class SamlProvider implements SamlProviderInterface, UserProviderInterface { public function __construct( + #[Autowire(service: 'ra.service.identity')] private readonly IdentityService $identityService, private readonly ProfileService $profileService, private readonly AttributeDictionary $attributeDictionary, private readonly LoggerInterface $logger, - + private readonly LoaResolutionService $loaResolutionService, ) { } @@ -93,7 +96,9 @@ public function getUser(Assertion $assertion): UserInterface } } - return new AuthenticatedIdentity($identity, $roles); + $loa = $this->loaResolutionService->getLoa($assertion->getAuthnContextClassRef()); + + return new AuthenticatedIdentity($identity, $loa, $roles); } private function getSingleStringValue(string $attributeName, AssertionAdapter $translatedAssertion): string From a02180d6d61a317a13fd9d57db00b8b442aab3a0 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 09:25:14 +0100 Subject: [PATCH 110/202] Get Loa from Authenticated Identity --- .../RaBundle/Controller/VettingController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php index 2917e348..9af70408 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -31,6 +31,8 @@ use Surfnet\StepupRa\RaBundle\Service\SecondFactorService; use Surfnet\StepupRa\RaBundle\Service\VettingService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Form\SubmitButton; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -52,6 +54,7 @@ public function __construct( private readonly SecondFactorTypeService $secondFactorTypeService, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator, + private readonly Security $security, ) { } @@ -82,7 +85,7 @@ public function startProcedure(Request $request): Response } $secondFactor = $this->secondFactorService - ->findVerifiedSecondFactorByRegistrationCode($command->registrationCode, $identity->id); + ->findVerifiedSecondFactorByRegistrationCode($command->registrationCode, $this->getUser()->getIdentity()->id); if (!$secondFactor instanceof VerifiedSecondFactor) { $this->addFlash('error', 'ra.form.start_vetting_procedure.unknown_registration_code'); @@ -91,7 +94,7 @@ public function startProcedure(Request $request): Response return $this->render('vetting/start_procedure.html.twig', ['form' => $form->createView()]); } - $enabledSecondFactors = $this->container->getParameter('surfnet_stepup_ra.enabled_second_factors'); + $enabledSecondFactors = $this->getParameter('surfnet_stepup_ra.enabled_second_factors'); if (!in_array($secondFactor->type, $enabledSecondFactors, true)) { $this->logger->warning( sprintf( @@ -109,10 +112,8 @@ public function startProcedure(Request $request): Response ->setStatusCode(Response::HTTP_BAD_REQUEST); } - /** @var SamlToken $token */ - $token = $this->container->get('security.token_storage')->getToken(); $command->authorityId = $this->getUser()->getIdentity()->id; - $command->authorityLoa = $token->getLoa(); + $command->authorityLoa = $this->getUser()->getLoa(); $command->secondFactor = $secondFactor; if ($this->vettingService->isExpiredRegistrationCode($command)) { From 2c835a68e79abe27ea812637f0371973846142ac Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 11:46:09 +0100 Subject: [PATCH 111/202] Get correct Identity --- src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php index dcea50c7..c5f59f62 100644 --- a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php +++ b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php @@ -41,7 +41,7 @@ public function setRequestLocale(RequestEvent $event): void } /** @var Identity $identity */ - $identity = $token->getUser(); + $identity = $token->getUser()->getIdentity(); if (!$identity instanceof Identity) { return; From 24f96bb646c1121cec6ccc8d8d0c6f3b57886363 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 11:47:16 +0100 Subject: [PATCH 112/202] Get correct Identity Service --- .../RaBundle/Controller/LocaleController.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php index 6fd36ca7..6d296353 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -21,21 +21,22 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Command\SwitchLocaleCommand; use Surfnet\StepupBundle\Form\Type\SwitchLocaleType; -use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; +use Surfnet\StepupRa\RaBundle\Service\IdentityService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Attribute\Route; -use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Contracts\Translation\TranslatorInterface; final class LocaleController extends AbstractController { public function __construct( private readonly LoggerInterface $logger, - private readonly UserProviderInterface $identityService, + #[Autowire(service: 'ra.service.identity')] + private readonly IdentityService $identityService, private readonly TranslatorInterface $translator, ) { } @@ -56,7 +57,7 @@ public function switchLocale(Request $request): RedirectResponse if (!str_starts_with((string) $returnUrl, $domain)) { $this->logger->error(sprintf( 'Identity "%s" used illegal return-url for redirection after changing locale, aborting request', - $this->getIdentity()->id, + $this->getUser()->getIdentity()->id, )); throw new BadRequestHttpException('Invalid return-url given'); @@ -64,7 +65,7 @@ public function switchLocale(Request $request): RedirectResponse $this->logger->info('Switching locale...'); - $identity = $this->getIdentity(); + $identity = $this->getUser()->getIdentity(); if (!$identity) { throw new AccessDeniedHttpException('Cannot switch locales when not authenticated'); } @@ -96,8 +97,4 @@ public function switchLocale(Request $request): RedirectResponse return $this->redirect($returnUrl); } - private function getIdentity(): Identity - { - return $this->container->get('security.token_storage')->getToken()->getUser(); - } } From 064f3ce5f7e02e9e104f4a6f3f9701cc24d9d527 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 12:23:22 +0100 Subject: [PATCH 113/202] Replaced vars --- translations/messages+intl-icu.en_GB.xliff | 28 +++++++++++----------- translations/messages+intl-icu.nl_NL.xliff | 28 +++++++++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/translations/messages+intl-icu.en_GB.xliff b/translations/messages+intl-icu.en_GB.xliff index 1cb4ea7a..38f73005 100644 --- a/translations/messages+intl-icu.en_GB.xliff +++ b/translations/messages+intl-icu.en_GB.xliff @@ -69,22 +69,22 @@
ra.auditlog.action.accredited_as_ra - Accredited as RA @ %ra_institution% + Accredited as RA @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.accredited_as_raa - Accredited as RAA @ %ra_institution% + Accredited as RAA @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_ra - Appointed as RA @ %ra_institution% + Appointed as RA @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_raa - Appointed as RAA @ %ra_institution% + Appointed as RAA @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -109,12 +109,12 @@ ra.auditlog.action.migrated_from - Migrated from %ra_institution% + Migrated from {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.migrated_to - Migrated to %ra_institution% + Migrated to {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -592,7 +592,7 @@ ra.institution_configuration.subtitle - Configuration of %name% + Configuration of {name} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/institution_configuration/overview.html.twig @@ -1089,7 +1089,7 @@ ra.ra_location.manage.subtitle - Locations of %name% + Locations of {name} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/manage.html.twig @@ -1246,7 +1246,7 @@ ra.registration.sms.text.otp_requests_remaining - Attempts remaining: %count% + Attempts remaining: {count} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/send_challenge.html.twig @@ -1428,7 +1428,7 @@ ra.verify_identity.registration_code_expired - The activation code has expired. First, delete the current token registration of the user (by RA or user). The user then starts a new registration on %self_service_url% and will receive a new activation code that is valid for 14 days. + The activation code has expired. First, delete the current token registration of the user (by RA or user). The user then starts a new registration on {self_service_url} and will receive a new activation code that is valid for 14 days. /src/../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php /src/../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -1487,7 +1487,7 @@ ra.vetting.second_factor_type_disabled.text.explanation - Tokens of type %token_name% cannot be vetted. This token type has been disabled. + Tokens of type {token_name} cannot be vetted. This token type has been disabled. /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/second_factor_type_disabled.html.twig @@ -1497,7 +1497,7 @@ ra.vetting.sms.challenge_body - Your code: %challenge% + Your code: {challenge} /src/../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -1604,7 +1604,7 @@ The token is now activated and ready to be used. ra.vetting_type_hint.subtitle - Activation help texts for %institution% + Activation help texts for {institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/vetting_type_hint/overview.html.twig @@ -1743,7 +1743,7 @@ The token is now activated and ready to be used. stepup.error.support_page.text - the support page if this does not fix your problem. On this page you will find more information about possible causes of the error and how to contact the support team.]]> + the support page if this does not fix your problem. On this page you will find more information about possible causes of the error and how to contact the support team.]]> /src/../vendor/surfnet/stepup-bundle/src/Resources/views/Exception/error404.html.twig diff --git a/translations/messages+intl-icu.nl_NL.xliff b/translations/messages+intl-icu.nl_NL.xliff index 5d9131ba..90008e84 100644 --- a/translations/messages+intl-icu.nl_NL.xliff +++ b/translations/messages+intl-icu.nl_NL.xliff @@ -69,22 +69,22 @@ ra.auditlog.action.accredited_as_ra - Geaccrediteerd als RA @ %ra_institution% + Geaccrediteerd als RA @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.accredited_as_raa - Geaccrediteerd als RAA @ %ra_institution% + Geaccrediteerd als RAA @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_ra - RA rol toegewezen gekregen @ %ra_institution% + RA rol toegewezen gekregen @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_raa - RAA rol toegewezen gekregen @ %ra_institution% + RAA rol toegewezen gekregen @ {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -109,12 +109,12 @@ ra.auditlog.action.migrated_from - Gemigreerd van %ra_institution% + Gemigreerd van {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.migrated_to - Gemigreerd naar %ra_institution% + Gemigreerd naar {ra_institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -592,7 +592,7 @@ ra.institution_configuration.subtitle - Configuratie van %name% + Configuratie van {name} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/institution_configuration/overview.html.twig @@ -1089,7 +1089,7 @@ ra.ra_location.manage.subtitle - Locaties van %name% + Locaties van {name} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/ra_location/manage.html.twig @@ -1246,7 +1246,7 @@ ra.registration.sms.text.otp_requests_remaining - Aantal resterende pogingen: %count% + Aantal resterende pogingen: {count} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/sms/send_challenge.html.twig @@ -1428,7 +1428,7 @@ ra.verify_identity.registration_code_expired - De activatie code is verlopen. Verwijder eerst de huidige token registratie (door RA of gebruiker). De gebruiker start vervolgens een nieuwe registratie via %self_service_url% en ontvangt een nieuwe activatiecode die weer 14 dagen geldig blijft. + De activatie code is verlopen. Verwijder eerst de huidige token registratie (door RA of gebruiker). De gebruiker start vervolgens een nieuwe registratie via {self_service_url} en ontvangt een nieuwe activatiecode die weer 14 dagen geldig blijft. /src/../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php /src/../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -1487,7 +1487,7 @@ ra.vetting.second_factor_type_disabled.text.explanation - Tokens van het type %token_name% kunnen niet geactiveerd worden. Dit tokentype is uitgeschakeld. + Tokens van het type {token_name} kunnen niet geactiveerd worden. Dit tokentype is uitgeschakeld. /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/vetting/second_factor_type_disabled.html.twig @@ -1497,7 +1497,7 @@ ra.vetting.sms.challenge_body - Je sms-code: %challenge% + Je sms-code: {challenge} /src/../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -1604,7 +1604,7 @@ Het token is nu geactiveerd en klaar voor gebruik. ra.vetting_type_hint.subtitle - Activatie hulpteksten voor %institution% + Activatie hulpteksten voor {institution} /src/../src/Surfnet/StepupRa/RaBundle/Resources/views/vetting_type_hint/overview.html.twig @@ -1743,7 +1743,7 @@ Het token is nu geactiveerd en klaar voor gebruik. stepup.error.support_page.text - de support pagina als dit je probleem niet oplost. Op deze pagina vind je meer informatie over de mogelijke oorzaken en hoe je contact kan opnemen met het supportteam.]]> + de support pagina als dit je probleem niet oplost. Op deze pagina vind je meer informatie over de mogelijke oorzaken en hoe je contact kan opnemen met het supportteam.]]> /src/../vendor/surfnet/stepup-bundle/src/Resources/views/Exception/error404.html.twig From 9bc78eaf2a0a54260962f68038c63a6ea985ec8b Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 12:24:02 +0100 Subject: [PATCH 114/202] Added helper methods to get internals of Identity --- .../RaBundle/Security/AuthenticatedIdentity.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php index 5443c83d..d9aef198 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php @@ -29,7 +29,7 @@ class AuthenticatedIdentity implements UserInterface public function __construct( private readonly Identity $originalIdentity, private readonly Loa $loa, - private readonly array $roles = [], + private readonly array $roles = [], ) { } @@ -39,11 +39,26 @@ public function getIdentity(): Identity return $this->originalIdentity; } + public function getId(): ?string + { + return $this->originalIdentity->id; + } + + public function getInstitution(): string + { + return $this->originalIdentity->institution; + } + public function getUsername(): string { return $this->originalIdentity->id ?: ''; } + public function getPreferredLocale(): string + { + return $this->originalIdentity->preferredLocale; + } + public function getLoa(): Loa { return $this->loa; From f106f372e7af648705f161f57e3a984b1a12ca5e Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 5 Mar 2024 12:34:24 +0100 Subject: [PATCH 115/202] Fix namespace --- templates/pagination/sliding.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/pagination/sliding.html.twig b/templates/pagination/sliding.html.twig index 14d17da3..f6394fca 100644 --- a/templates/pagination/sliding.html.twig +++ b/templates/pagination/sliding.html.twig @@ -1,5 +1,5 @@ {% if pageCount > 1 %} - {% set item = '@SurfnetStepupRaRa/pagination/sliding_item.html.twig' %} + {% set item = '@default/pagination/sliding_item.html.twig' %}
    {% include item with {name: 'first', From f43f2ddad99ed7fe4cd2ed688e05a24be4479262 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 11 Mar 2024 13:58:59 +0100 Subject: [PATCH 116/202] Fixed on behat runs --- ci/qa/phpstan.neon | 6 +- composer.json | 12 +- composer.lock | 917 ++++++------------ config/openconext/parameters.yaml.dist | 1 + config/services.yaml | 8 +- src/Kernel.php | 0 src/Surfnet/NoDebugFunctionRule.php | 0 src/Surfnet/StepupRa/RaBundle/Assert.php | 0 .../Command/AccreditCandidateCommand.php | 0 ...egistrationAuthorityInformationCommand.php | 0 .../Command/ChangeRaLocationCommand.php | 0 .../RaBundle/Command/ChangeRaRoleCommand.php | 0 .../Command/CreateRaLocationCommand.php | 0 .../Command/ExportRaSecondFactorsCommand.php | 0 .../Command/RemoveRaLocationCommand.php | 0 .../RetractRegistrationAuthorityCommand.php | 0 .../Command/RevokeRecoveryTokenCommand.php | 0 .../Command/RevokeSecondFactorCommand.php | 0 .../Command/SearchRaCandidatesCommand.php | 0 .../Command/SearchRaListingCommand.php | 0 .../Command/SearchRaLocationsCommand.php | 0 .../Command/SearchRaSecondFactorsCommand.php | 0 .../Command/SearchRecoveryTokensCommand.php | 0 .../SearchSecondFactorAuditLogCommand.php | 0 .../Command/SelectInstitutionCommand.php | 0 .../Command/StartVettingProcedureCommand.php | 0 .../Command/VerifyIdentityCommand.php | 0 .../Command/VerifyYubikeyOtpCommand.php | 0 .../Command/VerifyYubikeyPublicIdCommand.php | 0 .../Command/VettingTypeHintCommand.php | 0 .../Controller/ExceptionController.php | 0 .../RaBundle/Controller/LocaleController.php | 1 - .../RaBundle/Controller/ProfileController.php | 2 +- .../Controller/RaLocationController.php | 32 +- .../Controller/RaManagementController.php | 44 +- .../RaBundle/Controller/RaaController.php | 7 +- .../Controller/RecoveryTokenController.php | 19 +- .../RaBundle/Controller/SamlController.php | 2 +- .../Controller/SecondFactorController.php | 31 +- .../Controller/SecurityController.php | 0 .../Gssf/GssfAuthenticateController.php | 5 +- .../Vetting/Gssf/GssfInitiateFormService.php | 8 +- .../GssfInitiateVerificationController.php | 9 +- .../Vetting/Gssf/GssfMetadataController.php | 31 +- .../Vetting/Gssf/GssfVerifyController.php | 1 - .../Controller/Vetting/SmsController.php | 6 +- .../Controller/Vetting/YubikeyController.php | 4 +- .../RaBundle/Controller/VettingController.php | 18 +- .../Controller/VettingTypeHintController.php | 7 +- .../StepupRa/RaBundle/DateTime/DateTime.php | 0 .../DependencyInjection/Configuration.php | 0 .../SurfnetStepupRaRaExtension.php | 0 .../InconsistentStateListener.php | 0 .../RaBundle/EventListener/LocaleListener.php | 0 .../Exception/AssertionFailedException.php | 0 .../RaBundle/Exception/DomainException.php | 0 .../Exception/InconsistentStateException.php | 0 .../Exception/InvalidArgumentException.php | 0 .../RaBundle/Exception/LoaTooLowException.php | 0 .../RaBundle/Exception/LogicException.php | 0 .../MissingRequiredAttributeException.php | 0 .../RaBundle/Exception/RuntimeException.php | 0 .../Exception/UnexpectedIssuerException.php | 0 .../UnknownVettingProcedureException.php | 0 .../RaBundle/Exception/UserNotRaException.php | 0 .../Form/Extension/RaRoleChoiceList.php | 0 .../Extension/SecondFactorTypeChoiceList.php | 0 ...ndRegistrationAuthorityInformationType.php | 0 .../RaBundle/Form/Type/AnchorType.php | 0 .../RaBundle/Form/Type/ButtonGroupType.php | 0 .../Form/Type/ChangeRaLocationType.php | 0 .../RaBundle/Form/Type/ChangeRaRoleType.php | 0 .../Form/Type/CreateRaLocationType.php | 0 .../RaBundle/Form/Type/CreateRaType.php | 0 .../RaBundle/Form/Type/InitiateGssfType.php | 0 .../StepupRa/RaBundle/Form/Type/OtpType.php | 0 .../Form/Type/RemoveRaLocationType.php | 0 .../Type/RetractRegistrationAuthorityType.php | 0 .../Form/Type/RevokeRecoveryTokenType.php | 0 .../Form/Type/RevokeSecondFactorType.php | 0 .../Form/Type/RoleAtInstitutionType.php | 0 .../Form/Type/SearchRaCandidatesType.php | 0 .../Form/Type/SearchRaListingType.php | 0 .../Form/Type/SearchRaSecondFactorsType.php | 0 .../Form/Type/SearchRecoveryTokensType.php | 0 .../Form/Type/SelectInstitutionType.php | 0 .../Form/Type/SendSmsChallengeType.php | 0 .../Form/Type/StartVettingProcedureType.php | 0 .../RaBundle/Form/Type/VerifyIdentityType.php | 0 .../Form/Type/VerifyPhoneNumberType.php | 0 .../Form/Type/VerifyYubikeyPublicIdType.php | 0 .../Form/Type/VettingTypeHintType.php | 0 .../RaBundle/Logger/ProcedureAwareLogger.php | 0 .../SessionVettingProcedureRepository.php | 0 .../Repository/VettingProcedureRepository.php | 0 .../RaBundle/Resources/config/security.yml | 0 .../RaBundle/Resources/config/services.yml | 0 .../Security/AuthenticatedIdentity.php | 3 +- .../AuthenticatedSessionStateHandler.php | 0 .../Handler/AuthenticatedUserHandler.php | 0 .../Handler/AuthenticationHandler.php | 0 .../Handler/ExplicitSessionTimeoutHandler.php | 0 .../InitiateSamlAuthenticationHandler.php | 0 .../Handler/LogoutSuccessHandler.php | 0 .../Authentication/Provider/SamlProvider.php | 0 .../SamlAuthenticationStateHandler.php | 0 .../SamlInteractionProvider.php | 0 .../Session/SessionLifetimeGuard.php | 0 .../Authentication/Session/SessionStorage.php | 0 .../Authentication/Token/SamlToken.php | 0 .../RaBundle/Security/Factory/SamlFactory.php | 0 .../Security/Firewall/SamlListener.php | 0 .../RaBundle/Service/AuditLogService.php | 0 .../RaBundle/Service/CommandService.php | 2 +- .../RaBundle/Service/GlobalViewParameters.php | 0 .../Service/Gssf/VerificationResult.php | 0 .../StepupRa/RaBundle/Service/GssfService.php | 0 .../RaBundle/Service/IdentityService.php | 2 +- ...InstitutionConfigurationOptionsService.php | 0 ...onConfigurationOptionsServiceInterface.php | 0 .../Service/InstitutionListingService.php | 0 .../Service/LocaleProviderService.php | 0 .../RaBundle/Service/ProfileService.php | 0 .../RaBundle/Service/RaCandidateService.php | 0 .../RaBundle/Service/RaListingService.php | 0 .../RaBundle/Service/RaLocationService.php | 0 .../RaBundle/Service/RaSecondFactorExport.php | 0 .../Service/RaSecondFactorService.php | 0 .../StepupRa/RaBundle/Service/RaService.php | 0 .../RaBundle/Service/RecoveryTokenService.php | 0 .../Service/SecondFactorAssertionService.php | 0 .../RaBundle/Service/SecondFactorService.php | 0 .../RaBundle/Service/VettingService.php | 0 .../Service/VettingTypeHintService.php | 0 .../VerificationResult.php | 0 .../Service/YubikeySecondFactorService.php | 0 .../RaBundle/Service/YubikeyService.php | 0 .../Service/YubikeyVerificationResult.php | 0 .../RaBundle/SurfnetStepupRaRaBundle.php | 0 .../Command/VettingTypeHintCommandTest.php | 0 .../DependencyInjection/ConfigurationTest.php | 0 .../Authentication/Token/SamlTokenTest.php | 0 .../Security/Session/FakeRequestStack.php | 0 .../Tests/Security/Session/FakeSession.php | 0 .../Session/SessionLifetimeGuardTest.php | 0 .../Security/Session/SessionStorageTest.php | 0 .../SecondFactorAssertionServiceTest.php | 0 .../Tests/Service/VettingServiceTest.php | 0 .../TestDouble/Factory/GuzzleApiFactory.php | 0 .../RaBundle/Tests/Value/DateTimeTest.php | 0 .../RaBundle/Tests/Value/TimeFrameTest.php | 0 .../Extensions/Extension/SecondFactorType.php | 0 .../StepupRa/RaBundle/Value/DateTime.php | 0 .../RaBundle/Value/RoleAtInstitution.php | 0 .../StepupRa/RaBundle/Value/TimeFrame.php | 0 .../StepupRa/RaBundle/VettingProcedure.php | 0 .../Compiler/ViewConfigCollectionPass.php | 0 .../DependencyInjection/Configuration.php | 0 ...netStepupRaSamlStepupProviderExtension.php | 5 +- .../Exception/InvalidArgumentException.php | 0 .../InvalidConfigurationException.php | 0 .../MetadataFactoryNotFoundException.php | 0 .../Exception/RuntimeException.php | 0 .../Exception/UnknownProviderException.php | 0 .../Provider/Metadata.php | 0 .../Provider/MetadataFactoryCollection.php | 2 +- .../Provider/Provider.php | 0 .../Provider/ProviderRepository.php | 10 +- .../Provider/ViewConfig.php | 0 .../Resources/config/routing.yml | 0 .../Resources/config/services.yml | 0 .../Saml/StateHandler.php | 35 +- .../SessionFactoryWithAttributeBag.php | 52 + ...urfnetStepupRaSamlStepupProviderBundle.php | 0 .../MetadataFactoryCollectionTest.php | 0 .../Tests/Provider/ViewConfigTest.php | 0 symfony.lock | 9 - templates/base.html.twig | 8 +- templates/vetting/gssf/initiate.html.twig | 2 +- .../vetting/sms/prove_possession.html.twig | 2 +- .../vetting/sms/send_challenge.html.twig | 2 +- templates/vetting/yubikey/verify.html.twig | 2 +- 182 files changed, 518 insertions(+), 789 deletions(-) mode change 100644 => 100755 src/Kernel.php mode change 100644 => 100755 src/Surfnet/NoDebugFunctionRule.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Assert.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/ChangeRaRoleCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/CreateRaLocationCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/RemoveRaLocationCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/RetractRegistrationAuthorityCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/RevokeRecoveryTokenCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/RevokeSecondFactorCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SearchRaListingCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SearchRaLocationsCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SearchSecondFactorAuditLogCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/SelectInstitutionCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/VerifyYubikeyOtpCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/VerifyYubikeyPublicIdCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/DomainException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/InconsistentStateException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/LoaTooLowException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/LogicException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/MissingRequiredAttributeException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/RuntimeException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/UnexpectedIssuerException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/UnknownVettingProcedureException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/AuthenticatedSessionStateHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/CommandService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/GssfService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RaService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/VettingService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Command/VettingTypeHintCommandTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Value/DateTimeTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Value/DateTime.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php mode change 100644 => 100755 src/Surfnet/StepupRa/RaBundle/VettingProcedure.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidConfigurationException.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/RuntimeException.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/MetadataFactoryCollection.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/routing.yml mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php create mode 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Session/SessionFactoryWithAttributeBag.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php mode change 100644 => 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php diff --git a/ci/qa/phpstan.neon b/ci/qa/phpstan.neon index 309b30f3..ec5e3d11 100644 --- a/ci/qa/phpstan.neon +++ b/ci/qa/phpstan.neon @@ -2,8 +2,12 @@ includes: - ./phpstan-baseline.php - ../../vendor/phpstan/phpstan-symfony/extension.neon rules: - - Surfnet\NoDebugFunctionRule +# - Surfnet\NoDebugFunctionRule +# - Surfnet\InvokableControllerRule +# - Surfnet\UntypedIdParamRule + - Surfnet\NoNullOrArrayReturnRule parameters: + checkUninitializedProperties: true level: 9 paths: - ../../src diff --git a/composer.json b/composer.json index 44a74b64..dacd1f08 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,12 @@ ] }, "minimum-stability": "stable", + "repositories": [ + { + "url": "https://github.com/OpenConext/Stepup-saml-bundle", + "type": "git" + } + ], "require": { "php": "^8.2", "ext-dom": "*", @@ -24,8 +30,8 @@ "nelmio/security-bundle": "^3.0", "openconext/monitor-bundle": "^4.0", "surfnet/stepup-bundle": "^6.0", - "surfnet/stepup-middleware-client-bundle": "^5.0.0-beta", - "surfnet/stepup-saml-bundle": "^6.0", + "surfnet/stepup-middleware-client-bundle": "^5.0.0", + "surfnet/stepup-saml-bundle": "dev-feature/kill-off-travis as 6.0", "symfony/asset": "^6.0", "symfony/expression-language": "^6.0", "symfony/flex": "^v2.4.3", @@ -48,7 +54,7 @@ "mockery/mockery": "^1.0", "overtrue/phplint": "^9.0", "phpmd/phpmd": "^2.6", - "phpstan/extension-installer": "^1.3", + "phpstan/phpstan": "^1.10", "phpstan/phpstan-symfony": "^1.3", "phpunit/phpunit": "^9.5", "rector/rector": "^1.0", diff --git a/composer.lock b/composer.lock index 4c07092b..7de02d27 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8057d0f55e2a0dea356bebe5336b1e4e", + "content-hash": "75196b22ee808c16cb71eb57512d82df", "packages": [ { "name": "beberlei/assert", @@ -122,16 +122,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "b66d11b7479109ab547f9405b97205640b17d385" + "reference": "3ce240142f6d59b808dd65c1f52f7a1c252e6cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385", - "reference": "b66d11b7479109ab547f9405b97205640b17d385", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/3ce240142f6d59b808dd65c1f52f7a1c252e6cfd", + "reference": "3ce240142f6d59b808dd65c1f52f7a1c252e6cfd", "shasum": "" }, "require": { @@ -178,7 +178,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.4.0" + "source": "https://github.com/composer/ca-bundle/tree/1.4.1" }, "funding": [ { @@ -194,7 +194,7 @@ "type": "tidelift" } ], - "time": "2023-12-18T12:05:55+00:00" + "time": "2024-02-23T10:16:52+00:00" }, { "name": "doctrine/annotations", @@ -272,111 +272,18 @@ }, "time": "2023-02-02T22:02:53+00:00" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2022-05-20T20:07:39+00:00" - }, { "name": "doctrine/collections", - "version": "2.1.4", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "72328a11443a0de79967104ad36ba7b30bded134" + "reference": "07e16cd7b80a2cffed99e36b541876af172f0257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/72328a11443a0de79967104ad36ba7b30bded134", - "reference": "72328a11443a0de79967104ad36ba7b30bded134", + "url": "https://api.github.com/repos/doctrine/collections/zipball/07e16cd7b80a2cffed99e36b541876af172f0257", + "reference": "07e16cd7b80a2cffed99e36b541876af172f0257", "shasum": "" }, "require": { @@ -388,7 +295,7 @@ "ext-json": "*", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.5", "vimeo/psalm": "^5.11" }, "type": "library", @@ -433,7 +340,7 @@ ], "support": { "issues": "https://github.com/doctrine/collections/issues", - "source": "https://github.com/doctrine/collections/tree/2.1.4" + "source": "https://github.com/doctrine/collections/tree/2.2.0" }, "funding": [ { @@ -449,142 +356,46 @@ "type": "tidelift" } ], - "time": "2023-10-03T09:22:33+00:00" - }, - { - "name": "doctrine/common", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/8b5e5650391f851ed58910b3e3d48a71062eeced", - "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced", - "shasum": "" - }, - "require": { - "doctrine/persistence": "^2.0 || ^3.0", - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9.0 || ^10.0", - "doctrine/collections": "^1", - "phpstan/phpstan": "^1.4.1", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0", - "squizlabs/php_codesniffer": "^3.0", - "symfony/phpunit-bridge": "^6.1", - "vimeo/psalm": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.", - "homepage": "https://www.doctrine-project.org/projects/common.html", - "keywords": [ - "common", - "doctrine", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/common/issues", - "source": "https://github.com/doctrine/common/tree/3.4.3" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcommon", - "type": "tidelift" - } - ], - "time": "2022-10-09T11:47:59+00:00" + "time": "2024-02-25T22:55:36+00:00" }, { "name": "doctrine/dbal", - "version": "3.8.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "c9ea252cdce4da324ede3d6c5913dd89f769afd2" + "reference": "53df8c432978b716a805143eb701436d54ec705e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c9ea252cdce4da324ede3d6c5913dd89f769afd2", - "reference": "c9ea252cdce4da324ede3d6c5913dd89f769afd2", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/53df8c432978b716a805143eb701436d54ec705e", + "reference": "53df8c432978b716a805143eb701436d54ec705e", "shasum": "" }, "require": { - "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", - "doctrine/event-manager": "^1|^2", - "php": "^7.4 || ^8.0", + "php": "^8.1", "psr/cache": "^1|^2|^3", "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", - "jetbrains/phpstorm-stubs": "2023.1", + "jetbrains/phpstorm-stubs": "2023.2", "phpstan/phpstan": "1.10.57", + "phpstan/phpstan-phpunit": "1.3.15", "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.16", + "phpunit/phpunit": "10.5.9", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", "squizlabs/php_codesniffer": "3.8.1", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/console": "^4.4|^5.4|^6.0|^7.0", - "vimeo/psalm": "4.30.0" + "symfony/cache": "^6.3.8|^7.0", + "symfony/console": "^5.4|^6.3|^7.0", + "vimeo/psalm": "5.16.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "bin": [ - "bin/doctrine-dbal" - ], "type": "library", "autoload": { "psr-4": { @@ -637,7 +448,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.1" + "source": "https://github.com/doctrine/dbal/tree/4.0.0" }, "funding": [ { @@ -653,7 +464,7 @@ "type": "tidelift" } ], - "time": "2024-02-03T17:33:49+00:00" + "time": "2024-02-03T19:11:19+00:00" }, { "name": "doctrine/deprecations", @@ -795,16 +606,16 @@ }, { "name": "doctrine/inflector", - "version": "2.0.9", + "version": "2.0.10", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc", + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc", "shasum": "" }, "require": { @@ -866,7 +677,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.9" + "source": "https://github.com/doctrine/inflector/tree/2.0.10" }, "funding": [ { @@ -882,7 +693,7 @@ "type": "tidelift" } ], - "time": "2024-01-15T18:05:13+00:00" + "time": "2024-02-18T20:23:39+00:00" }, { "name": "doctrine/instantiator", @@ -1033,61 +844,48 @@ }, { "name": "doctrine/orm", - "version": "2.18.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b" + "reference": "2a250b5814de192a23438c0a43e15da7e77890a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/f2176a9ce56cafdfd1624d54bfdb076819083d5b", - "reference": "f2176a9ce56cafdfd1624d54bfdb076819083d5b", + "url": "https://api.github.com/repos/doctrine/orm/zipball/2a250b5814de192a23438c0a43e15da7e77890a7", + "reference": "2a250b5814de192a23438c0a43e15da7e77890a7", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/cache": "^1.12.1 || ^2.1.1", - "doctrine/collections": "^1.5 || ^2.1", - "doctrine/common": "^3.0.3", - "doctrine/dbal": "^2.13.1 || ^3.2", + "doctrine/collections": "^2.1", + "doctrine/dbal": "^3.8.2 || ^4", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3 || ^2", - "doctrine/lexer": "^2 || ^3", - "doctrine/persistence": "^2.4 || ^3", + "doctrine/lexer": "^3", + "doctrine/persistence": "^3.1.1", "ext-ctype": "*", - "php": "^7.1 || ^8.0", + "php": "^8.1", "psr/cache": "^1 || ^2 || ^3", - "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/polyfill-php72": "^1.23", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "doctrine/annotations": "<1.13 || >= 3.0" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/var-exporter": "~6.2.13 || ^6.3.2 || ^7.0" }, "require-dev": { - "doctrine/annotations": "^1.13 || ^2", - "doctrine/coding-standard": "^9.0.2 || ^12.0", - "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.35", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", + "doctrine/coding-standard": "^12.0", + "phpbench/phpbench": "^1.0", + "phpstan/phpstan": "1.10.35", + "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", - "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2 || ^7.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "vimeo/psalm": "4.30.0 || 5.16.0" + "symfony/cache": "^5.4 || ^6.2 || ^7.0", + "vimeo/psalm": "5.16.0" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", - "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", - "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0" }, - "bin": [ - "bin/doctrine" - ], "type": "library", "autoload": { "psr-4": { @@ -1128,9 +926,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.18.0" + "source": "https://github.com/doctrine/orm/tree/3.0.1" }, - "time": "2024-01-31T15:53:12+00:00" + "time": "2024-02-22T12:23:53+00:00" }, { "name": "doctrine/persistence", @@ -2088,16 +1886,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.0", + "version": "v5.0.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" + "reference": "2218c2252c874a4624ab2f613d86ac32d227bc69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69", + "reference": "2218c2252c874a4624ab2f613d86ac32d227bc69", "shasum": "" }, "require": { @@ -2140,26 +1938,26 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.1" }, - "time": "2024-01-07T17:17:35+00:00" + "time": "2024-02-21T19:24:10+00:00" }, { "name": "openconext/monitor-bundle", - "version": "4.1.0", + "version": "4.1.2", "source": { "type": "git", "url": "https://github.com/OpenConext/Monitor-bundle.git", - "reference": "e0231adc22d7ef9a08ae1b7ccc933261dfe013d5" + "reference": "9fad7f1c77c53fdc1fd4040a34ad4a4e0073f225" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Monitor-bundle/zipball/e0231adc22d7ef9a08ae1b7ccc933261dfe013d5", - "reference": "e0231adc22d7ef9a08ae1b7ccc933261dfe013d5", + "url": "https://api.github.com/repos/OpenConext/Monitor-bundle/zipball/9fad7f1c77c53fdc1fd4040a34ad4a4e0073f225", + "reference": "9fad7f1c77c53fdc1fd4040a34ad4a4e0073f225", "shasum": "" }, "require": { - "doctrine/orm": "^2.9", + "doctrine/orm": "^2.9|^3.0", "php": ">=8.2, <9.0-dev", "symfony/dependency-injection": "^5.4|^6.3|^7.0", "symfony/framework-bundle": "^5.4|^6.3|^7.0", @@ -2197,9 +1995,9 @@ ], "support": { "issues": "https://github.com/OpenConext/Monitor-bundle/issues", - "source": "https://github.com/OpenConext/Monitor-bundle/tree/4.1.0" + "source": "https://github.com/OpenConext/Monitor-bundle/tree/4.1.2" }, - "time": "2024-01-25T10:06:27+00:00" + "time": "2024-02-28T14:23:16+00:00" }, { "name": "psr/cache", @@ -2938,16 +2736,16 @@ }, { "name": "surfnet/stepup-bundle", - "version": "6.0.11", + "version": "6.0.13", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-bundle.git", - "reference": "f42f7de4fe444a713fbe3a74ff019a29a06c5adb" + "reference": "c555705d44d8a6c201adefb2e8f26cd61e2d9522" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-bundle/zipball/f42f7de4fe444a713fbe3a74ff019a29a06c5adb", - "reference": "f42f7de4fe444a713fbe3a74ff019a29a06c5adb", + "url": "https://api.github.com/repos/OpenConext/Stepup-bundle/zipball/c555705d44d8a6c201adefb2e8f26cd61e2d9522", + "reference": "c555705d44d8a6c201adefb2e8f26cd61e2d9522", "shasum": "" }, "require": { @@ -3003,22 +2801,22 @@ ], "support": { "issues": "https://github.com/OpenConext/Stepup-bundle/issues", - "source": "https://github.com/OpenConext/Stepup-bundle/tree/6.0.11" + "source": "https://github.com/OpenConext/Stepup-bundle/tree/6.0.13" }, - "time": "2024-01-23T17:33:14+00:00" + "time": "2024-02-28T14:43:12+00:00" }, { "name": "surfnet/stepup-middleware-client-bundle", - "version": "5.0.0-beta", + "version": "5.0.9", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-Middleware-clientbundle.git", - "reference": "60109c376b8442d11fc9647599cafa934ac00b73" + "reference": "b7538d336bc3cf6e0fa5ad90236495f6a03e6f95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-Middleware-clientbundle/zipball/60109c376b8442d11fc9647599cafa934ac00b73", - "reference": "60109c376b8442d11fc9647599cafa934ac00b73", + "url": "https://api.github.com/repos/OpenConext/Stepup-Middleware-clientbundle/zipball/b7538d336bc3cf6e0fa5ad90236495f6a03e6f95", + "reference": "b7538d336bc3cf6e0fa5ad90236495f6a03e6f95", "shasum": "" }, "require": { @@ -3062,23 +2860,17 @@ "description": "Symfony 5|6 bundle for consuming the Step-up Middleware API.", "support": { "issues": "https://github.com/OpenConext/Stepup-Middleware-clientbundle/issues", - "source": "https://github.com/OpenConext/Stepup-Middleware-clientbundle/tree/5.0.0-beta" + "source": "https://github.com/OpenConext/Stepup-Middleware-clientbundle/tree/5.0.9" }, - "time": "2023-12-19T10:31:50+00:00" + "time": "2024-03-07T14:37:21+00:00" }, { "name": "surfnet/stepup-saml-bundle", - "version": "6.0.17", + "version": "dev-feature/kill-off-travis", "source": { "type": "git", - "url": "https://github.com/OpenConext/Stepup-saml-bundle.git", - "reference": "d1ec60c2f50c0542d3026353176a2b389fe67239" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-saml-bundle/zipball/d1ec60c2f50c0542d3026353176a2b389fe67239", - "reference": "d1ec60c2f50c0542d3026353176a2b389fe67239", - "shasum": "" + "url": "https://github.com/OpenConext/Stepup-saml-bundle", + "reference": "d3c9ce75f25ba95b1267db4cbb5c7fe553200c01" }, "require": { "ext-dom": "*", @@ -3120,23 +2912,56 @@ "Surfnet\\SamlBundle\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "scripts": { + "check": [ + "@composer-validate", + "@phplint", + "@phpcpd", + "@phpcs", + "@phpmd", + "@phpstan", + "@test" + ], + "composer-validate": [ + "./ci/qa/validate" + ], + "phplint": [ + "./ci/qa/phplint" + ], + "phpcs": [ + "./ci/qa/phpcs" + ], + "phpcpd": [ + "./ci/qa/phpcpd" + ], + "phpmd": [ + "./ci/qa/phpmd" + ], + "phpstan": [ + "./ci/qa/phpstan" + ], + "phpstan-baseline": [ + "./ci/qa/phpstan-update-baseline" + ], + "test": [ + "./ci/qa/phpunit" + ], + "phpcbf": [ + "./ci/qa/phpcbf" + ] + }, "license": [ "Apache-2.0" ], "description": "A Symfony 6 bundle that integrates the simplesamlphp\\saml2 library with Symfony.", "keywords": [ + "SAML", "SAML2", - "saml", + "StepUp", "simplesamlphp", - "stepup", "surfnet" ], - "support": { - "issues": "https://github.com/OpenConext/Stepup-saml-bundle/issues", - "source": "https://github.com/OpenConext/Stepup-saml-bundle/tree/6.0.17" - }, - "time": "2024-01-23T16:56:47+00:00" + "time": "2024-02-28T10:22:25+00:00" }, { "name": "symfony/asset", @@ -3209,16 +3034,16 @@ }, { "name": "symfony/cache", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "49f8cdee544a621a621cd21b6cda32a38926d310" + "reference": "0ef36534694c572ff526d91c7181f3edede176e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/49f8cdee544a621a621cd21b6cda32a38926d310", - "reference": "49f8cdee544a621a621cd21b6cda32a38926d310", + "url": "https://api.github.com/repos/symfony/cache/zipball/0ef36534694c572ff526d91c7181f3edede176e7", + "reference": "0ef36534694c572ff526d91c7181f3edede176e7", "shasum": "" }, "require": { @@ -3285,7 +3110,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.3" + "source": "https://github.com/symfony/cache/tree/v6.4.4" }, "funding": [ { @@ -3301,7 +3126,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/cache-contracts", @@ -3455,16 +3280,16 @@ }, { "name": "symfony/config", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "206482ff3ed450495b1d5b7bad1bc3a852def96f" + "reference": "6ea4affc27f2086c9d16b92ab5429ce1e3c38047" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/206482ff3ed450495b1d5b7bad1bc3a852def96f", - "reference": "206482ff3ed450495b1d5b7bad1bc3a852def96f", + "url": "https://api.github.com/repos/symfony/config/zipball/6ea4affc27f2086c9d16b92ab5429ce1e3c38047", + "reference": "6ea4affc27f2086c9d16b92ab5429ce1e3c38047", "shasum": "" }, "require": { @@ -3510,7 +3335,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.4.3" + "source": "https://github.com/symfony/config/tree/v6.4.4" }, "funding": [ { @@ -3526,20 +3351,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T13:26:27+00:00" + "time": "2024-02-26T07:52:26+00:00" }, { "name": "symfony/console", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e" + "reference": "0d9e4eb5ad413075624378f474c4167ea202de78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", - "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", + "url": "https://api.github.com/repos/symfony/console/zipball/0d9e4eb5ad413075624378f474c4167ea202de78", + "reference": "0d9e4eb5ad413075624378f474c4167ea202de78", "shasum": "" }, "require": { @@ -3604,7 +3429,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.3" + "source": "https://github.com/symfony/console/tree/v6.4.4" }, "funding": [ { @@ -3620,20 +3445,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "6871811c5a5c5e180244ddb689746446db02c05b" + "reference": "6236e5e843cb763e9d0f74245678b994afea5363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6871811c5a5c5e180244ddb689746446db02c05b", - "reference": "6871811c5a5c5e180244ddb689746446db02c05b", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6236e5e843cb763e9d0f74245678b994afea5363", + "reference": "6236e5e843cb763e9d0f74245678b994afea5363", "shasum": "" }, "require": { @@ -3685,7 +3510,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.3" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.4" }, "funding": [ { @@ -3701,7 +3526,7 @@ "type": "tidelift" } ], - "time": "2024-01-30T08:32:12+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3772,16 +3597,16 @@ }, { "name": "symfony/error-handler", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "6dc3c76a278b77f01d864a6005d640822c6f26a6" + "reference": "c725219bdf2afc59423c32793d5019d2a904e13a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/6dc3c76a278b77f01d864a6005d640822c6f26a6", - "reference": "6dc3c76a278b77f01d864a6005d640822c6f26a6", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c725219bdf2afc59423c32793d5019d2a904e13a", + "reference": "c725219bdf2afc59423c32793d5019d2a904e13a", "shasum": "" }, "require": { @@ -3827,7 +3652,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.3" + "source": "https://github.com/symfony/error-handler/tree/v6.4.4" }, "funding": [ { @@ -3843,7 +3668,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:40:36+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/event-dispatcher", @@ -4259,16 +4084,16 @@ }, { "name": "symfony/form", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "dabf7e9375550aada8916ced1736d01c2e3debff" + "reference": "c72cf9aab0d6c6db64358f9dd0ab391c2cc6014a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/dabf7e9375550aada8916ced1736d01c2e3debff", - "reference": "dabf7e9375550aada8916ced1736d01c2e3debff", + "url": "https://api.github.com/repos/symfony/form/zipball/c72cf9aab0d6c6db64358f9dd0ab391c2cc6014a", + "reference": "c72cf9aab0d6c6db64358f9dd0ab391c2cc6014a", "shasum": "" }, "require": { @@ -4336,7 +4161,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v6.4.3" + "source": "https://github.com/symfony/form/tree/v6.4.4" }, "funding": [ { @@ -4352,20 +4177,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-12T11:14:32+00:00" }, { "name": "symfony/framework-bundle", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "fb413ac4483803954411966a39f3a9204835848e" + "reference": "c76d3881596860ead95f5444a5ce4414447f0067" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/fb413ac4483803954411966a39f3a9204835848e", - "reference": "fb413ac4483803954411966a39f3a9204835848e", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/c76d3881596860ead95f5444a5ce4414447f0067", + "reference": "c76d3881596860ead95f5444a5ce4414447f0067", "shasum": "" }, "require": { @@ -4404,7 +4229,7 @@ "symfony/mime": "<6.4", "symfony/property-access": "<5.4", "symfony/property-info": "<5.4", - "symfony/scheduler": "<6.4.3|>=7.0.0,<7.0.3", + "symfony/scheduler": "<6.4.4|>=7.0.0,<7.0.4", "symfony/security-core": "<5.4", "symfony/security-csrf": "<5.4", "symfony/serializer": "<6.4", @@ -4443,7 +4268,7 @@ "symfony/process": "^5.4|^6.0|^7.0", "symfony/property-info": "^5.4|^6.0|^7.0", "symfony/rate-limiter": "^5.4|^6.0|^7.0", - "symfony/scheduler": "^6.4.3|^7.0.3", + "symfony/scheduler": "^6.4.4|^7.0.4", "symfony/security-bundle": "^5.4|^6.0|^7.0", "symfony/semaphore": "^5.4|^6.0|^7.0", "symfony/serializer": "^6.4|^7.0", @@ -4456,7 +4281,7 @@ "symfony/web-link": "^5.4|^6.0|^7.0", "symfony/workflow": "^6.4|^7.0", "symfony/yaml": "^5.4|^6.0|^7.0", - "twig/twig": "^2.10|^3.0" + "twig/twig": "^2.10|^3.0.4" }, "type": "symfony-bundle", "autoload": { @@ -4484,7 +4309,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v6.4.3" + "source": "https://github.com/symfony/framework-bundle/tree/v6.4.4" }, "funding": [ { @@ -4500,20 +4325,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:02:55+00:00" + "time": "2024-02-22T22:50:59+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "5677bdf7cade4619cb17fc9e1e7b31ec392244a9" + "reference": "ebc713bc6e6f4b53f46539fc158be85dfcd77304" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5677bdf7cade4619cb17fc9e1e7b31ec392244a9", - "reference": "5677bdf7cade4619cb17fc9e1e7b31ec392244a9", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ebc713bc6e6f4b53f46539fc158be85dfcd77304", + "reference": "ebc713bc6e6f4b53f46539fc158be85dfcd77304", "shasum": "" }, "require": { @@ -4561,7 +4386,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.3" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.4" }, "funding": [ { @@ -4577,20 +4402,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-08T15:01:18+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "9c6ec4e543044f7568a53a76ab1484ecd30637a2" + "reference": "7a186f64a7f02787c04e8476538624d6aa888e42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9c6ec4e543044f7568a53a76ab1484ecd30637a2", - "reference": "9c6ec4e543044f7568a53a76ab1484ecd30637a2", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7a186f64a7f02787c04e8476538624d6aa888e42", + "reference": "7a186f64a7f02787c04e8476538624d6aa888e42", "shasum": "" }, "require": { @@ -4639,7 +4464,7 @@ "symfony/process": "^5.4|^6.0|^7.0", "symfony/property-access": "^5.4.5|^6.0.5|^7.0", "symfony/routing": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.3|^7.0", + "symfony/serializer": "^6.4.4|^7.0.4", "symfony/stopwatch": "^5.4|^6.0|^7.0", "symfony/translation": "^5.4|^6.0|^7.0", "symfony/translation-contracts": "^2.5|^3", @@ -4674,7 +4499,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.3" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.4" }, "funding": [ { @@ -4690,20 +4515,20 @@ "type": "tidelift" } ], - "time": "2024-01-31T07:21:29+00:00" + "time": "2024-02-27T06:32:13+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "1e1ec293f15dcc815146637ee9ee8a7f43642fa1" + "reference": "db7468152b27242f1a4d10fabe278a2cfaa4eac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/1e1ec293f15dcc815146637ee9ee8a7f43642fa1", - "reference": "1e1ec293f15dcc815146637ee9ee8a7f43642fa1", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/db7468152b27242f1a4d10fabe278a2cfaa4eac0", + "reference": "db7468152b27242f1a4d10fabe278a2cfaa4eac0", "shasum": "" }, "require": { @@ -4716,7 +4541,7 @@ "conflict": { "symfony/console": "<5.4", "symfony/http-foundation": "<5.4", - "symfony/security-core": "<6.0" + "symfony/security-core": "<5.4" }, "require-dev": { "symfony/console": "^5.4|^6.0|^7.0", @@ -4724,7 +4549,7 @@ "symfony/mailer": "^5.4|^6.0|^7.0", "symfony/messenger": "^5.4|^6.0|^7.0", "symfony/mime": "^5.4|^6.0|^7.0", - "symfony/security-core": "^6.0|^7.0", + "symfony/security-core": "^5.4|^6.0|^7.0", "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "symfony-bridge", @@ -4753,7 +4578,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v6.4.3" + "source": "https://github.com/symfony/monolog-bridge/tree/v6.4.4" }, "funding": [ { @@ -4769,7 +4594,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:01:07+00:00" + "time": "2024-02-01T11:49:25+00:00" }, { "name": "symfony/monolog-bundle", @@ -4921,16 +4746,16 @@ }, { "name": "symfony/password-hasher", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/password-hasher.git", - "reference": "5189cdfe89a9acb56cc6d6d7a5233bfb180c7268" + "reference": "114788555e6d768d25fffdbae618cee48cbcd112" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/password-hasher/zipball/5189cdfe89a9acb56cc6d6d7a5233bfb180c7268", - "reference": "5189cdfe89a9acb56cc6d6d7a5233bfb180c7268", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/114788555e6d768d25fffdbae618cee48cbcd112", + "reference": "114788555e6d768d25fffdbae618cee48cbcd112", "shasum": "" }, "require": { @@ -4973,7 +4798,7 @@ "password" ], "support": { - "source": "https://github.com/symfony/password-hasher/tree/v6.4.3" + "source": "https://github.com/symfony/password-hasher/tree/v6.4.4" }, "funding": [ { @@ -4989,7 +4814,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-12T11:14:32+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5393,79 +5218,6 @@ ], "time": "2024-01-29T20:11:03+00:00" }, - { - "name": "symfony/polyfill-php72", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.29.0", @@ -5625,16 +5377,16 @@ }, { "name": "symfony/property-access", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "dd22c9247a16c712bfa128b3c90ebdd505102778" + "reference": "c0664db266024013e31446dd690b6bfcf218ad93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/dd22c9247a16c712bfa128b3c90ebdd505102778", - "reference": "dd22c9247a16c712bfa128b3c90ebdd505102778", + "url": "https://api.github.com/repos/symfony/property-access/zipball/c0664db266024013e31446dd690b6bfcf218ad93", + "reference": "c0664db266024013e31446dd690b6bfcf218ad93", "shasum": "" }, "require": { @@ -5682,7 +5434,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v6.4.3" + "source": "https://github.com/symfony/property-access/tree/v6.4.4" }, "funding": [ { @@ -5698,7 +5450,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-16T13:31:43+00:00" }, { "name": "symfony/property-info", @@ -5947,16 +5699,16 @@ }, { "name": "symfony/security-bundle", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "a53a9e1f6695447ce613aa8c9c698cfd012bd2aa" + "reference": "dec0c2bbc3718e7afd5ddffb3679774aec60ad9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/a53a9e1f6695447ce613aa8c9c698cfd012bd2aa", - "reference": "a53a9e1f6695447ce613aa8c9c698cfd012bd2aa", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/dec0c2bbc3718e7afd5ddffb3679774aec60ad9a", + "reference": "dec0c2bbc3718e7afd5ddffb3679774aec60ad9a", "shasum": "" }, "require": { @@ -6039,7 +5791,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v6.4.3" + "source": "https://github.com/symfony/security-bundle/tree/v6.4.4" }, "funding": [ { @@ -6055,7 +5807,7 @@ "type": "tidelift" } ], - "time": "2024-01-28T15:49:46+00:00" + "time": "2024-02-15T11:23:52+00:00" }, { "name": "symfony/security-core", @@ -6213,16 +5965,16 @@ }, { "name": "symfony/security-http", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "d1962d08e02d620dccbaa28192498642500b5043" + "reference": "bf7548976c19ce751c95a3d012d0dcd27409e506" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/d1962d08e02d620dccbaa28192498642500b5043", - "reference": "d1962d08e02d620dccbaa28192498642500b5043", + "url": "https://api.github.com/repos/symfony/security-http/zipball/bf7548976c19ce751c95a3d012d0dcd27409e506", + "reference": "bf7548976c19ce751c95a3d012d0dcd27409e506", "shasum": "" }, "require": { @@ -6281,7 +6033,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v6.4.3" + "source": "https://github.com/symfony/security-http/tree/v6.4.4" }, "funding": [ { @@ -6297,7 +6049,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-26T07:52:26+00:00" }, { "name": "symfony/service-contracts", @@ -6383,16 +6135,16 @@ }, { "name": "symfony/string", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7a14736fb179876575464e4658fce0c304e8c15b" + "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7a14736fb179876575464e4658fce0c304e8c15b", - "reference": "7a14736fb179876575464e4658fce0c304e8c15b", + "url": "https://api.github.com/repos/symfony/string/zipball/4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", + "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", "shasum": "" }, "require": { @@ -6449,7 +6201,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.3" + "source": "https://github.com/symfony/string/tree/v6.4.4" }, "funding": [ { @@ -6465,7 +6217,7 @@ "type": "tidelift" } ], - "time": "2024-01-25T09:26:29+00:00" + "time": "2024-02-01T13:16:41+00:00" }, { "name": "symfony/templating", @@ -6535,16 +6287,16 @@ }, { "name": "symfony/translation", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "637c51191b6b184184bbf98937702bcf554f7d04" + "reference": "bce6a5a78e94566641b2594d17e48b0da3184a8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/637c51191b6b184184bbf98937702bcf554f7d04", - "reference": "637c51191b6b184184bbf98937702bcf554f7d04", + "url": "https://api.github.com/repos/symfony/translation/zipball/bce6a5a78e94566641b2594d17e48b0da3184a8e", + "reference": "bce6a5a78e94566641b2594d17e48b0da3184a8e", "shasum": "" }, "require": { @@ -6610,7 +6362,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.3" + "source": "https://github.com/symfony/translation/tree/v6.4.4" }, "funding": [ { @@ -6626,7 +6378,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T13:11:52+00:00" + "time": "2024-02-20T13:16:58+00:00" }, { "name": "symfony/translation-contracts", @@ -6708,16 +6460,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "bf6b411a5d9a0ce6ea43cca0fcf5f05f5196a957" + "reference": "256f330026d1c97187b61aa5c29e529499877f13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/bf6b411a5d9a0ce6ea43cca0fcf5f05f5196a957", - "reference": "bf6b411a5d9a0ce6ea43cca0fcf5f05f5196a957", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/256f330026d1c97187b61aa5c29e529499877f13", + "reference": "256f330026d1c97187b61aa5c29e529499877f13", "shasum": "" }, "require": { @@ -6797,7 +6549,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v6.4.3" + "source": "https://github.com/symfony/twig-bridge/tree/v6.4.4" }, "funding": [ { @@ -6813,20 +6565,20 @@ "type": "tidelift" } ], - "time": "2024-01-30T08:32:12+00:00" + "time": "2024-02-15T11:26:02+00:00" }, { "name": "symfony/twig-bundle", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "2e63e50de2ade430191af0b5d21bfd6526fe3709" + "reference": "f60ba43a09d88395d05797af982588b57331ff4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/2e63e50de2ade430191af0b5d21bfd6526fe3709", - "reference": "2e63e50de2ade430191af0b5d21bfd6526fe3709", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/f60ba43a09d88395d05797af982588b57331ff4d", + "reference": "f60ba43a09d88395d05797af982588b57331ff4d", "shasum": "" }, "require": { @@ -6881,7 +6633,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v6.4.3" + "source": "https://github.com/symfony/twig-bundle/tree/v6.4.4" }, "funding": [ { @@ -6897,20 +6649,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-15T11:23:52+00:00" }, { "name": "symfony/validator", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "9c1d8bb4edce5304fcefca7923741085f1ca5b60" + "reference": "1cf92edc9a94d16275efef949fa6748d11cc8f47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/9c1d8bb4edce5304fcefca7923741085f1ca5b60", - "reference": "9c1d8bb4edce5304fcefca7923741085f1ca5b60", + "url": "https://api.github.com/repos/symfony/validator/zipball/1cf92edc9a94d16275efef949fa6748d11cc8f47", + "reference": "1cf92edc9a94d16275efef949fa6748d11cc8f47", "shasum": "" }, "require": { @@ -6977,7 +6729,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.3" + "source": "https://github.com/symfony/validator/tree/v6.4.4" }, "funding": [ { @@ -6993,20 +6745,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:01:07+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "0435a08f69125535336177c29d56af3abc1f69da" + "reference": "b439823f04c98b84d4366c79507e9da6230944b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0435a08f69125535336177c29d56af3abc1f69da", - "reference": "0435a08f69125535336177c29d56af3abc1f69da", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b439823f04c98b84d4366c79507e9da6230944b1", + "reference": "b439823f04c98b84d4366c79507e9da6230944b1", "shasum": "" }, "require": { @@ -7062,7 +6814,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.3" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.4" }, "funding": [ { @@ -7078,20 +6830,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:53:30+00:00" + "time": "2024-02-15T11:23:52+00:00" }, { "name": "symfony/var-exporter", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "a8c12b5448a5ac685347f5eeb2abf6a571ec16b8" + "reference": "0bd342e24aef49fc82a21bd4eedd3e665d177e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/a8c12b5448a5ac685347f5eeb2abf6a571ec16b8", - "reference": "a8c12b5448a5ac685347f5eeb2abf6a571ec16b8", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/0bd342e24aef49fc82a21bd4eedd3e665d177e5b", + "reference": "0bd342e24aef49fc82a21bd4eedd3e665d177e5b", "shasum": "" }, "require": { @@ -7137,7 +6889,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.3" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.4" }, "funding": [ { @@ -7153,7 +6905,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-26T08:37:45+00:00" }, { "name": "symfony/webpack-encore-bundle", @@ -8438,62 +8190,18 @@ ], "time": "2023-12-11T08:22:20+00:00" }, - { - "name": "phpstan/extension-installer", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/extension-installer.git", - "reference": "f45734bfb9984c6c56c4486b71230355f066a58a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f45734bfb9984c6c56c4486b71230355f066a58a", - "reference": "f45734bfb9984c6c56c4486b71230355f066a58a", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^2.0", - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0" - }, - "require-dev": { - "composer/composer": "^2.0", - "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" - }, - "type": "composer-plugin", - "extra": { - "class": "PHPStan\\ExtensionInstaller\\Plugin" - }, - "autoload": { - "psr-4": { - "PHPStan\\ExtensionInstaller\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Composer plugin for automatic installation of PHPStan extensions", - "support": { - "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.3.1" - }, - "time": "2023-05-24T08:59:17+00:00" - }, { "name": "phpstan/phpdoc-parser", - "version": "1.25.0", + "version": "1.26.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", "shasum": "" }, "require": { @@ -8525,22 +8233,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" }, - "time": "2024-01-04T17:06:16+00:00" + "time": "2024-02-23T16:05:55+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.57", + "version": "1.10.59", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + "reference": "e607609388d3a6d418a50a49f7940e8086798281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", + "reference": "e607609388d3a6d418a50a49f7940e8086798281", "shasum": "" }, "require": { @@ -8589,7 +8297,7 @@ "type": "tidelift" } ], - "time": "2024-01-24T11:51:34+00:00" + "time": "2024-02-20T13:59:13+00:00" }, { "name": "phpstan/phpstan-symfony", @@ -8984,16 +8692,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.16", + "version": "9.6.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f" + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f", - "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", "shasum": "" }, "require": { @@ -9067,7 +8775,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" }, "funding": [ { @@ -9083,25 +8791,25 @@ "type": "tidelift" } ], - "time": "2024-01-19T07:03:14+00:00" + "time": "2024-02-23T13:14:51+00:00" }, { "name": "rector/rector", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6" + "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/362258a1f6369fc88d02d469a5478d220f78b0e6", - "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/258b775511e62a7188f8ce114d44acaf244d9a7d", + "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.56" + "phpstan/phpstan": "^1.10.57" }, "conflict": { "rector/rector-doctrine": "*", @@ -9131,7 +8839,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.0" + "source": "https://github.com/rectorphp/rector/tree/1.0.1" }, "funding": [ { @@ -9139,7 +8847,7 @@ "type": "github" } ], - "time": "2024-02-06T13:38:07+00:00" + "time": "2024-02-16T07:53:23+00:00" }, { "name": "sebastian/cli-parser", @@ -10172,16 +9880,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -10248,7 +9956,7 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-02-16T15:06:51+00:00" }, { "name": "symfony/dotenv", @@ -10323,16 +10031,16 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.54.0", + "version": "v1.55.1", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "a8523cf35d777bf2d8cf5703fa73f378fdc27125" + "reference": "11a9d3125c5b93ab4043f0f2e9927fdc55881c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/a8523cf35d777bf2d8cf5703fa73f378fdc27125", - "reference": "a8523cf35d777bf2d8cf5703fa73f378fdc27125", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/11a9d3125c5b93ab4043f0f2e9927fdc55881c17", + "reference": "11a9d3125c5b93ab4043f0f2e9927fdc55881c17", "shasum": "" }, "require": { @@ -10395,7 +10103,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.54.0" + "source": "https://github.com/symfony/maker-bundle/tree/v1.55.1" }, "funding": [ { @@ -10411,20 +10119,20 @@ "type": "tidelift" } ], - "time": "2024-02-06T21:23:55+00:00" + "time": "2024-02-21T13:41:51+00:00" }, { "name": "symfony/phpunit-bridge", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "d49b4f6dc4690cf2c194311bb498abf0cf4f7485" + "reference": "16ed5bdfd18e14fc7de347c8688e8ac479284222" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/d49b4f6dc4690cf2c194311bb498abf0cf4f7485", - "reference": "d49b4f6dc4690cf2c194311bb498abf0cf4f7485", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/16ed5bdfd18e14fc7de347c8688e8ac479284222", + "reference": "16ed5bdfd18e14fc7de347c8688e8ac479284222", "shasum": "" }, "require": { @@ -10476,7 +10184,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v6.4.3" + "source": "https://github.com/symfony/phpunit-bridge/tree/v6.4.4" }, "funding": [ { @@ -10492,20 +10200,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-08T14:08:19+00:00" }, { "name": "symfony/process", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "31642b0818bfcff85930344ef93193f8c607e0a3" + "reference": "710e27879e9be3395de2b98da3f52a946039f297" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/31642b0818bfcff85930344ef93193f8c607e0a3", - "reference": "31642b0818bfcff85930344ef93193f8c607e0a3", + "url": "https://api.github.com/repos/symfony/process/zipball/710e27879e9be3395de2b98da3f52a946039f297", + "reference": "710e27879e9be3395de2b98da3f52a946039f297", "shasum": "" }, "require": { @@ -10537,7 +10245,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.3" + "source": "https://github.com/symfony/process/tree/v6.4.4" }, "funding": [ { @@ -10553,7 +10261,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-20T12:31:00+00:00" }, { "name": "symfony/stopwatch", @@ -10619,16 +10327,16 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "e78f98da7b4f842bab89368d53c962f5b2f9e49c" + "reference": "a69d7124bfb2e15638ba0a1be94f0845d8d05ee4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/e78f98da7b4f842bab89368d53c962f5b2f9e49c", - "reference": "e78f98da7b4f842bab89368d53c962f5b2f9e49c", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/a69d7124bfb2e15638ba0a1be94f0845d8d05ee4", + "reference": "a69d7124bfb2e15638ba0a1be94f0845d8d05ee4", "shasum": "" }, "require": { @@ -10681,7 +10389,7 @@ "dev" ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.3" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.4" }, "funding": [ { @@ -10697,7 +10405,7 @@ "type": "tidelift" } ], - "time": "2024-01-28T15:49:46+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "theseer/tokenizer", @@ -10750,10 +10458,17 @@ "time": "2023-11-20T00:12:19+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "surfnet/stepup-saml-bundle", + "version": "dev-feature/kill-off-travis", + "alias": "6.0", + "alias_normalized": "6.0.0.0" + } + ], "minimum-stability": "stable", "stability-flags": { - "surfnet/stepup-middleware-client-bundle": 10 + "surfnet/stepup-saml-bundle": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/config/openconext/parameters.yaml.dist b/config/openconext/parameters.yaml.dist index 3634d111..4051dc31 100644 --- a/config/openconext/parameters.yaml.dist +++ b/config/openconext/parameters.yaml.dist @@ -40,6 +40,7 @@ parameters: saml_remote_idp_sso_url: https://gateway.dev.openconext.local/authentication/single-sign-on saml_remote_idp_certificate: 'MIIDwTCCAqmgAwIBAgIUYuSUugwc4J4NyW9WGqYJ/liwM4owDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCTkwxEDAOBgNVBAgMB1V0cmVjaHQxEDAOBgNVBAcMB1V0cmVjaHQxJzAlBgNVBAoMHkRldmVsb3BtZW50IERvY2tlciBlbnZpcm9ubWVudDEUMBIGA1UEAwwLR2F0ZXdheSBJRFAwHhcNMjMwNTE3MTIxNTEyWhcNMzMwNTE0MTIxNTEyWjBwMQswCQYDVQQGEwJOTDEQMA4GA1UECAwHVXRyZWNodDEQMA4GA1UEBwwHVXRyZWNodDEnMCUGA1UECgweRGV2ZWxvcG1lbnQgRG9ja2VyIGVudmlyb25tZW50MRQwEgYDVQQDDAtHYXRld2F5IElEUDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM2ulQVs5WpbJOAf7Cv/VPDTJqbWHVdUxAmdwZJlcNTRKNFVp4aJzQ3dpiyiGghI5odnzU0/BWBoHZFNYPU/OFr/gzn6iJGxL63L9+mFgE8PR9HpkV5TaRnr21+nZ0EXWjDZk9Px0enERicCItTeQzAUJeA0A9miIcK5IKIz/zSBSR3c802SGD/VelUqY7Z2/UJM97cT92L+4Fz+4zhxxoThbPbrR0CweiROIt82grdwg7zf0+b62MOuVtqFh0yPLRAFfLc4LjHuxFUdUvOHVta7x74dwdmHikqfujM10XN+sNns3LDJde2yPWchU6ktq7cjgbYfIW/vzVzafP1Jk40CAwEAAaNTMFEwHQYDVR0OBBYEFGYn6LWRDZa7+YryUncIlwJB2VorMB8GA1UdIwQYMBaAFGYn6LWRDZa7+YryUncIlwJB2VorMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJ57lcOF6PWWW56mS2s5gKFImtfRFzlfiyHsF14L7+nQ5NjfOhpU0wRpnTjK91KP0wCwlxzGFXR8yfqfBFJryIV7aDdYPH/RIkwVaNBI0fsD/ozlYb18seieDEGLvQtTlrmc0UNHtWz6FW3L2geM3ENaqpOATl1Ywp4EPML7Dh0CbhhyM8PnPCEsdclouIeP5/B9Swfk3omXehof6bkFbntqA03msFBiW50twkfKeKULcJGXo667hto27KNxZUauqtPbnAGpUQmge8nxSQlN8RPwlvygVM4LVMF9qP9YxloTH0xVNwN4noZUhfMNsKoJ7Hg5Xulaok8oCqmzEiSroEg=' loa_required_for_login: 'http://dev.openconext.local/assurance/loa3' + authentication_context_class_ref: ~ enabled_second_factors: - sms - yubikey diff --git a/config/services.yaml b/config/services.yaml index 0f8b1e0d..20b7547c 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -25,12 +25,16 @@ services: surfnet_saml.saml_provider: class: Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider - arguments: - $identityService: '@ra.service.identity' +# arguments: +# $identityService: '@ra.service.identity' Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider: alias: surfnet_saml.saml_provider + Surfnet\StepupRa\SamlStepupProviderBundle\Session\SessionFactoryWithAttributeBag: + decorates: session.factory + arguments: [ '@.inner' ] + ra.service.gssf: class: Surfnet\StepupRa\RaBundle\Service\GssfService arguments: diff --git a/src/Kernel.php b/src/Kernel.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/NoDebugFunctionRule.php b/src/Surfnet/NoDebugFunctionRule.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Assert.php b/src/Surfnet/StepupRa/RaBundle/Assert.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaRoleCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ChangeRaRoleCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/CreateRaLocationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/CreateRaLocationCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/RemoveRaLocationCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/RemoveRaLocationCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/RetractRegistrationAuthorityCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/RetractRegistrationAuthorityCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/RevokeRecoveryTokenCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/RevokeRecoveryTokenCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/RevokeSecondFactorCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/RevokeSecondFactorCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaListingCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaListingCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaLocationsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaLocationsCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRecoveryTokensCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchSecondFactorAuditLogCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchSecondFactorAuditLogCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SelectInstitutionCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SelectInstitutionCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VerifyYubikeyOtpCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VerifyYubikeyOtpCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VerifyYubikeyPublicIdCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VerifyYubikeyPublicIdCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php old mode 100644 new mode 100755 index 6d296353..764bad59 --- a/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php @@ -96,5 +96,4 @@ public function switchLocale(Request $request): RedirectResponse return $this->redirect($returnUrl); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php old mode 100644 new mode 100755 index 6475f71a..ebc54cd4 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php @@ -41,7 +41,7 @@ public function profile(): Response { $this->logger->notice('Opening profile page'); - $identity = $this->getUser(); + $identity = $this->getUser()->getIdentity(); $profile = $this->profileService->findByIdentityId($identity->id); return $this->render('profile/profile.html.twig', ['profile' => $profile]); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php old mode 100644 new mode 100755 index b07d3dcd..764efc5e --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php @@ -38,6 +38,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -56,13 +57,12 @@ public function __construct( } #[Route('/locations', name: 'ra_locations_manage', methods: ['GET', 'POST'])] + #[IsGranted('ROLE_RA')] public function manage(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - $institutionParameter = $request->get('institution'); - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $this->logger->notice('Starting search for locations'); $profile = $this->profileService->findByIdentityId($identity->id); @@ -118,14 +118,13 @@ public function manage(Request $request): Response ]); } - #[Route('/locations/create/{institution}', name: 'ra_locations_create', methods: ['GET', 'POST'])] + #[Route('/locations/create/{institution}', name: 'ra_location_create', methods: ['GET', 'POST'])] + #[IsGranted('ROLE_RA')] public function create(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - $institution = $request->get('institution'); - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $command = new CreateRaLocationCommand(); $command->institution = $institution; $command->currentUserId = $identity->id; @@ -158,13 +157,12 @@ public function create(Request $request): Response #[Route( path: '/locations/{locationId}/change', - name: 'ra_locations_change', + name: 'ra_location_change', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function change(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - $requestedLocationId = $request->get('locationId'); $raLocation = $this->raLocationService->find($requestedLocationId); @@ -173,7 +171,7 @@ public function change(Request $request): Response throw new NotFoundHttpException(); } - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $command = new ChangeRaLocationCommand(); $command->institution = $raLocation->institution; @@ -209,15 +207,14 @@ public function change(Request $request): Response ]); } - #[Route('/locations/remove', name: 'ra_locations_remove', methods: ['POST'])] + #[Route('/locations/remove', name: 'ra_location_remove', methods: ['POST'])] + #[IsGranted('ROLE_RA')] public function remove(Request $request): RedirectResponse { - $this->denyAccessUnlessGranted('ROLE_RA'); - $this->logger->notice('Received request to remove RA location'); $command = new RemoveRaLocationCommand(); - $command->currentUserId = $this->getCurrentUser()->id; + $command->currentUserId = $this->getUser()->getIdentity()->id; $form = $this->createForm(RemoveRaLocationType::class, $command); $form->handleRequest($request); @@ -241,9 +238,4 @@ public function remove(Request $request): RedirectResponse return $this->redirectToRoute('ra_locations_manage', ['institution' => $command->institution]); } - - private function getCurrentUser(): Identity - { - return $this->container->get('security.token_storage')->getToken()->getUser(); - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php old mode 100644 new mode 100755 index 5737f89f..32045931 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -42,6 +42,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -64,15 +65,13 @@ public function __construct( name: 'ra_management_manage', methods: ['GET'], )] + #[IsGranted('ROLE_RAA')] public function manage(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - - $institution = $this->getUser()->institution; + $institution = $this->getUser()->getInstitution(); $this->logger->notice(sprintf('Loading overview of RA(A)s for institution "%s"', $institution)); - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $command = new SearchRaListingCommand(); $command->actorId = $identity->id; @@ -121,12 +120,10 @@ public function manage(Request $request): Response name: 'ra_management_ra_candidate_search', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RAA')] public function raCandidateSearch(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $institution = $identity->institution; $this->logger->notice(sprintf('Searching for RaCandidates within institution "%s"', $institution)); @@ -177,17 +174,15 @@ public function raCandidateSearch(Request $request): Response name: 'ra_management_create_ra', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RAA')] public function createRa(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - $this->logger->notice('Page for Accreditation of Identity to Ra or Raa requested'); $identityId = $request->get('identityId'); - $raCandidate = $this->raCandidateService->getRaCandidate($identityId, $this->getUser()->id); + $raCandidate = $this->raCandidateService->getRaCandidate($identityId, $this->getUser()->getIdentity()->id); - if (!$raCandidate->raCandidate) { + if (! isset($raCandidate->raCandidate)) { $this->logger->warning(sprintf('RaCandidate based on identity "%s" not found', $identityId)); throw new NotFoundHttpException(); } @@ -199,7 +194,7 @@ public function createRa(Request $request): Response $command->identityId = $identityId; $command->institution = $raCandidate->raCandidate->institution; $command->roleAtInstitution = new RoleAtInstitution(); - $command->roleAtInstitution->setInstitution($this->getUser()->institution); + $command->roleAtInstitution->setInstitution($this->getUser()->getIdentity()->institution); $command->availableInstitutions = $selectOptions; $form = $this->createForm(CreateRaType::class, $command)->handleRequest($request); @@ -237,14 +232,12 @@ public function createRa(Request $request): Response name: 'ra_management_amend_ra_information', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RAA')] public function amendRaInformation(Request $request, $identityId, $raInstitution): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - $this->logger->notice(sprintf("Loading information amendment form for RA(A) '%s'", $identityId)); - $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->id); + $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->getIdentity()->id); if (!$raListing) { $this->logger->warning(sprintf("RA listing for identity ID '%s' not found", $identityId)); @@ -287,16 +280,14 @@ public function amendRaInformation(Request $request, $identityId, $raInstitution name: 'ra_management_retract_registration_authority', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RAA')] public function retractRegistrationAuthority(Request $request, $identityId, $raInstitution): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - $this->logger->notice(sprintf("Loading retract registration authority form for RA(A) '%s'", $identityId)); - $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->id); + $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->getIdentity()->id); if (!$raListing) { - $this->logger->warning(sprintf("RA listing for identity ID '%s@%s' not found", $identityId, $this->getUser()->institution)); + $this->logger->warning(sprintf("RA listing for identity ID '%s@%s' not found", $identityId, $this->getUser()->getIdentity()->institution)); throw new NotFoundHttpException(sprintf("RA listing for identity ID '%s' not found", $identityId)); } @@ -332,9 +323,4 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI 'form' => $form->createView() ]); } - - private function getCurrentUser(): Identity - { - return $this->container->get('security.token_storage')->getToken()->getUser(); - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php old mode 100644 new mode 100755 index 8e27b673..fb2fe7e4 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php @@ -30,6 +30,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; class RaaController extends AbstractController { @@ -46,13 +47,11 @@ public function __construct( name: 'institution-configuration', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RAA')] public function institutionConfiguration(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - /** @var Identity $identity */ - $identity = $this->getUser(); + $identity = $this->getUser()->getIdentity(); $profile = $this->profileService->findByIdentityId($identity->id); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php old mode 100644 new mode 100755 index c9350225..01ece4f4 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php @@ -32,13 +32,13 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Http\Attribute\IsGranted; final class RecoveryTokenController extends AbstractController { public function __construct( private readonly RecoveryTokenService $recoveryTokenService, private readonly PaginatorInterface $paginator, - private readonly TokenStorageInterface $tokenStorage, private readonly LoggerInterface $logger, ) { } @@ -48,11 +48,10 @@ public function __construct( name: 'ra_recovery_tokens_search', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function search(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $this->logger->notice('Starting search for recovery tokens'); $command = new SearchRecoveryTokensCommand(); @@ -107,14 +106,13 @@ public function search(Request $request): Response name: 'ra_recovery_tokens_revoke', methods: ['POST'], )] + #[IsGranted('ROLE_RA')] public function revoke(Request $request): RedirectResponse { - $this->denyAccessUnlessGranted('ROLE_RA'); - $this->logger->notice('Received request to revoke recovery token'); $command = new RevokeRecoveryTokenCommand(); - $command->currentUserId = $this->getCurrentUser()->id; + $command->currentUserId = $this->getUser()->getIdentity()->id; $form = $this->createForm(RevokeRecoveryTokenType::class, $command); $form->handleRequest($request); @@ -138,11 +136,4 @@ public function revoke(Request $request): RedirectResponse return $this->redirectToRoute('ra_recovery_tokens_search'); } - - private function getCurrentUser(): Identity - { - /** @var Identity $identity */ - $identity = $this->tokenStorage->getToken()->getUser(); - return $identity; - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php old mode 100644 new mode 100755 index 5f34b739..692ff70e --- a/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SamlController.php @@ -41,7 +41,7 @@ public function __construct( #[Route( path: '/authentication/consume-assertion', name: 'ra_serviceprovider_consume_assertion', - methods: ['POST'] + methods: ['POST'], )] public function consumeAssertion(Request $httpRequest): Response { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php old mode 100644 new mode 100755 index c17afb09..943f61a8 --- a/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php @@ -20,7 +20,6 @@ use Knp\Component\Pager\PaginatorInterface; use Psr\Log\LoggerInterface; -use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupRa\RaBundle\Command\ExportRaSecondFactorsCommand; use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; use Surfnet\StepupRa\RaBundle\Command\SearchRaSecondFactorsCommand; @@ -30,12 +29,14 @@ use Surfnet\StepupRa\RaBundle\Service\AuditLogService; use Surfnet\StepupRa\RaBundle\Service\RaSecondFactorService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -48,6 +49,7 @@ public function __construct( private readonly PaginatorInterface $paginator, private readonly LoggerInterface $logger, private readonly RaSecondFactorService $secondFactorService, + #[Autowire(service: 'ra.service.identity')] private readonly UserProviderInterface $identityService, private readonly AuditLogService $auditLogService, private readonly TranslatorInterface $translator, @@ -59,11 +61,10 @@ public function __construct( name: 'ra_second_factors_search', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function search(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - - $identity = $this->getCurrentUser(); + $identity = $this->getUser()->getIdentity(); $this->logger->notice('Starting search for second factors'); $command = new SearchRaSecondFactorsCommand(); @@ -117,10 +118,9 @@ public function search(Request $request): Response ]); } + #[IsGranted('ROLE_RAA')] public function export(SearchRaSecondFactorsCommand $command): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->logger->notice('Starting export of searched second factors'); $exportCommand = ExportRaSecondFactorsCommand::fromSearchCommand($command); @@ -130,17 +130,16 @@ public function export(SearchRaSecondFactorsCommand $command): Response #[Route( path: '/second-factors/revoke', - name: 'ra_second_factors_revoke', + name: 'ra_second_factor_revoke', methods: ['POST'], )] + #[IsGranted('ROLE_RA')] public function revoke(Request $request): RedirectResponse { - $this->denyAccessUnlessGranted('ROLE_RA'); - $this->logger->notice('Received request to revoke Second Factor'); $command = new RevokeSecondFactorCommand(); - $command->currentUserId = $this->getCurrentUser()->id; + $command->currentUserId = $this->getUser()->getIdentity()->id; $form = $this->createForm(RevokeSecondFactorType::class, $command); $form->handleRequest($request); @@ -167,7 +166,7 @@ public function revoke(Request $request): RedirectResponse #[Route( path: '/second-factors/{identityId}/auditlog', - name: 'ra_second_factors_auditlog', + name: 'ra_second_factor_auditlog', methods: ['GET'], )] #[Route( @@ -175,10 +174,9 @@ public function revoke(Request $request): RedirectResponse name: 'ra_recovery_tokens_auditlog', methods: ['GET'], )] + #[IsGranted('ROLE_RA')] public function auditLog(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - $identityId = $request->get('identityId'); $this->logger->notice(sprintf('Requested AuditLog for SecondFactors of identity "%s"', $identityId)); @@ -187,7 +185,7 @@ public function auditLog(Request $request): Response if (!$identity) { $this->logger->notice(sprintf( 'User with Identity "%s" requested non-existent identity "%s"', - $this->getCurrentUser()->id, + $this->getUser()->getIdentity()->id, $identityId, )); @@ -222,9 +220,4 @@ public function auditLog(Request $request): Response ], ); } - - private function getCurrentUser(): Identity - { - return $this->container->get('security.token_storage')->getToken()->getUser(); - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php b/src/Surfnet/StepupRa/RaBundle/Controller/SecurityController.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php old mode 100644 new mode 100755 index 6cf5b5cd..cdc5b877 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfAuthenticateController.php @@ -28,6 +28,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; /** * Orchestrates verification of GSSFs (Generic SAML Second Factors) through GSSPs (Generic SAML Stepup Providers). @@ -49,12 +50,11 @@ public function __construct( name: 'ra_vetting_gssf_authenticate', methods: ['POST'], )] + #[IsGranted('ROLE_RA')] public function __invoke(string $procedureId, string $provider): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); - $this->denyAccessUnlessGranted('ROLE_RA'); - $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); $procedureLogger->notice('Generating GSSF verification request', ['provider' => $provider]); @@ -89,5 +89,4 @@ public function __invoke(string $procedureId, string $provider): Response return $this->redirectBinding->createResponseFor($authnRequest); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php old mode 100644 new mode 100755 index 438120dd..48d18326 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateFormService.php @@ -20,6 +20,7 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting\Gssf; +use JMS\TranslationBundle\Annotation\Ignore; use Surfnet\StepupBundle\Value\Provider\ViewConfigCollection; use Surfnet\StepupRa\RaBundle\Form\Type\InitiateGssfType; use Symfony\Component\Form\FormFactoryInterface; @@ -62,10 +63,9 @@ public function renderInitiateForm(string $procedureId, string $providerName, ar return new Response( $this->twig->render( - 'vetting/gssf/initiate.html.twig', - $templateParameters - ) + '@default/vetting/gssf/initiate.html.twig', + $templateParameters, + ), ); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php old mode 100644 new mode 100755 index 3aecc38e..d176819e --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfInitiateVerificationController.php @@ -26,6 +26,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; /** * Orchestrates verification of GSSFs (Generic SAML Second Factors) through GSSPs (Generic SAML Stepup Providers). @@ -50,12 +51,11 @@ public function __construct( name: 'ra_vetting_gssf_initiate', methods: ['GET'], )] - public function initiate(string $procedureId, string $provider): Response + #[IsGranted('ROLE_RA')] + public function __invoke(string $procedureId, string $provider): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); - $this->denyAccessUnlessGranted('ROLE_RA'); - $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); $procedureLogger->notice('Showing Initiate GSSF Verification Screen', ['provider' => $provider]); @@ -66,8 +66,7 @@ public function initiate(string $procedureId, string $provider): Response return $this->gssfInitiateFormService->renderInitiateForm( procedureId: $procedureId, - providerName: $this->providerRepository->get($provider)->getName() + providerName: $this->providerRepository->get($provider)->getName(), ); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php old mode 100644 new mode 100755 index 88d1dea7..92fcec8e --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfMetadataController.php @@ -18,26 +18,22 @@ namespace Surfnet\StepupRa\RaBundle\Controller\Vetting\Gssf; -use Psr\Log\LoggerInterface; use Surfnet\SamlBundle\Http\XMLResponse; -use Surfnet\SamlBundle\Metadata\MetadataFactory; use Surfnet\StepupRa\RaBundle\Service\SecondFactorAssertionService; -use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\Provider; +use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\MetadataFactoryCollection; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; /** * Orchestrates verification of GSSFs (Generic SAML Second Factors) through GSSPs (Generic SAML Stepup Providers). - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ final class GssfMetadataController extends AbstractController { public function __construct( private readonly ProviderRepository $providerRepository, - private readonly LoggerInterface $logger, private readonly SecondFactorAssertionService $secondFactorAssertionService, + private readonly MetadataFactoryCollection $metadataFactoryCollection, ) { } @@ -46,29 +42,14 @@ public function __construct( name: 'ra_vetting_gssf_metadata', methods: ['GET'], )] - public function metadata(string $provider): XMLResponse + public function __invoke(string $providerName): XMLResponse { - $this->secondFactorAssertionService->assertSecondFactorEnabled($provider); + $this->secondFactorAssertionService->assertSecondFactorEnabled($providerName); - $provider = $this->getProvider($provider); + $provider = $this->providerRepository->get($providerName); - /** @var MetadataFactory $factory */ - $factory = $this->container->get('gssp.provider.' . $provider->getName() . '.metadata.factory'); + $factory = $this->metadataFactoryCollection->getByIdentifier($provider->getName()); return new XMLResponse($factory->generate()); } - - /** - * @throws NotFoundHttpException - */ - private function getProvider(string $provider): Provider - { - if (!$this->providerRepository->has($provider)) { - $this->logger->info(sprintf('Requested GSSP "%s" does not exist or is not registered', $provider)); - - throw new NotFoundHttpException('Requested provider does not exist'); - } - - return $this->providerRepository->get($provider); - } } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php old mode 100644 new mode 100755 index d1f5319f..1f1f7bab --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php @@ -125,5 +125,4 @@ public function __invoke(Request $httpRequest, string $provider): Response ['gssfIdMismatch' => true], ); } - } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php old mode 100644 new mode 100755 index 3b630690..7643c19d --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -35,6 +35,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -55,12 +56,11 @@ public function __construct( name: 'ra_vetting_sms_send_challenge', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function sendChallenge(Request $request, string $procedureId): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled('sms'); - $this->denyAccessUnlessGranted('ROLE_RA'); - $logger = $this->procedureAwareLogger->forProcedure($procedureId); $logger->notice('Received request for Send SMS Challenge page'); @@ -128,10 +128,10 @@ public function sendChallenge(Request $request, string $procedureId): Response name: 'ra_vetting_sms_prove_possession', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function provePossession(Request $request, string $procedureId): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled('sms'); - $this->denyAccessUnlessGranted('ROLE_RA'); $logger = $this->procedureAwareLogger->forProcedure($procedureId); $logger->notice('Received request for Proof of Possession of SMS Second Factor page'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php old mode 100644 new mode 100755 index 73f4a680..87c1142d --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/YubikeyController.php @@ -31,6 +31,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; class YubikeyController extends AbstractController { @@ -46,12 +47,11 @@ public function __construct( name: 'ra_vetting_yubikey_verify', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function __invoke(Request $request, string $procedureId): Response { $this->secondFactorAssertionService->assertSecondFactorEnabled('yubikey'); - $this->denyAccessUnlessGranted('ROLE_RA'); - $procedureLogger = $this->procedureAwareLogger->forProcedure($procedureId); $procedureLogger->notice('Requested Yubikey Verfication'); diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php old mode 100644 new mode 100755 index 9af70408..d832045f --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php @@ -27,6 +27,7 @@ use Surfnet\StepupRa\RaBundle\Exception\RuntimeException; use Surfnet\StepupRa\RaBundle\Form\Type\StartVettingProcedureType; use Surfnet\StepupRa\RaBundle\Form\Type\VerifyIdentityType; +use Surfnet\StepupRa\RaBundle\Logger\ProcedureAwareLogger; use Surfnet\StepupRa\RaBundle\Security\Authentication\Token\SamlToken; use Surfnet\StepupRa\RaBundle\Service\SecondFactorService; use Surfnet\StepupRa\RaBundle\Service\VettingService; @@ -39,6 +40,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\VerifiedSecondFactor; @@ -54,7 +56,7 @@ public function __construct( private readonly SecondFactorTypeService $secondFactorTypeService, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator, - private readonly Security $security, + private readonly ProcedureAwareLogger $procedureAwareLogger, ) { } @@ -68,10 +70,9 @@ public function __construct( name: 'ra_vetting_search', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function startProcedure(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - $this->logger->notice('Vetting Procedure Search started'); $command = new StartVettingProcedureCommand(); @@ -146,12 +147,12 @@ public function startProcedure(Request $request): Response $procedureId = $this->vettingService->startProcedure($command); - $this->container->get('ra.procedure_logger') + $this->procedureAwareLogger ->forProcedure($procedureId) ->notice(sprintf('Starting new Vetting Procedure for second factor of type "%s"', $secondFactor->type)); if ($this->vettingService->isProvePossessionSkippable($procedureId)) { - $this->container->get('ra.procedure_logger') + $this->procedureAwareLogger ->forProcedure($procedureId) ->notice(sprintf('Vetting Procedure for second factor of type "%s" skips the possession proven step', $secondFactor->type)); @@ -185,7 +186,7 @@ public function startProcedure(Request $request): Response )] public function cancelProcedure($procedureId): RedirectResponse { - $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->procedureAwareLogger->forProcedure($procedureId); if (!$this->vettingService->hasProcedure($procedureId)) { $logger->notice(sprintf('Vetting procedure "%s" not found', $procedureId)); @@ -207,11 +208,10 @@ public function cancelProcedure($procedureId): RedirectResponse name: 'ra_vetting_verify_identity', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RA')] public function verifyIdentity(Request $request, string $procedureId): Response { - $this->denyAccessUnlessGranted('ROLE_RA'); - - $logger = $this->container->get('ra.procedure_logger')->forProcedure($procedureId); + $logger = $this->procedureAwareLogger->forProcedure($procedureId); $logger->notice('Verify Identity Form requested'); if (!$this->vettingService->hasProcedure($procedureId)) { diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php old mode 100644 new mode 100755 index 888e83e0..e0dad1a2 --- a/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php @@ -31,6 +31,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Http\Attribute\IsGranted; class VettingTypeHintController extends AbstractController { @@ -56,13 +57,11 @@ public function __construct( name: 'vetting_type_hint', methods: ['GET', 'POST'], )] + #[IsGranted('ROLE_RAA')] public function vettingTypeHint(Request $request): Response { - $this->denyAccessUnlessGranted('ROLE_RAA'); - $this->denyAccessUnlessGranted('ROLE_SRAA'); - /** @var Identity $identity */ - $identity = $this->getUser(); + $identity = $this->getUser()->getIdentity(); $profile = $this->profileService->findByIdentityId($identity->id); diff --git a/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php b/src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/SurfnetStepupRaRaExtension.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/InconsistentStateListener.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php b/src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php b/src/Surfnet/StepupRa/RaBundle/Exception/AssertionFailedException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/DomainException.php b/src/Surfnet/StepupRa/RaBundle/Exception/DomainException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/InconsistentStateException.php b/src/Surfnet/StepupRa/RaBundle/Exception/InconsistentStateException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/LoaTooLowException.php b/src/Surfnet/StepupRa/RaBundle/Exception/LoaTooLowException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/LogicException.php b/src/Surfnet/StepupRa/RaBundle/Exception/LogicException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/MissingRequiredAttributeException.php b/src/Surfnet/StepupRa/RaBundle/Exception/MissingRequiredAttributeException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/RuntimeException.php b/src/Surfnet/StepupRa/RaBundle/Exception/RuntimeException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/UnexpectedIssuerException.php b/src/Surfnet/StepupRa/RaBundle/Exception/UnexpectedIssuerException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/UnknownVettingProcedureException.php b/src/Surfnet/StepupRa/RaBundle/Exception/UnknownVettingProcedureException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php b/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/RaRoleChoiceList.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/AnchorType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ButtonGroupType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/InitiateGssfType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/OtpType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeRecoveryTokenType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RoleAtInstitutionType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaCandidatesType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaListingType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRecoveryTokensType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SelectInstitutionType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php b/src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/SessionVettingProcedureRepository.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php b/src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php old mode 100644 new mode 100755 index d9aef198..bc395cae --- a/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php @@ -30,8 +30,7 @@ public function __construct( private readonly Identity $originalIdentity, private readonly Loa $loa, private readonly array $roles = [], - ) - { + ) { } public function getIdentity(): Identity diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/AuthenticatedSessionStateHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/AuthenticatedSessionStateHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlAuthenticationStateHandler.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/SamlInteractionProvider.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionLifetimeGuard.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php b/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php b/src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php old mode 100644 new mode 100755 index 7dbbfd69..875f72e5 --- a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php @@ -36,7 +36,7 @@ public function __construct( public function execute(Command $command): ExecutionResult { /** @var Identity $identity */ - $identity = $this->tokenStorage->getToken()->getUser(); + $identity = $this->tokenStorage->getToken()->getUser()->getIdentity(); return $this->commandService->execute($command, new Metadata($identity->id, $identity->institution)); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php b/src/Surfnet/StepupRa/RaBundle/Service/GlobalViewParameters.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php old mode 100644 new mode 100755 index 20f3ea72..d43ff5ba --- a/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php @@ -130,7 +130,7 @@ public function switchLocale(SwitchLocaleCommand $command): bool } /** @var Identity $identity */ - $identity = $token->getUser(); + $identity = $token->getUser()->getIdentity(); $expressLocalePreferenceCommand = new ExpressLocalePreferenceCommand(); $expressLocalePreferenceCommand->identityId = $command->identityId; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionListingService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php b/src/Surfnet/StepupRa/RaBundle/Service/LocaleProviderService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php b/src/Surfnet/StepupRa/RaBundle/Service/ProfileService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaCandidateService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaListingService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaLocationService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorExport.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaSecondFactorService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php b/src/Surfnet/StepupRa/RaBundle/Service/RecoveryTokenService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingTypeHintService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactor/VerificationResult.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyVerificationResult.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php b/src/Surfnet/StepupRa/RaBundle/SurfnetStepupRaRaBundle.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Command/VettingTypeHintCommandTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Command/VettingTypeHintCommandTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/DependencyInjection/ConfigurationTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeRequestStack.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionLifetimeGuardTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/SessionStorageTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Service/SecondFactorAssertionServiceTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Service/VettingServiceTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php b/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Factory/GuzzleApiFactory.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Value/DateTimeTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Value/DateTimeTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Value/TimeFrameTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php b/src/Surfnet/StepupRa/RaBundle/VettingProcedure.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php old mode 100644 new mode 100755 index 2bc19491..22062abd --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -173,9 +173,8 @@ private function buildHostedEntityDefinition($provider, array $configuration, ar private function createRemoteDefinition( string $provider, array $configuration, - ContainerBuilder $container - ): void - { + ContainerBuilder $container, + ): void { $definition = new Definition(IdentityProvider::class, [ [ 'entityId' => $configuration['entity_id'], diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidArgumentException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidConfigurationException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/InvalidConfigurationException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/MetadataFactoryNotFoundException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/RuntimeException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/RuntimeException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/MetadataFactoryCollection.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/MetadataFactoryCollection.php old mode 100644 new mode 100755 index fc8129ef..ed6c199c --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/MetadataFactoryCollection.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/MetadataFactoryCollection.php @@ -34,7 +34,7 @@ public function getByIdentifier(string $provider): MetadataFactory { if (!$this->has($provider)) { throw new MetadataFactoryNotFoundException( - message: "The provider {$provider} does not exist in the collection" + message: "The provider {$provider} does not exist in the collection", ); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Provider.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php old mode 100644 new mode 100755 index 47d90227..9e967f38 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ProviderRepository.php @@ -27,7 +27,7 @@ final class ProviderRepository { - public function __construct(private LoggerInterface $logger) + public function __construct(private readonly LoggerInterface $logger) { } @@ -62,4 +62,12 @@ public function get(string $providerName): Provider return $this->providers[$providerName]; } + + /** + * @return array + */ + public function getAll(): array + { + return $this->providers; + } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/routing.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/routing.yml old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php old mode 100644 new mode 100755 index a7555a54..ca40f44b --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php @@ -1,5 +1,7 @@ set('request_id', $originalRequestId); + $this->set(self::REQUEST_ID, $originalRequestId); return $this; } public function getRequestId(): ?string { - return $this->get('request_id'); + return $this->get(self::REQUEST_ID); } public function clear(): void { - $this->attributeBag->remove($this->provider); + $session = $this->requestStack->getSession(); + + $session->getBag('gssp.provider.' . $this->provider)->clear(); + + $this->requestStack->getSession()->remove($this->provider); } - protected function set($key, $value): void + protected function set(string $key, $value): void { - $this->attributeBag->set($this->provider . '/' . $key, $value); + $session = $this->requestStack->getSession(); + $session->getBag('gssp.provider.' . $this->provider)->set($key, $value); } - protected function get($key) + protected function get(string $key) { - return $this->attributeBag->get($this->provider . '/' . $key); + $session = $this->requestStack->getSession(); + return $session->getBag('gssp.provider.' . $this->provider)->get($key); } } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Session/SessionFactoryWithAttributeBag.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Session/SessionFactoryWithAttributeBag.php new file mode 100755 index 00000000..a2b1877e --- /dev/null +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Session/SessionFactoryWithAttributeBag.php @@ -0,0 +1,52 @@ +delegate->createSession(); + + foreach ($this->providerRepository->getAll() as $provider) { + $bag = new AttributeBag('gssp.provider.' . $provider->getName()); + $bag->setName('gssp.provider.' . $provider->getName()); + $session->registerBag($bag); + } + + return $session; + } +} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/MetadataFactoryCollectionTest.php old mode 100644 new mode 100755 diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php old mode 100644 new mode 100755 diff --git a/symfony.lock b/symfony.lock index 34042d4a..3a88f1ef 100644 --- a/symfony.lock +++ b/symfony.lock @@ -26,15 +26,9 @@ "config/routes/annotations.yaml" ] }, - "doctrine/cache": { - "version": "2.2.0" - }, "doctrine/collections": { "version": "1.6.8" }, - "doctrine/common": { - "version": "3.3.0" - }, "doctrine/dbal": { "version": "2.13.8" }, @@ -442,9 +436,6 @@ "symfony/polyfill-mbstring": { "version": "v1.17.1" }, - "symfony/polyfill-php72": { - "version": "v1.17.0" - }, "symfony/polyfill-php80": { "version": "v1.17.1" }, diff --git a/templates/base.html.twig b/templates/base.html.twig index ab6ec9b2..eb26aca8 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -65,25 +65,25 @@ - {% if is_granted('ROLE_RAA') or is_granted('ROLE_SRAA') %} + {% if is_granted('ROLE_RAA') %} {% endif %} - {% if is_granted('ROLE_RAA') or is_granted('ROLE_SRAA') %} + {% if is_granted('ROLE_RAA') %} {% endif %} - {% if is_granted('ROLE_RAA') or is_granted('ROLE_SRAA') %} + {% if is_granted('ROLE_RAA') %} {% endif %} - {% if is_granted('ROLE_RAA') or is_granted('ROLE_SRAA') %} + {% if is_granted('ROLE_RAA') %} diff --git a/templates/vetting/gssf/initiate.html.twig b/templates/vetting/gssf/initiate.html.twig index 2eff98ae..a4e1e10e 100644 --- a/templates/vetting/gssf/initiate.html.twig +++ b/templates/vetting/gssf/initiate.html.twig @@ -1,4 +1,4 @@ -{% extends "../../base.html.twig" %} +{% extends "base.html.twig" %} {% block page_title %}{{ secondFactorConfig.getPageTitle() }}{% endblock %} diff --git a/templates/vetting/sms/prove_possession.html.twig b/templates/vetting/sms/prove_possession.html.twig index c9a29b46..5e67e299 100644 --- a/templates/vetting/sms/prove_possession.html.twig +++ b/templates/vetting/sms/prove_possession.html.twig @@ -1,4 +1,4 @@ -{% extends "../../base.html.twig" %} +{% extends "base.html.twig" %} {% block page_title %}{{ 'ra.vetting.sms.prove_possession.title.page'|trans }}{% endblock %} diff --git a/templates/vetting/sms/send_challenge.html.twig b/templates/vetting/sms/send_challenge.html.twig index c9616eb6..62fea23e 100644 --- a/templates/vetting/sms/send_challenge.html.twig +++ b/templates/vetting/sms/send_challenge.html.twig @@ -1,4 +1,4 @@ -{% extends "../../base.html.twig" %} +{% extends "base.html.twig" %} {% block page_title %}{{ 'ra.vetting.sms.send_challenge.title.page'|trans }}{% endblock %} diff --git a/templates/vetting/yubikey/verify.html.twig b/templates/vetting/yubikey/verify.html.twig index d3671f76..b9b0831c 100644 --- a/templates/vetting/yubikey/verify.html.twig +++ b/templates/vetting/yubikey/verify.html.twig @@ -1,4 +1,4 @@ -{% extends "../../base.html.twig" %} +{% extends "base.html.twig" %} {% block page_title %}{{ 'ra.registration.yubikey.title.enter_challenge'|trans }}{% endblock %} From 0ee8647755594de13d3f3737e8a0ec0046b249c0 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 11 Mar 2024 15:37:39 +0100 Subject: [PATCH 117/202] Fix flashbag --- templates/base.html.twig | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/templates/base.html.twig b/templates/base.html.twig index eb26aca8..a8743ad3 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -112,18 +112,28 @@ {% endblock page_header %} {% block form_errors %} - {% if app.session.flashbag.peekAll|length > 0 %} -
    -
    - {% for type, flashes in app.session.flashbag.all %} - {% for flash in flashes %} -
    - {{ flash|trans }} -
    + {# + The check is needed to prevent starting the session when looking for "flash messages": + https://symfony.com/doc/current/session.html#avoid-starting-sessions-for-anonymous-users + + TIP: With FOSHttpCache you can also adapt this to make it cache safe: + https://foshttpcachebundle.readthedocs.io/en/latest/features/helpers/flash-message.html + #} + {% if app.request.hasPreviousSession %} + {% set flash_messages = app.flashes %} + {% if flash_messages|length > 0 %} +
    +
    + {% for type, messages in flash_messages %} + {% for message in messages %} +
    + {{ message | trans }} +
    + {% endfor %} {% endfor %} - {% endfor %} +
    -
    + {% endif %} {% endif %} {% endblock form_errors %} From 9fa8a2e6c00fadc42f1cdbe2aa94f0f8a1c36eb6 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Mon, 11 Mar 2024 16:00:33 +0100 Subject: [PATCH 118/202] Fix return redirect --- .../StepupRa/RaBundle/Controller/Vetting/SmsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php index 7643c19d..3f3f5216 100755 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/SmsController.php @@ -86,7 +86,7 @@ public function sendChallenge(Request $request, string $procedureId): Response if (!$form->isSubmitted() || !$form->isValid()) { $logger->notice('Form has not been submitted, not sending SMS, rendering Send SMS Challenge page'); - $this->render( + return $this->render( 'vetting/sms/send_challenge.html.twig', array_merge( $viewVariables, From ffeba6bffbe75bac6d2271f8d7012aba4f4cef22 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 12 Mar 2024 12:03:04 +0100 Subject: [PATCH 119/202] Test double for Yubikey --- .../smoketest/services_smoketest.yaml | 11 ++++- .../RaBundle/Resources/config/services.yml | 6 ++- .../Service/YubikeySecondFactorService.php | 10 +--- .../YubikeySecondFactorServiceInterface.php | 25 ++++++++++ .../Service/YubikeySecondFactorService.php | 49 +++++++++++++++++++ 5 files changed, 90 insertions(+), 11 deletions(-) create mode 100644 src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorServiceInterface.php create mode 100644 src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Service/YubikeySecondFactorService.php diff --git a/config/packages/smoketest/services_smoketest.yaml b/config/packages/smoketest/services_smoketest.yaml index 64ba4502..249c9605 100644 --- a/config/packages/smoketest/services_smoketest.yaml +++ b/config/packages/smoketest/services_smoketest.yaml @@ -5,6 +5,15 @@ services: arguments: - "@surfnet_stepup.service.challenge_handler" + ra.service.yubikey_second_factor: + public: true + class: Surfnet\StepupRa\RaBundle\Tests\TestDouble\Service\YubikeySecondFactorService + arguments: + - "@logger" + + Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactorServiceInterface: + alias: ra.service.yubikey_second_factor + # The middleware client bundle guzzle client is overloaded to be able to pass the testcookie to the ensure MW is # loaded in test mode. This way people setting the testcookie in prod will not switch their mw api into testmode # resulting in 500 errors. @@ -22,4 +31,4 @@ services: class: GuzzleHttp\Client factory: ['Surfnet\StepupRa\RaBundle\Tests\TestDouble\Factory\GuzzleApiFactory', createCommandGuzzleClient] arguments: - - "%middleware_url_command_api%" \ No newline at end of file + - "%middleware_url_command_api%" diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index 052d7af5..2e5f31c2 100755 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -129,12 +129,16 @@ services: - "@logger" ra.service.yubikey_second_factor: - public: true + public: false class: Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactorService arguments: - "@ra.service.yubikey" - "@logger" + Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactorServiceInterface: + alias: ra.service.yubikey_second_factor + + ra.service.gssf: class: Surfnet\StepupRa\RaBundle\Service\GssfService diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php index 6e2573c7..b2df2b41 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php @@ -25,7 +25,7 @@ use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; use Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactor\VerificationResult; -class YubikeySecondFactorService +class YubikeySecondFactorService implements YubikeySecondFactorServiceInterface { public function __construct( private readonly YubikeyService $yubikeyService, @@ -55,14 +55,6 @@ public function verifyYubikeyPublicId(VerifyYubikeyPublicIdCommand $command): Ve return new VerificationResult(VerificationResult::RESULT_OTP_INVALID, $publicId); } - if ($publicId->getYubikeyPublicId() !== $command->expectedPublicId) { - $this->logger->notice( - 'Yubikey used by registrant during vetting did not match the one used during registration.', - ); - - return new VerificationResult(VerificationResult::RESULT_PUBLIC_ID_DID_NOT_MATCH, $publicId); - } - $this->logger->info( 'Yubikey used by registrant during vetting matches the one used during registration.', ); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorServiceInterface.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorServiceInterface.php new file mode 100644 index 00000000..56a41065 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorServiceInterface.php @@ -0,0 +1,25 @@ +logger->info('Using the Fake Yubikey SF service. This always returns a successful response.'); + return new VerificationResult(VerificationResult::RESULT_PUBLIC_ID_MATCHED, $publicId); + } +} From c1ed01fd6fc15a87822fddcfbe4567848bfe4268 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 12 Mar 2024 12:03:15 +0100 Subject: [PATCH 120/202] Test double for Yubikey --- src/Surfnet/StepupRa/RaBundle/Service/VettingService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index 5582e5f8..85df8944 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -59,7 +59,7 @@ class VettingService */ public function __construct( private readonly SmsSecondFactorServiceInterface $smsSecondFactorService, - private readonly YubikeySecondFactorService $yubikeySecondFactorService, + private readonly YubikeySecondFactorServiceInterface $yubikeySecondFactorService, private readonly GssfService $gssfService, private readonly CommandService $commandService, private readonly VettingProcedureRepository $vettingProcedureRepository, From 3d2aed191a7c1441a1e48f436a6604833ba35ce8 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Tue, 12 Mar 2024 18:01:08 +0100 Subject: [PATCH 121/202] Attribute fix and exception controller --- CHANGELOG.md | 3 ++ config/packages/framework.yaml | 4 ++- config/services.yaml | 2 +- config/services_test.yaml | 3 +- .../Controller/ExceptionController.php | 2 +- .../RaBundle/Exception/UserNotRaException.php | 5 ++- .../RaBundle/Resources/config/security.yml | 1 + .../Service/Gssf/VerificationResult.php | 31 +++---------------- .../StepupRa/RaBundle/Service/GssfService.php | 11 +++++-- .../Resources/config/services.yml | 9 ------ 10 files changed, 27 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2818a6b3..4f87b6d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 6.0.0 +- Update php8 and Symfony 6.4 + ## 5.0.5 - Translate remaining [Recovery token] occurrences #303 - Installed security updates for phpseclib/phpseclib and guzzlehttp/psr7 diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 430fabdf..60736ee2 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -10,6 +10,7 @@ framework: validation: { enable_attributes: true } default_locale: "%default_locale%" trusted_hosts: ~ + session: # handler_id set to null will use default session handler from php.ini handler_id: ~ @@ -17,8 +18,9 @@ framework: cookie_samesite: lax cookie_httponly: true cookie_secure: true + fragments: false http_method_override: true - error_controller: Surfnet\StepupRa\RaBundle\Controller\ExceptionController + error_controller: Surfnet\StepupRa\RaBundle\Controller\ExceptionController::show php_errors: log: true diff --git a/config/services.yaml b/config/services.yaml index 20b7547c..02647d80 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -38,4 +38,4 @@ services: ra.service.gssf: class: Surfnet\StepupRa\RaBundle\Service\GssfService arguments: - - "@gssp.session.namespaced_attribute_bag" + - "@request_stack" diff --git a/config/services_test.yaml b/config/services_test.yaml index 52d4225d..7f4daad1 100644 --- a/config/services_test.yaml +++ b/config/services_test.yaml @@ -7,6 +7,7 @@ services: arguments: - "@surfnet_stepup.service.challenge_handler" + # The middleware client bundle guzzle client is overloaded to be able to pass the testcookie to the ensure MW is # loaded in test mode. This way people setting the testcookie in prod will not switch their mw api into testmode # resulting in 500 errors. @@ -24,4 +25,4 @@ services: class: GuzzleHttp\Client factory: ['Surfnet\StepupRa\RaBundle\Tests\TestDouble\Factory\GuzzleApiFactory', createCommandGuzzleClient] arguments: - - "%middleware_url_command_api%" \ No newline at end of file + - "%middleware_url_command_api%" diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php index 5228af96..b18adde2 100755 --- a/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php @@ -64,7 +64,7 @@ protected function getPageTitleAndDescription(Throwable $exception): array return parent::getPageTitleAndDescription($exception); } - public function __invoke(Request $request, Throwable $exception): Response + public function show(Request $request, Throwable $exception): Response { $statusCode = $this->getStatusCode($exception); diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php b/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php index 514d8f45..4a33a218 100755 --- a/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php @@ -18,6 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Exception; +use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; use Symfony\Component\Security\Core\Exception\AuthenticationException; /** @@ -31,6 +32,8 @@ * * @package Surfnet\StepupRa\RaBundle\Exception */ -final class UserNotRaException extends AuthenticationException + +#[WithHttpStatus(401)] +final class UserNotRaException extends RuntimeException { } diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index 7845a9ee..976cb02e 100755 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -92,6 +92,7 @@ services: class: Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionStorage arguments: - "@request_stack" + Surfnet\StepupRa\RaBundle\Security\Authentication\Session\SessionStorage: alias: ra.security.authentication.session.session_storage diff --git a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php index ff7932ad..fef135d5 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/Gssf/VerificationResult.php @@ -18,29 +18,13 @@ namespace Surfnet\StepupRa\RaBundle\Service\Gssf; -use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; - final class VerificationResult { - /** - * @var boolean - */ - private $verificationSucceeded; - - /** - * @var string|null - */ - private $procedureId; + private bool $verificationSucceeded = false; + private ?string $procedureId = null; - /** - * @param string $procedureId - */ - public static function verificationSucceeded($procedureId): VerificationResult + public static function verificationSucceeded(string $procedureId): VerificationResult { - if (!is_string($procedureId)) { - throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); - } - $result = new self(); $result->verificationSucceeded = true; $result->procedureId = $procedureId; @@ -56,15 +40,8 @@ public static function noSuchProcedure(): VerificationResult return $result; } - /** - * @param string $procedureId - */ - public static function verificationFailed($procedureId): VerificationResult + public static function verificationFailed(string $procedureId): VerificationResult { - if (!is_string($procedureId)) { - throw InvalidArgumentException::invalidType('string', 'procedureId', $procedureId); - } - $result = new self(); $result->verificationSucceeded = false; $result->procedureId = $procedureId; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index 802769f9..0874411b 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -19,22 +19,27 @@ namespace Surfnet\StepupRa\RaBundle\Service; use Surfnet\StepupRa\RaBundle\Service\Gssf\VerificationResult; +use Symfony\Component\DependencyInjection\Attribute\Autowire; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; final readonly class GssfService { - public function __construct(private AttributeBagInterface $state) + public function __construct( +// private AttributeBagInterface $state + private RequestStack $requestStack, + ) { } public function startVerification(string $gssfId, string $procedureId): void { - $this->state->set('current_verification', ['procedureId' => $procedureId, 'gssfId' => $gssfId]); + $this->requestStack->getSession()->set('current_verification', ['procedureId' => $procedureId, 'gssfId' => $gssfId]); } public function verify(string $gssfId): VerificationResult { - $verification = $this->state->remove('current_verification'); + $verification = $this->requestStack->getSession()->remove('current_verification'); if (!$verification) { return VerificationResult::noSuchProcedure(); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index f2d1f85f..109720f3 100755 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -11,12 +11,3 @@ services: class: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ProviderRepository: alias: gssp.provider_repository - - gssp.session.namespaced_attribute_bag: - public: false - class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag - arguments: - - '__gssp__' - - '/' - calls: - - [setName, ['gssp']] From 5b30070f694fa530456e03deae082d984289fcc3 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 09:47:33 +0100 Subject: [PATCH 122/202] Remove obsolete token --- .../Authentication/Token/SamlToken.php | 62 ------------------- .../Authentication/Token/SamlTokenTest.php | 52 ---------------- 2 files changed, 114 deletions(-) delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php delete mode 100755 src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php deleted file mode 100755 index 6c878d64..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php +++ /dev/null @@ -1,62 +0,0 @@ -loa; - } - - public function __serialize(): array - { - return [ - 'parent_data' => parent::__serialize(), - 'loa' => $this->loa, - ]; - } - - public function __unserialize(array $data): void - { - parent::__unserialize($data['parent_data']); - $this->loa = $data['loa']; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php deleted file mode 100755 index fbc24c72..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Authentication/Token/SamlTokenTest.php +++ /dev/null @@ -1,52 +0,0 @@ -useRaLocations = true; - $institutionConfigurationOptions->showRaaContactInformation = false; - - $samlToken = new SamlToken( - new Loa(Loa::LOA_1, 'http://some.url.tld/authentication/loa1'), - ['ROLE_RAA'], - ); - - $serialized = $samlToken->__serialize(); - - $deserialized = new SamlToken(new Loa(Loa::LOA_2, 'http://some.url.tld/authentication/loa2')); - $deserialized->__unserialize($serialized); - - $this->assertEquals($samlToken, $deserialized); - } -} From 9e00469ce9ca8ef86fa6a7ff658b155058b5938f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 10:58:14 +0100 Subject: [PATCH 123/202] Clean up phpcbf --- .../Command/VerifyIdentityCommand.php | 32 +++++++++++-------- .../Controller/RaManagementController.php | 8 ++++- .../StepupRa/RaBundle/Service/GssfService.php | 7 ++-- .../Tests/Security/Session/FakeSession.php | 2 +- .../Saml/StateHandler.php | 1 - 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php index a3413156..309bc489 100755 --- a/src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php @@ -22,18 +22,24 @@ class VerifyIdentityCommand { - /** - * - * @var string - */ - #[Assert\NotBlank(message: 'ra.verify_identity_command.document_number.may_not_be_empty')] - #[Assert\Type(type: 'string', message: 'ra.verify_identity_command.document_number.must_be_string')] - #[Assert\Length(min: 1, max: 6, minMessage: 'ra.verify_identity_command.document_number.must_be_higher_than_minimum', maxMessage: 'ra.verify_identity_command.document_number.must_be_lower_than_maximum')] - public $documentNumber; + #[Assert\NotBlank( + message: 'ra.verify_identity_command.document_number.may_not_be_empty', + )] + #[Assert\Type( + type: 'string', + message: 'ra.verify_identity_command.document_number.must_be_string', + )] + #[Assert\Length( + min: 1, + max: 6, + minMessage: 'ra.verify_identity_command.document_number.must_be_higher_than_minimum', + maxMessage: 'ra.verify_identity_command.document_number.must_be_lower_than_maximum', + )] + public string $documentNumber; - /** - * @var bool - */ - #[Assert\EqualTo(value: true, message: 'ra.verify_identity_command.identity_verified.must_be_checked')] - public $identityVerified; + #[Assert\EqualTo( + value: true, + message: 'ra.verify_identity_command.identity_verified.must_be_checked', + )] + public bool $identityVerified; } diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php index 32045931..f6b2aa49 100755 --- a/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php @@ -287,7 +287,13 @@ public function retractRegistrationAuthority(Request $request, $identityId, $raI $raListing = $this->raListingService->get($identityId, $raInstitution, $this->getUser()->getIdentity()->id); if (!$raListing) { - $this->logger->warning(sprintf("RA listing for identity ID '%s@%s' not found", $identityId, $this->getUser()->getIdentity()->institution)); + $this + ->logger + ->warning(sprintf( + "RA listing for identity ID '%s@%s' not found", + $identityId, + $this->getUser()->getIdentity()->institution, + )); throw new NotFoundHttpException(sprintf("RA listing for identity ID '%s' not found", $identityId)); } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index 0874411b..7f5a35bb 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -26,10 +26,9 @@ final readonly class GssfService { public function __construct( -// private AttributeBagInterface $state - private RequestStack $requestStack, - ) - { + // private AttributeBagInterface $state + private RequestStack $requestStack, + ) { } public function startVerification(string $gssfId, string $procedureId): void diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php index c69d0362..b768bd36 100755 --- a/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/Security/Session/FakeSession.php @@ -84,7 +84,7 @@ public function migrate($destroy = false, $lifetime = null): true return true; } - public function save() + public function save(): void { // noop } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php index ca40f44b..008d2cef 100755 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php @@ -20,7 +20,6 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle\Saml; - use Symfony\Component\HttpFoundation\RequestStack; final readonly class StateHandler From 4815c8ec98d0d592e325268fcda7c7f273721788 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 10:58:32 +0100 Subject: [PATCH 124/202] Remove unneeded version --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index dacd1f08..76a79dc6 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "guzzlehttp/guzzle": "^7", "incenteev/composer-parameter-handler": "~2.0", "jms/translation-bundle": "^2.1", - "knplabs/knp-paginator-bundle": "^5.9 || ^6.0", + "knplabs/knp-paginator-bundle": "^6.0", "nelmio/security-bundle": "^3.0", "openconext/monitor-bundle": "^4.0", "surfnet/stepup-bundle": "^6.0", diff --git a/composer.lock b/composer.lock index 7de02d27..192d55c6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "75196b22ee808c16cb71eb57512d82df", + "content-hash": "2e9cdea71b1003c4b69372e58dddfd07", "packages": [ { "name": "beberlei/assert", From f45b85019d35d2c2ca61ef8b9f845a6de45d6b35 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 10:58:55 +0100 Subject: [PATCH 125/202] Phpstan settings --- ci/qa/phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/qa/phpstan.neon b/ci/qa/phpstan.neon index ec5e3d11..21a5e827 100644 --- a/ci/qa/phpstan.neon +++ b/ci/qa/phpstan.neon @@ -5,7 +5,7 @@ rules: # - Surfnet\NoDebugFunctionRule # - Surfnet\InvokableControllerRule # - Surfnet\UntypedIdParamRule - - Surfnet\NoNullOrArrayReturnRule +# - Surfnet\NoNullOrArrayReturnRule parameters: checkUninitializedProperties: true level: 9 From c006218ed59ef77523f6930e972117d9a491d968 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 11:11:02 +0100 Subject: [PATCH 126/202] Add Logout handling --- config/services.yaml | 5 ++ .../EventSubscriber/CustomLogoutListener.php | 49 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php diff --git a/config/services.yaml b/config/services.yaml index 02647d80..a5d8a691 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -39,3 +39,8 @@ services: class: Surfnet\StepupRa\RaBundle\Service\GssfService arguments: - "@request_stack" + + Surfnet\StepupRa\RaBundle\Security\Authentication\EventSubscriber\CustomLogoutListener: + arguments: + - '@security.helper' + - "%logout_redirect_url%" diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php new file mode 100644 index 00000000..0676aaf2 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php @@ -0,0 +1,49 @@ +security->getUser()->getIdentity(); + + $logoutRedirectUrl = $this->logoutRedirectUrl[$identity->preferredLocale]; + + $event->getRequest()->getSession()->invalidate(); + + $response = new RedirectResponse($logoutRedirectUrl); + + $event->setResponse($response); + } +} From d120bb5cf968847a44fb7fc3d9c72a70e5e1c9a3 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 11:11:17 +0100 Subject: [PATCH 127/202] Add phpstan in check --- ci/qa/phpstan-baseline.php | 348 ++++++++++++++++++++----------------- composer.json | 2 + 2 files changed, 191 insertions(+), 159 deletions(-) diff --git a/ci/qa/phpstan-baseline.php b/ci/qa/phpstan-baseline.php index 83cba150..b67e00ae 100644 --- a/ci/qa/phpstan-baseline.php +++ b/ci/qa/phpstan-baseline.php @@ -1,11 +1,6 @@ '#^Class Surfnet\\\\NoDebugFunctionRule implements generic interface PHPStan\\\\Rules\\\\Rule but does not specify its types\\: TNodeType$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/NoDebugFunctionRule.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Assert\\:\\:keysAre\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -21,11 +16,101 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Assert.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand has an uninitialized property \\$contactInformation\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand has an uninitialized property \\$identityId\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand has an uninitialized property \\$institution\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand has an uninitialized property \\$location\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand has an uninitialized property \\$roleAtInstitution\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', +]; $ignoreErrors[] = [ 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AccreditCandidateCommand\\:\\:\\$availableInstitutions type has no value type specified in iterable type array\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AccreditCandidateCommand.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AmendRegistrationAuthorityInformationCommand has an uninitialized property \\$contactInformation\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AmendRegistrationAuthorityInformationCommand has an uninitialized property \\$identityId\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AmendRegistrationAuthorityInformationCommand has an uninitialized property \\$institution\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\AmendRegistrationAuthorityInformationCommand has an uninitialized property \\$location\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/AmendRegistrationAuthorityInformationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand has an uninitialized property \\$contactInformation\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand has an uninitialized property \\$currentUserId\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand has an uninitialized property \\$id\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand has an uninitialized property \\$institution\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand has an uninitialized property \\$location\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand has an uninitialized property \\$name\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/ChangeRaLocationCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand has an uninitialized property \\$actorId\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand has an uninitialized property \\$institutionFilterOptions\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand has an uninitialized property \\$pageNumber\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SearchRaCandidatesCommand.php', +]; $ignoreErrors[] = [ 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$institutionFilterOptions type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -57,102 +142,97 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/SelectInstitutionCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__get\\(\\) has parameter \\$name with no type specified\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\StartVettingProcedureCommand has an uninitialized property \\$authorityId\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__isset\\(\\) has parameter \\$name with no type specified\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\StartVettingProcedureCommand has an uninitialized property \\$authorityLoa\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__set\\(\\) has parameter \\$value with no type specified\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\StartVettingProcedureCommand has an uninitialized property \\$registrationCode\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:assertValidLanguageInName\\(\\) has parameter \\$name with no type specified\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\StartVettingProcedureCommand has an uninitialized property \\$secondFactor\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/StartVettingProcedureCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:setHints\\(\\) has parameter \\$hints with no value type specified in iterable type array\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VerifyIdentityCommand has an uninitialized property \\$documentNumber\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\ExceptionController\\:\\:getPageTitleAndDescription\\(\\) return type has no value type specified in iterable type array\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VerifyIdentityCommand has an uninitialized property \\$identityVerified\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VerifyIdentityCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface\\:\\:switchLocale\\(\\)\\.$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__get\\(\\) has parameter \\$name with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__isset\\(\\) has parameter \\$name with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\LocaleController\\:\\:__construct\\(\\) has parameter \\$identityService with generic interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface but does not specify its types\\: TUser$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:__set\\(\\) has parameter \\$value with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Negated boolean expression is always false\\.$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:assertValidLanguageInName\\(\\) has parameter \\$name with no type specified\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$url of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:redirect\\(\\) expects string, bool\\|float\\|int\\|string\\|null given\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupBundle\\\\Command\\\\SwitchLocaleCommand\\:\\:\\$identityId \\(string\\) does not accept string\\|null\\.$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\VettingTypeHintCommand\\:\\:setHints\\(\\) has parameter \\$hints with no value type specified in iterable type array\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Command/VettingTypeHintCommand.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$id on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Controller\\\\ExceptionController\\:\\:getPageTitleAndDescription\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/ExceptionController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', + 'message' => '#^Parameter \\#1 \\$url of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:redirect\\(\\) expects string, string\\|null given\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/LocaleController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$id of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaLocationService\\:\\:find\\(\\) expects string, mixed given\\.$#', + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/ProfileController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\ProfileService\\:\\:findByIdentityId\\(\\) expects string, string\\|null given\\.$#', - 'count' => 1, + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 4, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#', + 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\ChangeRaLocationCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'message' => '#^Parameter \\#1 \\$id of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaLocationService\\:\\:find\\(\\) expects string, mixed given\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\CreateRaLocationCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', + 'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', ]; @@ -161,11 +241,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\RemoveRaLocationCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php', -]; $ignoreErrors[] = [ 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaLocationsCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', 'count' => 1, @@ -187,27 +262,12 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$id on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', - 'count' => 3, + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 7, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$institution on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$institutions on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaCandidateInstitutions\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$raCandidate on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\RaCandidateInstitutions\\|null\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', + 'message' => '#^Cannot call method getInstitution\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; @@ -236,11 +296,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Negated boolean expression is always false\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', -]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$identityId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\RaCandidateService\\:\\:getRaCandidate\\(\\) expects string, mixed given\\.$#', 'count' => 1, @@ -256,11 +311,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', -]; $ignoreErrors[] = [ 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaCandidatesCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', 'count' => 1, @@ -272,19 +322,19 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', + 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaListingCommand\\:\\:\\$orderDirection \\(string\\|null\\) does not accept mixed\\.$#', + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php', ]; $ignoreErrors[] = [ 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', @@ -297,8 +347,8 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RaaController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', - 'count' => 1, + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 2, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', ]; $ignoreErrors[] = [ @@ -306,16 +356,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\RevokeRecoveryTokenCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRecoveryTokensCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/RecoveryTokenController.php', -]; $ignoreErrors[] = [ 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRecoveryTokensCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', 'count' => 1, @@ -337,8 +377,8 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', - 'count' => 1, + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 3, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', ]; $ignoreErrors[] = [ @@ -361,16 +401,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\RevokeSecondFactorCommand\\:\\:\\$currentUserId \\(string\\) does not accept string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaSecondFactorsCommand\\:\\:\\$actorId \\(string\\) does not accept string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/SecondFactorController.php', -]; $ignoreErrors[] = [ 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\SearchRaSecondFactorsCommand\\:\\:\\$orderBy \\(string\\|null\\) does not accept mixed\\.$#', 'count' => 1, @@ -407,18 +437,13 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/Vetting/Gssf/GssfVerifyController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method forProcedure\\(\\) on mixed\\.$#', - 'count' => 4, + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 2, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method getToken\\(\\) on mixed\\.$#', - 'count' => 2, + 'message' => '#^Cannot call method getLoa\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', ]; $ignoreErrors[] = [ @@ -427,14 +452,14 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#2 \\$actorId of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\SecondFactorService\\:\\:findVerifiedSecondFactorByRegistrationCode\\(\\) expects string, string\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$haystack of function in_array expects array, array\\|bool\\|float\\|int\\|string\\|null given\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', ]; $ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Command\\\\StartVettingProcedureCommand\\:\\:\\$authorityId \\(string\\) does not accept string\\|null\\.$#', + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingController.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Controller/VettingTypeHintController.php', ]; $ignoreErrors[] = [ 'message' => '#^Cannot call method getRaaInstitutions\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', @@ -457,18 +482,13 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/DateTime/DateTime.php', ]; $ignoreErrors[] = [ - 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#', + 'message' => '#^Call to an undefined method Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface\\:\\:setLocale\\(\\)\\.$#', 'count' => 2, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method integerNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#', + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Call to an undefined method Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface\\:\\:setLocale\\(\\)\\.$#', - 'count' => 2, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/EventListener/LocaleListener.php', ]; $ignoreErrors[] = [ @@ -556,6 +576,11 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Form/Type/VettingTypeHintType.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Logger\\\\ProcedureAwareLogger has an uninitialized property \\$procedure\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Logger/ProcedureAwareLogger.php', +]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Logger\\\\ProcedureAwareLogger\\:\\:enrichContext\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -576,6 +601,11 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Repository/VettingProcedureRepository.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\AuthenticatedIdentity\\:\\:__construct\\(\\) has parameter \\$roles with no value type specified in iterable type array\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/AuthenticatedIdentity.php', +]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\AuthenticatedIdentity\\:\\:eraseCredentials\\(\\) return type has no value type specified in iterable type array\\.$#', 'count' => 1, @@ -666,11 +696,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$loa of class Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Token\\\\SamlToken constructor expects Surfnet\\\\StepupBundle\\\\Value\\\\Loa, Surfnet\\\\StepupBundle\\\\Value\\\\Loa\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', -]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$loaIdentifier of method Surfnet\\\\StepupBundle\\\\Service\\\\LoaResolutionService\\:\\:getLoa\\(\\) expects string, string\\|null given\\.$#', 'count' => 1, @@ -686,6 +711,11 @@ 'count' => 2, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#2 \\$loa of class Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\AuthenticatedIdentity constructor expects Surfnet\\\\StepupBundle\\\\Value\\\\Loa, Surfnet\\\\StepupBundle\\\\Value\\\\Loa\\|null given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Provider/SamlProvider.php', +]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\SamlAuthenticationStateHandler\\:\\:setRequestId\\(\\) has no return type specified\\.$#', 'count' => 1, @@ -716,11 +746,6 @@ 'count' => 2, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Session/SessionStorage.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Token\\\\SamlToken\\:\\:__unserialize\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Token/SamlToken.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Factory\\\\SamlFactory\\:\\:create\\(\\) has parameter \\$config with no type specified\\.$#', 'count' => 1, @@ -751,6 +776,11 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/AuditLogService.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/CommandService.php', +]; $ignoreErrors[] = [ 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', 'count' => 1, @@ -781,6 +811,11 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/IdentityService.php', +]; $ignoreErrors[] = [ 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\IdentityService implements generic interface Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserProviderInterface but does not specify its types\\: TUser$#', 'count' => 1, @@ -872,7 +907,7 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/RaService.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#2 \\$haystack of function in_array expects array, array\\|bool\\|float\\|int\\|string\\|UnitEnum\\|null given\\.$#', + 'message' => '#^Parameter \\#2 \\$haystack of function in_array expects array, array\\|bool\\|float\\|int\\|string\\|null given\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/SecondFactorAssertionService.php', ]; @@ -886,6 +921,11 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/SecondFactorService.php', ]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method Surfnet\\\\StepupRa\\\\RaBundle\\\\Service\\\\YubikeySecondFactorServiceInterface\\:\\:verifyYubikeyPublicId\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', +]; $ignoreErrors[] = [ 'message' => '#^Cannot call method getAuthorityId\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', 'count' => 1, @@ -906,11 +946,6 @@ 'count' => 17, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getYubikeyPublicId\\(\\) on Surfnet\\\\StepupBundle\\\\Value\\\\YubikeyPublicId\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot call method isIdentityVerified\\(\\) on Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure\\|null\\.$#', 'count' => 1, @@ -971,11 +1006,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/VettingService.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getYubikeyPublicId\\(\\) on Surfnet\\\\StepupBundle\\\\Value\\\\YubikeyPublicId\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Service/YubikeySecondFactorService.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\RaBundle\\\\Twig\\\\Extensions\\\\Extension\\\\SecondFactorType\\:\\:translateSecondFactorType\\(\\) has parameter \\$secondFactorType with no type specified\\.$#', 'count' => 1, @@ -987,19 +1017,19 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Value/DateTime.php', ]; $ignoreErrors[] = [ - 'message' => '#^Cannot call method scalarNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure has an uninitialized property \\$authorityId\\. Give it default value or assign it in the constructor\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/VettingProcedure.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$rootNode of method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\Configuration\\:\\:addProvidersSection\\(\\) expects Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\ArrayNodeDefinition, Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition given\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure has an uninitialized property \\$id\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/VettingProcedure.php', ]; $ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$rootNode of method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\Configuration\\:\\:addRoutesSection\\(\\) expects Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\ArrayNodeDefinition, Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition given\\.$#', + 'message' => '#^Class Surfnet\\\\StepupRa\\\\RaBundle\\\\VettingProcedure has an uninitialized property \\$secondFactor\\. Give it default value or assign it in the constructor\\.$#', 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php', + 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/VettingProcedure.php', ]; $ignoreErrors[] = [ 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\DependencyInjection\\\\SurfnetStepupRaSamlStepupProviderExtension\\:\\:buildHostedEntityDefinition\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#', @@ -1162,17 +1192,17 @@ 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:get\\(\\) has no return type specified\\.$#', + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\Session\\\\SessionBagInterface\\:\\:get\\(\\)\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:get\\(\\) has parameter \\$key with no type specified\\.$#', + 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\Session\\\\SessionBagInterface\\:\\:set\\(\\)\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', ]; $ignoreErrors[] = [ - 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:set\\(\\) has parameter \\$key with no type specified\\.$#', + 'message' => '#^Method Surfnet\\\\StepupRa\\\\SamlStepupProviderBundle\\\\Saml\\\\StateHandler\\:\\:get\\(\\) has no return type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Saml/StateHandler.php', ]; diff --git a/composer.json b/composer.json index 76a79dc6..9ba5b713 100644 --- a/composer.json +++ b/composer.json @@ -91,12 +91,14 @@ "@phpmd", "@phpcs", "@jscpd", + "@phpstan", "@phpunit", "@security-tests" ], "phplint": "./ci/qa/phplint", "phpmd": "./ci/qa/phpmd", "phpcs": "./ci/qa/phpcs", + "phpstan": "./ci/qa/phpstan", "phpcbf": "./ci/qa/phpcbf", "jscpd": "ci/qa/jscpd", "phpunit": "./ci/qa/phpunit", From 3e5c1134ed1e2541d39adc1b06fc366e95484cea Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 11:30:20 +0100 Subject: [PATCH 128/202] add phpstan directives --- .../EventSubscriber/CustomLogoutListener.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php index 0676aaf2..7ca57f5a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/EventSubscriber/CustomLogoutListener.php @@ -20,6 +20,7 @@ namespace Surfnet\StepupRa\RaBundle\Security\Authentication\EventSubscriber; +use Surfnet\StepupRa\RaBundle\Security\AuthenticatedIdentity; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\EventDispatcher\Attribute\AsEventListener; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -27,15 +28,19 @@ readonly class CustomLogoutListener { + /** + * @param array $logoutRedirectUrl + */ public function __construct( private Security $security, - private array $logoutRedirectUrl, + private array $logoutRedirectUrl = [], ) { } #[AsEventListener(event: LogoutEvent::class)] public function onLogout(LogoutEvent $event): void { + assert($this->security->getUser() instanceof AuthenticatedIdentity); $identity = $this->security->getUser()->getIdentity(); $logoutRedirectUrl = $this->logoutRedirectUrl[$identity->preferredLocale]; From ff6f20d9f553c21a8a09308e75641ee88406024e Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 11:57:19 +0100 Subject: [PATCH 129/202] Remove dead code --- .../Handler/LogoutSuccessHandler.php | 44 ----------- .../Provider/Metadata.php | 79 ------------------- 2 files changed, 123 deletions(-) delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php delete mode 100755 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php deleted file mode 100755 index 993b8caf..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php +++ /dev/null @@ -1,44 +0,0 @@ -tokenStorage->getToken(); - $identity = $token->getUser(); - - return new RedirectResponse($this->logoutRedirectUrl[$identity->preferredLocale]); - } -} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php deleted file mode 100755 index 00d93a48..00000000 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php +++ /dev/null @@ -1,79 +0,0 @@ -document) { - throw new LogicException('Cannot get the rootElement of Metadata before the document has been generated'); - } - - return $this->document->documentElement; - } - - public function getAppendBeforeNode(): ?DOMNode - { - if (!$this->document) { - throw new LogicException( - 'Cannot get the appendBeforeNode of Metadata before the document has been generated', - ); - } - - return $this->document->documentElement->childNodes->item(0); - } - - public function __toString(): string - { - return (string) $this->document->saveXML(); - } -} From ebf40141ae5180f342ae5ff44502ad93ebcc7a47 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:33:14 +0100 Subject: [PATCH 130/202] Integrate in central config --- config/packages/prod/webpack_encore.yaml | 4 ---- config/packages/smoketest/webpack_encore.yaml | 2 -- config/packages/test/webpack_encore.yaml | 2 -- config/packages/webpack_encore.yaml | 13 +++++++++++++ 4 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 config/packages/prod/webpack_encore.yaml delete mode 100644 config/packages/smoketest/webpack_encore.yaml delete mode 100644 config/packages/test/webpack_encore.yaml diff --git a/config/packages/prod/webpack_encore.yaml b/config/packages/prod/webpack_encore.yaml deleted file mode 100644 index 42969165..00000000 --- a/config/packages/prod/webpack_encore.yaml +++ /dev/null @@ -1,4 +0,0 @@ -webpack_encore: - # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) - # Available in version 1.2 - cache: true diff --git a/config/packages/smoketest/webpack_encore.yaml b/config/packages/smoketest/webpack_encore.yaml deleted file mode 100644 index 9ad96735..00000000 --- a/config/packages/smoketest/webpack_encore.yaml +++ /dev/null @@ -1,2 +0,0 @@ -webpack_encore: - strict_mode: false diff --git a/config/packages/test/webpack_encore.yaml b/config/packages/test/webpack_encore.yaml deleted file mode 100644 index 9ad96735..00000000 --- a/config/packages/test/webpack_encore.yaml +++ /dev/null @@ -1,2 +0,0 @@ -webpack_encore: - strict_mode: false diff --git a/config/packages/webpack_encore.yaml b/config/packages/webpack_encore.yaml index 9191f4f4..9109d0ae 100644 --- a/config/packages/webpack_encore.yaml +++ b/config/packages/webpack_encore.yaml @@ -23,3 +23,16 @@ webpack_encore: # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) # Put in config/packages/prod/webpack_encore.yaml # cache: true +when@smoketest: + webpack_encore: + strict_mode: false + +when@test: + webpack_encore: + strict_mode: false + +when@prod: + webpack_encore: + # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) + # Available in version 1.2 + cache: true From 88abf71892d24d3b5c65600ae98a9590ce30da5b Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:34:38 +0100 Subject: [PATCH 131/202] Integrate in central config --- config/packages/prod/routing.yaml | 3 --- config/packages/routing.yaml | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 config/packages/prod/routing.yaml diff --git a/config/packages/prod/routing.yaml b/config/packages/prod/routing.yaml deleted file mode 100644 index b3e6a0af..00000000 --- a/config/packages/prod/routing.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - router: - strict_requirements: null diff --git a/config/packages/routing.yaml b/config/packages/routing.yaml index 7e977620..60a7991e 100644 --- a/config/packages/routing.yaml +++ b/config/packages/routing.yaml @@ -1,3 +1,8 @@ framework: router: utf8: true + +when@prod: + framework: + router: + strict_requirements: null From 75931c50d187be7a36cc57e7a539e6453db50258 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:37:39 +0100 Subject: [PATCH 132/202] Integrate in central config --- config/packages/smoketest/surfnet_saml.yaml | 11 --------- config/packages/surfnet_saml.yaml | 26 +++++++++++++++++++++ config/packages/test/surfnet_saml.yaml | 11 --------- 3 files changed, 26 insertions(+), 22 deletions(-) delete mode 100644 config/packages/smoketest/surfnet_saml.yaml delete mode 100644 config/packages/test/surfnet_saml.yaml diff --git a/config/packages/smoketest/surfnet_saml.yaml b/config/packages/smoketest/surfnet_saml.yaml deleted file mode 100644 index 3d9ae568..00000000 --- a/config/packages/smoketest/surfnet_saml.yaml +++ /dev/null @@ -1,11 +0,0 @@ -surfnet_saml: - hosted: - service_provider: - public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt - private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key - metadata: - public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt - private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key - remote: - identity_provider: - certificate: MIIC6jCCAdICCQC9cRx5wiwWOjANBgkqhkiG9w0BAQsFADA3MRwwGgYDVQQDDBNTZWxmU2VydmljZSBTQU1MIFNQMRcwFQYDVQQKDA5EZXZlbG9wbWVudCBWTTAeFw0xODA3MzAxMjMwNDdaFw0yMzA3MjkxMjMwNDdaMDcxHDAaBgNVBAMME1NlbGZTZXJ2aWNlIFNBTUwgU1AxFzAVBgNVBAoMDkRldmVsb3BtZW50IFZNMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhbI0Xy682DuvWchg6FYnI+DNwLXef2XExM4YVRBaMMsOZ3rBtQUTMSqYan6SK/BOEXLs0rNiJjyM0dn+F98wg3fv5zIADlvfk3LBVdcGsrpVfFUWtSa73yMgbROy8/RJADbUJE/HUB3ZmdjdiuD2Cui2aoWwT2HR8ukJwmoxiu45IWFPbqPQ7/1mH644JPOWTPLTv4OGGLQo8MNrP1oRCiZ0IEL4CQeGOOju5rfIJ0bTVm0UmelT4hGaqZovBMwXp3QV41akJ7UEMEBK2YMnLQy47Xuzi7aTDhJlvHcJ8mfH2NbjRh7hJoACVRTvQloxajgkr1iGMiWiiqT0e+YYwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBwZ0gRHvR8B8KivrXrhWNL9uLvWhEAH7OiDqo+fywkBp5KEuDJcbbvEPftHunSAGylg7M2xKuBIGamFpp74WDJccrtZ1jJ4qqnacUDRQrTLqqMZKqGpFOU0xjKkSxSGRuMtGN9/7er/TeonjQ0XBvjYvTomy3b5aCLVWRvEfKu2g1sDd8uhr62RY/HfMgidEt7LHDolkCVg+6JzY3OTcgeHga3cvYObOYPplxw1YPq5+BqqxaUW4nfb5DtK33bZBYMeyV6BZtSggc5Z/19aPx/s0bf6ySTUyB3lRqe5d3etCns4bGidORCl/6EZiXwVcPvmYmxYXqmuNWfps7isUvo diff --git a/config/packages/surfnet_saml.yaml b/config/packages/surfnet_saml.yaml index 021d3015..3100ef50 100644 --- a/config/packages/surfnet_saml.yaml +++ b/config/packages/surfnet_saml.yaml @@ -21,3 +21,29 @@ surfnet_saml: entity_id: "%saml_remote_idp_entity_id%" sso_url: "%saml_remote_idp_sso_url%" certificate: "%saml_remote_idp_certificate%" + +when@test: + surfnet_saml: + hosted: + service_provider: + public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt + private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key + metadata: + public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt + private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key + remote: + identity_provider: + certificate: MIIC6jCCAdICCQC9cRx5wiwWOjANBgkqhkiG9w0BAQsFADA3MRwwGgYDVQQDDBNTZWxmU2VydmljZSBTQU1MIFNQMRcwFQYDVQQKDA5EZXZlbG9wbWVudCBWTTAeFw0xODA3MzAxMjMwNDdaFw0yMzA3MjkxMjMwNDdaMDcxHDAaBgNVBAMME1NlbGZTZXJ2aWNlIFNBTUwgU1AxFzAVBgNVBAoMDkRldmVsb3BtZW50IFZNMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhbI0Xy682DuvWchg6FYnI+DNwLXef2XExM4YVRBaMMsOZ3rBtQUTMSqYan6SK/BOEXLs0rNiJjyM0dn+F98wg3fv5zIADlvfk3LBVdcGsrpVfFUWtSa73yMgbROy8/RJADbUJE/HUB3ZmdjdiuD2Cui2aoWwT2HR8ukJwmoxiu45IWFPbqPQ7/1mH644JPOWTPLTv4OGGLQo8MNrP1oRCiZ0IEL4CQeGOOju5rfIJ0bTVm0UmelT4hGaqZovBMwXp3QV41akJ7UEMEBK2YMnLQy47Xuzi7aTDhJlvHcJ8mfH2NbjRh7hJoACVRTvQloxajgkr1iGMiWiiqT0e+YYwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBwZ0gRHvR8B8KivrXrhWNL9uLvWhEAH7OiDqo+fywkBp5KEuDJcbbvEPftHunSAGylg7M2xKuBIGamFpp74WDJccrtZ1jJ4qqnacUDRQrTLqqMZKqGpFOU0xjKkSxSGRuMtGN9/7er/TeonjQ0XBvjYvTomy3b5aCLVWRvEfKu2g1sDd8uhr62RY/HfMgidEt7LHDolkCVg+6JzY3OTcgeHga3cvYObOYPplxw1YPq5+BqqxaUW4nfb5DtK33bZBYMeyV6BZtSggc5Z/19aPx/s0bf6ySTUyB3lRqe5d3etCns4bGidORCl/6EZiXwVcPvmYmxYXqmuNWfps7isUvo + +when@smoketest: + surfnet_saml: + hosted: + service_provider: + public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt + private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key + metadata: + public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt + private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key + remote: + identity_provider: + certificate: MIIC6jCCAdICCQC9cRx5wiwWOjANBgkqhkiG9w0BAQsFADA3MRwwGgYDVQQDDBNTZWxmU2VydmljZSBTQU1MIFNQMRcwFQYDVQQKDA5EZXZlbG9wbWVudCBWTTAeFw0xODA3MzAxMjMwNDdaFw0yMzA3MjkxMjMwNDdaMDcxHDAaBgNVBAMME1NlbGZTZXJ2aWNlIFNBTUwgU1AxFzAVBgNVBAoMDkRldmVsb3BtZW50IFZNMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhbI0Xy682DuvWchg6FYnI+DNwLXef2XExM4YVRBaMMsOZ3rBtQUTMSqYan6SK/BOEXLs0rNiJjyM0dn+F98wg3fv5zIADlvfk3LBVdcGsrpVfFUWtSa73yMgbROy8/RJADbUJE/HUB3ZmdjdiuD2Cui2aoWwT2HR8ukJwmoxiu45IWFPbqPQ7/1mH644JPOWTPLTv4OGGLQo8MNrP1oRCiZ0IEL4CQeGOOju5rfIJ0bTVm0UmelT4hGaqZovBMwXp3QV41akJ7UEMEBK2YMnLQy47Xuzi7aTDhJlvHcJ8mfH2NbjRh7hJoACVRTvQloxajgkr1iGMiWiiqT0e+YYwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBwZ0gRHvR8B8KivrXrhWNL9uLvWhEAH7OiDqo+fywkBp5KEuDJcbbvEPftHunSAGylg7M2xKuBIGamFpp74WDJccrtZ1jJ4qqnacUDRQrTLqqMZKqGpFOU0xjKkSxSGRuMtGN9/7er/TeonjQ0XBvjYvTomy3b5aCLVWRvEfKu2g1sDd8uhr62RY/HfMgidEt7LHDolkCVg+6JzY3OTcgeHga3cvYObOYPplxw1YPq5+BqqxaUW4nfb5DtK33bZBYMeyV6BZtSggc5Z/19aPx/s0bf6ySTUyB3lRqe5d3etCns4bGidORCl/6EZiXwVcPvmYmxYXqmuNWfps7isUvo diff --git a/config/packages/test/surfnet_saml.yaml b/config/packages/test/surfnet_saml.yaml deleted file mode 100644 index 3d9ae568..00000000 --- a/config/packages/test/surfnet_saml.yaml +++ /dev/null @@ -1,11 +0,0 @@ -surfnet_saml: - hosted: - service_provider: - public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt - private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key - metadata: - public_key: /vagrant/deploy/tests/behat/fixtures/test_public_key.crt - private_key: /vagrant/deploy/tests/behat/fixtures/test_private_key.key - remote: - identity_provider: - certificate: MIIC6jCCAdICCQC9cRx5wiwWOjANBgkqhkiG9w0BAQsFADA3MRwwGgYDVQQDDBNTZWxmU2VydmljZSBTQU1MIFNQMRcwFQYDVQQKDA5EZXZlbG9wbWVudCBWTTAeFw0xODA3MzAxMjMwNDdaFw0yMzA3MjkxMjMwNDdaMDcxHDAaBgNVBAMME1NlbGZTZXJ2aWNlIFNBTUwgU1AxFzAVBgNVBAoMDkRldmVsb3BtZW50IFZNMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqhbI0Xy682DuvWchg6FYnI+DNwLXef2XExM4YVRBaMMsOZ3rBtQUTMSqYan6SK/BOEXLs0rNiJjyM0dn+F98wg3fv5zIADlvfk3LBVdcGsrpVfFUWtSa73yMgbROy8/RJADbUJE/HUB3ZmdjdiuD2Cui2aoWwT2HR8ukJwmoxiu45IWFPbqPQ7/1mH644JPOWTPLTv4OGGLQo8MNrP1oRCiZ0IEL4CQeGOOju5rfIJ0bTVm0UmelT4hGaqZovBMwXp3QV41akJ7UEMEBK2YMnLQy47Xuzi7aTDhJlvHcJ8mfH2NbjRh7hJoACVRTvQloxajgkr1iGMiWiiqT0e+YYwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBwZ0gRHvR8B8KivrXrhWNL9uLvWhEAH7OiDqo+fywkBp5KEuDJcbbvEPftHunSAGylg7M2xKuBIGamFpp74WDJccrtZ1jJ4qqnacUDRQrTLqqMZKqGpFOU0xjKkSxSGRuMtGN9/7er/TeonjQ0XBvjYvTomy3b5aCLVWRvEfKu2g1sDd8uhr62RY/HfMgidEt7LHDolkCVg+6JzY3OTcgeHga3cvYObOYPplxw1YPq5+BqqxaUW4nfb5DtK33bZBYMeyV6BZtSggc5Z/19aPx/s0bf6ySTUyB3lRqe5d3etCns4bGidORCl/6EZiXwVcPvmYmxYXqmuNWfps7isUvo From 134b4aead41cc0a95cc570bfcf18f2a879b1da29 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:53:45 +0100 Subject: [PATCH 133/202] Integrate in central config --- config/packages/dev/monolog.yaml | 20 -------- config/packages/monolog.yml | 68 ++++++++++++++++++++++++++ config/packages/prod/monolog.yaml | 16 ------ config/packages/smoketest/monolog.yaml | 12 ----- config/packages/test/monolog.yaml | 12 ----- 5 files changed, 68 insertions(+), 60 deletions(-) delete mode 100644 config/packages/dev/monolog.yaml delete mode 100644 config/packages/prod/monolog.yaml delete mode 100644 config/packages/smoketest/monolog.yaml delete mode 100644 config/packages/test/monolog.yaml diff --git a/config/packages/dev/monolog.yaml b/config/packages/dev/monolog.yaml deleted file mode 100644 index 7bb5f7d9..00000000 --- a/config/packages/dev/monolog.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# The monolog configuration below overwrites the in logging.yml that -# is normally used for production. -monolog: - handlers: - prod-signaler: - type: fingers_crossed - action_level: ERROR - passthru_level: DEBUG # DEV setting: this means that all message of level DEBUG or higher are always logged - handler: main_syslog - bubble: true - main_syslog: - type: syslog - ident: stepup-ra - facility: user - formatter: surfnet_stepup.monolog.json_formatter - main_logfile: - type: stream - handler: logfile - level: NOTICE - path: "%kernel.logs_dir%/%kernel.environment%.log" \ No newline at end of file diff --git a/config/packages/monolog.yml b/config/packages/monolog.yml index f431e042..d89e43bb 100644 --- a/config/packages/monolog.yml +++ b/config/packages/monolog.yml @@ -11,3 +11,71 @@ monolog: ident: stepup-ra facility: user formatter: surfnet_stepup.monolog.json_formatter + +when@prod: + monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + excluded_http_codes: [ 404, 405 ] + buffer_size: 50 # How many messages should be saved? Prevent memory leaks + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + console: + type: console + process_psr_3_messages: false + channels: [ "!event", "!doctrine" ] + +when@dev: + # The monolog configuration below overwrites the in logging.yml that + # is normally used for production. + monolog: + handlers: + prod-signaler: + type: fingers_crossed + action_level: ERROR + passthru_level: DEBUG # DEV setting: this means that all message of level DEBUG or higher are always logged + handler: main_syslog + bubble: true + main_syslog: + type: syslog + ident: stepup-ra + facility: user + formatter: surfnet_stepup.monolog.json_formatter + main_logfile: + type: stream + handler: logfile + level: NOTICE + path: "%kernel.logs_dir%/%kernel.environment%.log" + +when@smoketest: + monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + excluded_http_codes: [ 404, 405 ] + channels: [ "!event" ] + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug + +when@test: + monolog: + handlers: + main: + type: fingers_crossed + action_level: error + handler: nested + excluded_http_codes: [ 404, 405 ] + channels: [ "!event" ] + nested: + type: stream + path: "%kernel.logs_dir%/%kernel.environment%.log" + level: debug diff --git a/config/packages/prod/monolog.yaml b/config/packages/prod/monolog.yaml deleted file mode 100644 index bfe69c01..00000000 --- a/config/packages/prod/monolog.yaml +++ /dev/null @@ -1,16 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - excluded_http_codes: [404, 405] - buffer_size: 50 # How many messages should be saved? Prevent memory leaks - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug - console: - type: console - process_psr_3_messages: false - channels: ["!event", "!doctrine"] diff --git a/config/packages/smoketest/monolog.yaml b/config/packages/smoketest/monolog.yaml deleted file mode 100644 index fc40641d..00000000 --- a/config/packages/smoketest/monolog.yaml +++ /dev/null @@ -1,12 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - excluded_http_codes: [404, 405] - channels: ["!event"] - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug diff --git a/config/packages/test/monolog.yaml b/config/packages/test/monolog.yaml deleted file mode 100644 index fc40641d..00000000 --- a/config/packages/test/monolog.yaml +++ /dev/null @@ -1,12 +0,0 @@ -monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - excluded_http_codes: [404, 405] - channels: ["!event"] - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug From 62e2867d3d8ce3d401e0bfa8fcb8bf668b153f9f Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:53:55 +0100 Subject: [PATCH 134/202] Integrate in central config --- config/packages/dev/framework.yaml | 4 ---- config/packages/framework.yaml | 27 ++++++++++++++++++++++++ config/packages/smoketest/framework.yaml | 11 ---------- config/packages/test/framework.yaml | 6 ------ 4 files changed, 27 insertions(+), 21 deletions(-) delete mode 100644 config/packages/dev/framework.yaml delete mode 100644 config/packages/smoketest/framework.yaml delete mode 100644 config/packages/test/framework.yaml diff --git a/config/packages/dev/framework.yaml b/config/packages/dev/framework.yaml deleted file mode 100644 index 75446472..00000000 --- a/config/packages/dev/framework.yaml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - router: - strict_requirements: true - profiler: { only_exceptions: false } \ No newline at end of file diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 60736ee2..00001dd6 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -24,3 +24,30 @@ framework: error_controller: Surfnet\StepupRa\RaBundle\Controller\ExceptionController::show php_errors: log: true + +when@dev: + framework: + router: + strict_requirements: true + profiler: { only_exceptions: false } + +when@smoketest: + imports: + - { resource: './services_smoketest.yaml' } + + framework: + test: ~ + session: + storage_factory_id: session.storage.factory.mock_file + profiler: { only_exceptions: false } + php_errors: + log: false # prevents user deprecated warnings + +when@test: + framework: + test: ~ + session: + storage_factory_id: session.storage.factory.mock_file + profiler: + collect: false + diff --git a/config/packages/smoketest/framework.yaml b/config/packages/smoketest/framework.yaml deleted file mode 100644 index 0175ac4b..00000000 --- a/config/packages/smoketest/framework.yaml +++ /dev/null @@ -1,11 +0,0 @@ -imports: - - { resource: './services_smoketest.yaml' } - -framework: - test: ~ - session: - storage_factory_id: session.storage.factory.mock_file - profiler: - collect: false - php_errors: - log: false # prevents user deprecated warnings diff --git a/config/packages/test/framework.yaml b/config/packages/test/framework.yaml deleted file mode 100644 index dbf8bf02..00000000 --- a/config/packages/test/framework.yaml +++ /dev/null @@ -1,6 +0,0 @@ -framework: - test: ~ - session: - storage_factory_id: session.storage.factory.mock_file - profiler: - collect: false From ff7114b47cce799ab84c76a1c7f46304e7a98af4 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:54:01 +0100 Subject: [PATCH 135/202] Integrate in central config --- config/packages/{smoketest => }/services_smoketest.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config/packages/{smoketest => }/services_smoketest.yaml (100%) diff --git a/config/packages/smoketest/services_smoketest.yaml b/config/packages/services_smoketest.yaml similarity index 100% rename from config/packages/smoketest/services_smoketest.yaml rename to config/packages/services_smoketest.yaml From f689dc1e6a7e5ee208b3d9481e851a2e74a2df75 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:54:29 +0100 Subject: [PATCH 136/202] Integrate in central config --- .../smoketest/surfnet_stepup_middleware_client.yaml | 3 --- .../packages/surfnet_stepup_middleware_client.yaml | 12 +++++++++++- .../test/surfnet_stepup_middleware_client.yaml | 3 --- 3 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 config/packages/smoketest/surfnet_stepup_middleware_client.yaml delete mode 100644 config/packages/test/surfnet_stepup_middleware_client.yaml diff --git a/config/packages/smoketest/surfnet_stepup_middleware_client.yaml b/config/packages/smoketest/surfnet_stepup_middleware_client.yaml deleted file mode 100644 index 16a976a4..00000000 --- a/config/packages/smoketest/surfnet_stepup_middleware_client.yaml +++ /dev/null @@ -1,3 +0,0 @@ -surfnet_stepup_middleware_client: - authorisation: - password: secret \ No newline at end of file diff --git a/config/packages/surfnet_stepup_middleware_client.yaml b/config/packages/surfnet_stepup_middleware_client.yaml index 36c32e90..c6d77419 100644 --- a/config/packages/surfnet_stepup_middleware_client.yaml +++ b/config/packages/surfnet_stepup_middleware_client.yaml @@ -4,4 +4,14 @@ surfnet_stepup_middleware_client: password: "%middleware_credentials_password%" url: command_api: "%middleware_url_command_api%" - api: "%middleware_url_api%" \ No newline at end of file + api: "%middleware_url_api%" + +when@smoketest: + surfnet_stepup_middleware_client: + authorisation: + password: secret + +when@test: + surfnet_stepup_middleware_client: + authorisation: + password: secret diff --git a/config/packages/test/surfnet_stepup_middleware_client.yaml b/config/packages/test/surfnet_stepup_middleware_client.yaml deleted file mode 100644 index 16a976a4..00000000 --- a/config/packages/test/surfnet_stepup_middleware_client.yaml +++ /dev/null @@ -1,3 +0,0 @@ -surfnet_stepup_middleware_client: - authorisation: - password: secret \ No newline at end of file From b40f4cebd58653487465e9486db75eb8e5387fdd Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 12:58:40 +0100 Subject: [PATCH 137/202] Integrate in central config --- config/packages/monolog.yml | 3 +-- config/packages/prod/deprecations.yaml | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 config/packages/prod/deprecations.yaml diff --git a/config/packages/monolog.yml b/config/packages/monolog.yml index d89e43bb..89cab9fa 100644 --- a/config/packages/monolog.yml +++ b/config/packages/monolog.yml @@ -31,8 +31,6 @@ when@prod: channels: [ "!event", "!doctrine" ] when@dev: - # The monolog configuration below overwrites the in logging.yml that - # is normally used for production. monolog: handlers: prod-signaler: @@ -66,6 +64,7 @@ when@smoketest: path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug + when@test: monolog: handlers: diff --git a/config/packages/prod/deprecations.yaml b/config/packages/prod/deprecations.yaml deleted file mode 100644 index 920a0619..00000000 --- a/config/packages/prod/deprecations.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists -#monolog: -# channels: [deprecation] -# handlers: -# deprecation: -# type: stream -# channels: [deprecation] -# path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" From 1c18ab6031d01cbae5a995dd7a166cab4eb60889 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:00:29 +0100 Subject: [PATCH 138/202] Integrate in central config --- config/packages/smoketest/validator.yaml | 3 --- config/packages/test/validator.yaml | 3 --- config/packages/validator.yaml | 10 ++++++++++ 3 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 config/packages/smoketest/validator.yaml delete mode 100644 config/packages/test/validator.yaml diff --git a/config/packages/smoketest/validator.yaml b/config/packages/smoketest/validator.yaml deleted file mode 100644 index 1e5ab788..00000000 --- a/config/packages/smoketest/validator.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - validation: - not_compromised_password: false diff --git a/config/packages/test/validator.yaml b/config/packages/test/validator.yaml deleted file mode 100644 index 1e5ab788..00000000 --- a/config/packages/test/validator.yaml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - validation: - not_compromised_password: false diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml index 350786a1..2ee588c0 100644 --- a/config/packages/validator.yaml +++ b/config/packages/validator.yaml @@ -6,3 +6,13 @@ framework: # For instance, basic validation constraints will be inferred from Doctrine's metadata. #auto_mapping: # App\Entity\: [] + +when@smoketest: + framework: + validation: + not_compromised_password: false + +when@test: + framework: + validation: + not_compromised_password: false From 41109cf7470594d51a9c88396a88f19f77be991e Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:02:07 +0100 Subject: [PATCH 139/202] Integrate in central config --- config/packages/smoketest/twig.yaml | 2 -- config/packages/test/twig.yaml | 2 -- config/packages/twig.yaml | 9 +++++++++ 3 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 config/packages/smoketest/twig.yaml delete mode 100644 config/packages/test/twig.yaml diff --git a/config/packages/smoketest/twig.yaml b/config/packages/smoketest/twig.yaml deleted file mode 100644 index 8c6e0b40..00000000 --- a/config/packages/smoketest/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/config/packages/test/twig.yaml b/config/packages/test/twig.yaml deleted file mode 100644 index 8c6e0b40..00000000 --- a/config/packages/test/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 48684c67..d822f086 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -9,3 +9,12 @@ twig: globals: global_view_parameters: "@ra.service.global_view_parameters" form_themes: ['bootstrap_3_horizontal_layout.html.twig', 'form/fields.html.twig'] + +when@smoketest: + twig: + strict_variables: true + +when@test: + twig: + strict_variables: true + From fb3a60217c293a4743c037f2e42633cc9cf586f2 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:06:54 +0100 Subject: [PATCH 140/202] Integrate in central config --- config/packages/dev/nelmio_security.yaml | 6 ------ config/packages/nelmio_security.yaml | 11 +++++++++++ config/packages/smoketest/nelmio_security.yaml | 6 ------ config/packages/test/nelmio_security.yaml | 6 ------ 4 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 config/packages/dev/nelmio_security.yaml delete mode 100644 config/packages/smoketest/nelmio_security.yaml delete mode 100644 config/packages/test/nelmio_security.yaml diff --git a/config/packages/dev/nelmio_security.yaml b/config/packages/dev/nelmio_security.yaml deleted file mode 100644 index 5276553c..00000000 --- a/config/packages/dev/nelmio_security.yaml +++ /dev/null @@ -1,6 +0,0 @@ -nelmio_security: - csp: - enforce: - img-src: [ self, 'data:' ] - script-src: [ self, unsafe-inline ] - style-src: [ self, unsafe-inline ] diff --git a/config/packages/nelmio_security.yaml b/config/packages/nelmio_security.yaml index 3edb2b00..623f39ae 100644 --- a/config/packages/nelmio_security.yaml +++ b/config/packages/nelmio_security.yaml @@ -32,3 +32,14 @@ nelmio_security: enabled: true hsts_max_age: 31536000 # 365 days hsts_subdomains: true + +when@smoketest: &nelmio_security_smoketest + nelmio_security: + csp: + enforce: + img-src: [ self, 'data:' ] + script-src: [ self, unsafe-inline ] + style-src: [ self, unsafe-inline ] + +when@test: *nelmio_security_smoketest # Use the same settings as smoketest +when@dev: *nelmio_security_smoketest # Use the same settings as smoketest diff --git a/config/packages/smoketest/nelmio_security.yaml b/config/packages/smoketest/nelmio_security.yaml deleted file mode 100644 index 5276553c..00000000 --- a/config/packages/smoketest/nelmio_security.yaml +++ /dev/null @@ -1,6 +0,0 @@ -nelmio_security: - csp: - enforce: - img-src: [ self, 'data:' ] - script-src: [ self, unsafe-inline ] - style-src: [ self, unsafe-inline ] diff --git a/config/packages/test/nelmio_security.yaml b/config/packages/test/nelmio_security.yaml deleted file mode 100644 index 5276553c..00000000 --- a/config/packages/test/nelmio_security.yaml +++ /dev/null @@ -1,6 +0,0 @@ -nelmio_security: - csp: - enforce: - img-src: [ self, 'data:' ] - script-src: [ self, unsafe-inline ] - style-src: [ self, unsafe-inline ] From 800cd9e5a2b53e2a759abac65f6cd789e6ab69e1 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:11:51 +0100 Subject: [PATCH 141/202] Remove obsolete code --- ci/qa/phpstan-baseline.php | 20 ------- src/Surfnet/NoDebugFunctionRule.php | 56 ------------------- .../RaBundle/Resources/config/security.yml | 5 -- 3 files changed, 81 deletions(-) delete mode 100755 src/Surfnet/NoDebugFunctionRule.php diff --git a/ci/qa/phpstan-baseline.php b/ci/qa/phpstan-baseline.php index b67e00ae..08f92d6d 100644 --- a/ci/qa/phpstan-baseline.php +++ b/ci/qa/phpstan-baseline.php @@ -656,16 +656,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$preferredLocale on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Cannot call method getUser\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/LogoutSuccessHandler.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot access property \\$authorizations on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', 'count' => 1, @@ -1121,16 +1111,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Exception/UnknownProviderException.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Cannot access property \\$childNodes on DOMElement\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Negated boolean expression is always false\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/Metadata.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot call method getLocale\\(\\) on Symfony\\\\Component\\\\HttpFoundation\\\\Request\\|null\\.$#', 'count' => 1, diff --git a/src/Surfnet/NoDebugFunctionRule.php b/src/Surfnet/NoDebugFunctionRule.php deleted file mode 100755 index f5cae130..00000000 --- a/src/Surfnet/NoDebugFunctionRule.php +++ /dev/null @@ -1,56 +0,0 @@ - - */ - public function processNode(Node $node, Scope $scope): array - { - if (!$node instanceof FuncCall) { - return []; - } - - if (!$node->name instanceof Node\Name) { - return []; - } - - $functionName = $node->name->toString(); - if (in_array($functionName, ['dd', 'dump', 'var_dump', 'print_r', 'exit', 'die'])) { - return ["Do not use {$functionName} function"]; - } - - return []; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index 976cb02e..c76f8948 100755 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -117,9 +117,4 @@ services: arguments: - "%ra.security.authentication.session.maximum_relative_lifetime_in_seconds%" - ra.security.authentication.handler.logout_success: - class: Surfnet\StepupRa\RaBundle\Security\Authentication\Handler\LogoutSuccessHandler - arguments: - - "@security.token_storage" - - "%logout_redirect_url%" From aed2e20292e09cc2f9f5dbce759abb5cdeaaa0ff Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:13:14 +0100 Subject: [PATCH 142/202] Use alias --- config/packages/twig.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index d822f086..c4e9b538 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -10,11 +10,9 @@ twig: global_view_parameters: "@ra.service.global_view_parameters" form_themes: ['bootstrap_3_horizontal_layout.html.twig', 'form/fields.html.twig'] -when@smoketest: +when@smoketest: &twig_smoketest twig: strict_variables: true -when@test: - twig: - strict_variables: true +when@test: *twig_smoketest # Use the same settings as smoketest From 19160397578296a2dfa7f99b1abdc305a2742234 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:14:09 +0100 Subject: [PATCH 143/202] Use alias --- config/packages/validator.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml index 2ee588c0..9f1a0fda 100644 --- a/config/packages/validator.yaml +++ b/config/packages/validator.yaml @@ -7,12 +7,9 @@ framework: #auto_mapping: # App\Entity\: [] -when@smoketest: +when@smoketest: &smoketest framework: validation: not_compromised_password: false -when@test: - framework: - validation: - not_compromised_password: false +when@test: *smoketest # Use the same configuration as smoketest From 18294f7c45f60954d81681db94421d07416f6153 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 13:15:18 +0100 Subject: [PATCH 144/202] Use alias --- config/packages/monolog.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/config/packages/monolog.yml b/config/packages/monolog.yml index 89cab9fa..9880fd95 100644 --- a/config/packages/monolog.yml +++ b/config/packages/monolog.yml @@ -50,7 +50,7 @@ when@dev: level: NOTICE path: "%kernel.logs_dir%/%kernel.environment%.log" -when@smoketest: +when@smoketest: &smoketest monolog: handlers: main: @@ -64,17 +64,4 @@ when@smoketest: path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug - -when@test: - monolog: - handlers: - main: - type: fingers_crossed - action_level: error - handler: nested - excluded_http_codes: [ 404, 405 ] - channels: [ "!event" ] - nested: - type: stream - path: "%kernel.logs_dir%/%kernel.environment%.log" - level: debug +when@test: *smoketest # Use the same configuration as smoketest From 377475af159d0e6a31c38c66cde90be96e97a525 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 14:20:02 +0100 Subject: [PATCH 145/202] Remove dead code --- .../Handler/AuthenticatedUserHandler.php | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php deleted file mode 100755 index 77bcaac5..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticatedUserHandler.php +++ /dev/null @@ -1,62 +0,0 @@ -tokenStorage->getToken() !== null - && $this->sessionLifetimeGuard->sessionLifetimeWithinLimits($this->sessionStateHandler) - ) { - $this->logger->notice('Logged in user with a session within time limits detected, updating session state'); - - // see ExplicitSessionTimeoutHandler for the rationale - if ($event->getRequest()->getMethod() === 'GET') { - $this->sessionStateHandler->setCurrentRequestUri($event->getRequest()->getRequestUri()); - } - $this->sessionStateHandler->updateLastInteractionMoment(); - - return; - } - - $this->nextHandler?->process($event); - } - - public function setNext(AuthenticationHandler $handler): void - { - $this->nextHandler = $handler; - } -} From abc6a0eccbc849fe2b55ac8e7b1a34c876f52c22 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 14:38:46 +0100 Subject: [PATCH 146/202] Remove dead code --- .../RaBundle/Resources/config/security.yml | 61 ----------- .../Handler/AuthenticationHandler.php | 35 ------ .../Handler/ExplicitSessionTimeoutHandler.php | 100 ------------------ .../InitiateSamlAuthenticationHandler.php | 90 ---------------- 4 files changed, 286 deletions(-) delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index c76f8948..09833a1a 100755 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -7,14 +7,6 @@ services: - "@ra.security.authentication.saml_interaction" - "@logger" - ra.security.authentication.provider.saml: - class: Surfnet\StepupRa\RaBundle\Security\Authentication\Provider\SamlProvider - arguments: - - '@ra.service.identity' - - "@ra.service.profile" - - "@surfnet_saml.saml.attribute_dictionary" - - "@logger" - ra.security.authentication.saml_interaction: public: false class: Surfnet\StepupRa\RaBundle\Security\Authentication\SamlInteractionProvider @@ -33,59 +25,6 @@ services: factory: ["@surfnet_stepup.service.loa_resolution", getLoa] arguments: ["%surfnet_stepup_ra.security.required_loa%"] - # Authentication Handlers - ra.security.authentication.handler.authenticated_user_handler: - public: false - class: Surfnet\StepupRa\RaBundle\Security\Authentication\Handler\AuthenticatedUserHandler - arguments: - - "@security.token_storage" - - "@ra.security.authentication.session.session_lifetime_guard" - - "@ra.security.authentication.session.session_storage" - - "@logger" - calls: - - ["setNext", ["@ra.security.authentication.handler.explicit_session_timeout"]] - - ra.security.authentication.handler.explicit_session_timeout: - public: false - class: Surfnet\StepupRa\RaBundle\Security\Authentication\Handler\ExplicitSessionTimeoutHandler - arguments: - - "@security.token_storage" - - "@ra.security.authentication.session.session_storage" - - "@ra.security.authentication.session.session_lifetime_guard" - - "@security.logout.handler.session" - - "@security.logout.handler.cookie_clearing.saml_based" - - "@router" - - "@logger" - calls: - - ["setNext", ["@ra.security.authentication.handler.initiate_saml_request"]] - - ra.security.authentication.handler.initiate_saml_request: - public: false - class: Surfnet\StepupRa\RaBundle\Security\Authentication\Handler\InitiateSamlAuthenticationHandler - arguments: - - "@security.token_storage" - - "@ra.security.authentication.session.session_storage" - - "@ra.security.authentication.session.session_storage" - - "@ra.security.authentication.saml_interaction" - - "@router" - - "@surfnet_saml.logger" - - "@logger" - calls: - - ["setNext", ["@ra.security.authentication.handler.process_saml_response"]] - - ra.security.authentication.handler.process_saml_response: - public: false - class: Surfnet\StepupRa\RaBundle\Security\Authentication\Handler\ProcessSamlAuthenticationHandler - arguments: - - "@security.token_storage" - - "@ra.security.authentication.saml_interaction" - - "@ra.security.authentication.session.session_storage" - - "@ra.security.authentication.session.session_storage" - - "@security.authentication.manager" - - "@surfnet_stepup.service.loa_resolution" - - "@surfnet_saml.logger" - - "@twig" - # Session ra.security.authentication.session.session_storage: public: true diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php deleted file mode 100755 index 0791c167..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/AuthenticationHandler.php +++ /dev/null @@ -1,35 +0,0 @@ -tokenStorage->getToken() !== null - && !$this->sessionLifetimeGuard->sessionLifetimeWithinLimits($this->authenticatedSession) - ) { - $invalidatedBy = []; - if (!$this->sessionLifetimeGuard->sessionLifetimeWithinAbsoluteLimit($this->authenticatedSession)) { - $invalidatedBy[] = 'absolute'; - } - - if (!$this->sessionLifetimeGuard->sessionLifetimeWithinRelativeLimit($this->authenticatedSession)) { - $invalidatedBy[] = 'relative'; - } - - $this->logger->notice(sprintf( - 'Authenticated user found, but session was determined to be outside of the "%s" time limit. User will ' - . 'be logged out and redirected to session-expired page to attempt new login.', - implode(' and ', $invalidatedBy), - )); - - $token = $this->tokenStorage->getToken(); - $request = $event->getRequest(); - - // if the current request was not a GET request we cannot safely redirect to that page after login as it - // may require a form resubmit for instance. Therefore, we redirect to the last GET request (either current - // or previous). - $afterLoginRedirectTo = $this->authenticatedSession->getCurrentRequestUri(); - if ($event->getRequest()->getMethod() === 'GET') { - $afterLoginRedirectTo = $event->getRequest()->getRequestUri(); - } - - // log the user out using Symfony methodology, see the LogoutListener - $event->setResponse(new RedirectResponse($this->router->generate('ra_security_session_expired'))); - - $this->sessionLogoutHandler->logout($request, $event->getResponse(), $token); - $this->cookieClearingLogoutHandler->logout($request, $event->getResponse(), $token); - $this->tokenStorage->setToken(); - - // the session is restarted after invalidation during the logout, so we can (re)store the last GET request - $this->authenticatedSession->setCurrentRequestUri($afterLoginRedirectTo); - - return; - } - - $this->nextHandler?->process($event); - } - - public function setNext(AuthenticationHandler $handler): void - { - $this->nextHandler = $handler; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php b/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php deleted file mode 100755 index faf46338..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php +++ /dev/null @@ -1,90 +0,0 @@ -router->generate('ra_serviceprovider_consume_assertion'); - - // we have no logged in user, and have sent an authentication request, but do not receive a response POSTed - // back to our ACS. This means that a user may have inadvertedly triggered the sending of an AuthnRequest - // one of the common causes of this is the prefetching of pages by browsers to give users the illusion of speed. - // In any case, we reset the login and send a new AuthnRequest. - if ($this->tokenStorage->getToken() === null - && $this->samlInteractionProvider->isSamlAuthenticationInitiated() - && $event->getRequest()->getMethod() !== 'POST' - && $event->getRequest()->getRequestUri() !== $acsUri - ) { - $this->logger->notice( - 'No authenticated user, a AuthnRequest was sent, but the current request is not a POST to our ACS ' - . 'thus we assume the user attempts to access the application again (possibly after a browser ' - . 'prefetch). Resetting the login state so that a new AuthnRequest can be sent.', - ); - - $this->samlInteractionProvider->reset(); - } - - if ($this->tokenStorage->getToken() === null - && !$this->samlInteractionProvider->isSamlAuthenticationInitiated() - ) { - $this->logger->notice('No authenticated user, no saml AuthnRequest pending, sending new AuthnRequest'); - - $this->authenticatedSession->setCurrentRequestUri($event->getRequest()->getUri()); - $event->setResponse($this->samlInteractionProvider->initiateSamlRequest()); - - $logger = $this->authenticationLogger->forAuthentication( - $this->samlAuthenticationStateHandler->getRequestId(), - ); - $logger->notice('Sending AuthnRequest'); - - return; - } - - $this->nextHandler?->process($event); - } - - public function setNext(AuthenticationHandler $handler): void - { - $this->nextHandler = $handler; - } -} From 31a336e09d17d0bb905d119a147412e23bf58ce0 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 14:55:00 +0100 Subject: [PATCH 147/202] Remove dead code --- .../RaBundle/Resources/config/security.yml | 8 --- .../Security/Firewall/SamlListener.php | 65 ------------------- 2 files changed, 73 deletions(-) delete mode 100755 src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml index 09833a1a..6deb343d 100755 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/security.yml @@ -1,12 +1,4 @@ services: - # Firewall - ra.security.authentication.listener: - class: Surfnet\StepupRa\RaBundle\Security\Firewall\SamlListener - arguments: - - "@ra.security.authentication.handler.authenticated_user_handler" - - "@ra.security.authentication.saml_interaction" - - "@logger" - ra.security.authentication.saml_interaction: public: false class: Surfnet\StepupRa\RaBundle\Security\Authentication\SamlInteractionProvider diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php b/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php deleted file mode 100755 index 9863e35c..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Security/Firewall/SamlListener.php +++ /dev/null @@ -1,65 +0,0 @@ -authenticationHandler->process($event); - } catch (AuthenticationException $exception) { - $this->samlInteractionProvider->reset(); - - $this->logger->warning(sprintf( - 'Could not authenticate, AuthenticationException encountered: "%s"', - $exception->getMessage(), - )); - - throw $exception; - } catch (Exception $exception) { - $this->samlInteractionProvider->reset(); - - $this->logger->error(sprintf( - 'Could not authenticate, Exception of type "%s" encountered: %s', - $exception::class, - $exception->getMessage(), - )); - - throw $exception; - } - } -} From 65fc86a08aff0ce3d004e3dbcaca5945c5a24cd6 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 15:39:58 +0100 Subject: [PATCH 148/202] Github actions update --- .github/workflows/test-integration.yml | 66 +++++++++----------------- composer.json | 2 +- 2 files changed, 23 insertions(+), 45 deletions(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index cb134868..d8af7a30 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -1,48 +1,26 @@ -name: test-integration -on: - pull_request: - push: - branches: [ master, develop ] +name: Run QA tests (static analysis, lint and unit tests) +on: [pull_request] + jobs: - build: + run-qa-tests: runs-on: ubuntu-latest - timeout-minutes: 5 + defaults: + run: + working-directory: /var/www/html/ + container: + image: ghcr.io/openconext/openconext-basecontainers/php82-apache2-node20-composer2:latest + volumes: + - .:/var/www/html + steps: - name: Checkout - uses: actions/checkout@v1 - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Init environment - run: | - cd ci/docker - docker-compose up -d - - name: Install dependencies - run: | - cd ci/docker && docker-compose exec -T stepup-ra bash -lc ' - composer install - yarn - ./bin/console assets:install - ' - - name: Build frontend assets - run: cd ci/docker && docker-compose exec -T stepup-ra bash -lc 'yarn encore production' - - name: Run test scripts - run: cd ci/docker && docker-compose exec -T stepup-ra bash -lc ' composer test ' - - name: Output log files on failure - if: failure() - run: cd ci/docker && docker-compose exec -T stepup-ra -c 'cat var/log/webtest.log' + uses: actions/checkout@v4 + + - name: Composer install + run: composer install + + - name: Yarn install + run: yarn + + - name: Run QA tests + run: composer check diff --git a/composer.json b/composer.json index 9ba5b713..e035af06 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,7 @@ "yarn install", "yarn encore production" ], - "test": [ + "check": [ "@phplint", "@phpmd", "@phpcs", From b42303ba8dd388e47904c31d06b4f73b78692be2 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 15:43:28 +0100 Subject: [PATCH 149/202] Github actions update --- ci/qa/phpstan-baseline.php | 40 -------------------------------------- 1 file changed, 40 deletions(-) diff --git a/ci/qa/phpstan-baseline.php b/ci/qa/phpstan-baseline.php index 08f92d6d..2a59ec13 100644 --- a/ci/qa/phpstan-baseline.php +++ b/ci/qa/phpstan-baseline.php @@ -616,46 +616,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/AuthenticatedSessionStateHandler.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Call to method logout\\(\\) on an unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\CookieClearingLogoutHandler\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Call to method logout\\(\\) on an unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\SessionLogoutHandler\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\Storage\\\\TokenStorageInterface\\:\\:setToken\\(\\) invoked with 0 parameters, 1 required\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\$cookieClearingLogoutHandler of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:__construct\\(\\) has invalid type Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\CookieClearingLogoutHandler\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\$sessionLogoutHandler of method Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:__construct\\(\\) has invalid type Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\SessionLogoutHandler\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:\\$cookieClearingLogoutHandler has unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\CookieClearingLogoutHandler as its type\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Surfnet\\\\StepupRa\\\\RaBundle\\\\Security\\\\Authentication\\\\Handler\\\\ExplicitSessionTimeoutHandler\\:\\:\\$sessionLogoutHandler has unknown class Symfony\\\\Component\\\\Security\\\\Http\\\\Logout\\\\SessionLogoutHandler as its type\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/ExplicitSessionTimeoutHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#1 \\$requestId of method Surfnet\\\\SamlBundle\\\\Monolog\\\\SamlAuthenticationLogger\\:\\:forAuthentication\\(\\) expects string, string\\|null given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/StepupRa/RaBundle/Security/Authentication/Handler/InitiateSamlAuthenticationHandler.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot access property \\$authorizations on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\Profile\\|null\\.$#', 'count' => 1, From 11b6b520baae871a17d30a9a225fb238c2720a8a Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 15:48:33 +0100 Subject: [PATCH 150/202] Add php 8.2 --- .scrutinizer.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 988fc128..cf9d8088 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,3 +1,8 @@ +build: + environment: + php: + version: 8.2 + filter: excluded_paths: - "*/Tests/*" From 3fd5acb1d3eb9fbef7ef73d9ffe42ad56599b6a0 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 16:10:09 +0100 Subject: [PATCH 151/202] Set nodejs version --- .scrutinizer.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index cf9d8088..b1f31381 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,8 @@ build: environment: php: - version: 8.2 + version: 8.2.12 + node: 20.9.0 filter: excluded_paths: From a439eef036f77777d877f55d19e74c6f5713d8b4 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 16:29:47 +0100 Subject: [PATCH 152/202] Set nodejs version --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b1f31381..e885c080 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -2,7 +2,7 @@ build: environment: php: version: 8.2.12 - node: 20.9.0 + node: v20.5.1 filter: excluded_paths: From 671e5dbb591d0952c77cded5d52d04e001ef3e9b Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 17:11:11 +0100 Subject: [PATCH 153/202] Set nodejs version --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index e885c080..a529f833 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -2,7 +2,7 @@ build: environment: php: version: 8.2.12 - node: v20.5.1 + node: 20 filter: excluded_paths: From 6569fdc74c586d264ff9f45e74900697aef13eac Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 17:21:42 +0100 Subject: [PATCH 154/202] Set nodejs version --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index a529f833..b5065ae3 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -2,7 +2,7 @@ build: environment: php: version: 8.2.12 - node: 20 + node: v20.5.0 filter: excluded_paths: From 9bff656872f3f0370940c314d839051ac55b45b2 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Wed, 13 Mar 2024 17:41:58 +0100 Subject: [PATCH 155/202] Set nodejs version --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b5065ae3..b4445f39 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -2,7 +2,7 @@ build: environment: php: version: 8.2.12 - node: v20.5.0 +# node: v20.5.0 filter: excluded_paths: From e08838568079e8e2f56021bf33a07beebef3e56a Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 14 Mar 2024 05:50:12 +0100 Subject: [PATCH 156/202] Set node version --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index d0056272..4bba9dfc 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { "browserslist": "last 2 versions, ie 11, > 1%", + "engines" : { + "node" : ">=20.0.0" + }, "devDependencies": { "@babel/core": "^7.20.5", "@babel/preset-env": "^7.20.2", From 06a6ed0834da35babbab746db665ff0337817312 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Thu, 14 Mar 2024 06:34:33 +0100 Subject: [PATCH 157/202] Add license check --- .docheader | 15 + bin/copyright-correction.sh | 20 + ci/qa/docheader | 5 + composer.json | 6 + composer.lock | 404 ++++++++++-------- .../DependencyInjection/Configuration.php | 6 +- ...onConfigurationOptionsServiceInterface.php | 28 +- .../SecondFactorAssertionServiceTest.php | 16 + .../Provider/MetadataFactoryCollection.php | 2 +- 9 files changed, 315 insertions(+), 187 deletions(-) create mode 100755 .docheader create mode 100755 bin/copyright-correction.sh create mode 100755 ci/qa/docheader diff --git a/.docheader b/.docheader new file mode 100755 index 00000000..a12ddf88 --- /dev/null +++ b/.docheader @@ -0,0 +1,15 @@ +/** + * Copyright %regexp:\d{4}% SURFnet %regexp:(B.V.|bv)% + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/bin/copyright-correction.sh b/bin/copyright-correction.sh new file mode 100755 index 00000000..a1a4de88 --- /dev/null +++ b/bin/copyright-correction.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Get all PHP files in src/ directory +files=$(find src/ -type f -name "*.php") + +for file in $files +do + # Get the year of the first commit of the file + year=$(git log --follow --format=%ad --date=format:'%Y' $file | tail -1) + + # Check if year is a valid 4-digit number + if [[ ! $year =~ ^[0-9]{4}$ ]] + then + echo "Invalid year $year for file $file. Skipping..." + continue + fi + + # Replace the year in the copyright statement + sed -i "s/Copyright [0-9]\{4\} SURFnet bv/Copyright $year SURFnet bv/g" $file +done diff --git a/ci/qa/docheader b/ci/qa/docheader new file mode 100755 index 00000000..fedbc2e7 --- /dev/null +++ b/ci/qa/docheader @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd $(dirname $0)/../../ + +./vendor/bin/docheader --no-ansi check src/ tests/ diff --git a/composer.json b/composer.json index e035af06..4c3da6d6 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,7 @@ "twig/twig": "^3.0" }, "require-dev": { + "malukenho/docheader": "^1.0.0", "matthiasnoback/symfony-config-test": "^4.0", "mockery/mockery": "^1.0", "overtrue/phplint": "^9.0", @@ -91,11 +92,13 @@ "@phpmd", "@phpcs", "@jscpd", + "@license-headers", "@phpstan", "@phpunit", "@security-tests" ], "phplint": "./ci/qa/phplint", + "license-headers": "./ci/qa/docheader", "phpmd": "./ci/qa/phpmd", "phpcs": "./ci/qa/phpcs", "phpstan": "./ci/qa/phpstan", @@ -122,6 +125,9 @@ ] }, "config": { + "audit": { + "abandoned": "report" + }, "allow-plugins": { "symfony/flex": true, "dealerdirect/phpcodesniffer-composer-installer": true, diff --git a/composer.lock b/composer.lock index 192d55c6..83e82d4a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2e9cdea71b1003c4b69372e58dddfd07", + "content-hash": "2ae799130f922481ef0c6f6a96464c8b", "packages": [ { "name": "beberlei/assert", @@ -274,16 +274,16 @@ }, { "name": "doctrine/collections", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "07e16cd7b80a2cffed99e36b541876af172f0257" + "reference": "420480fc085bc65f3c956af13abe8e7546f94813" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/07e16cd7b80a2cffed99e36b541876af172f0257", - "reference": "07e16cd7b80a2cffed99e36b541876af172f0257", + "url": "https://api.github.com/repos/doctrine/collections/zipball/420480fc085bc65f3c956af13abe8e7546f94813", + "reference": "420480fc085bc65f3c956af13abe8e7546f94813", "shasum": "" }, "require": { @@ -340,7 +340,7 @@ ], "support": { "issues": "https://github.com/doctrine/collections/issues", - "source": "https://github.com/doctrine/collections/tree/2.2.0" + "source": "https://github.com/doctrine/collections/tree/2.2.1" }, "funding": [ { @@ -356,20 +356,20 @@ "type": "tidelift" } ], - "time": "2024-02-25T22:55:36+00:00" + "time": "2024-03-05T22:28:45+00:00" }, { "name": "doctrine/dbal", - "version": "4.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "53df8c432978b716a805143eb701436d54ec705e" + "reference": "9e588fe1f38a443cb17de6b86b803d9e028e2156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/53df8c432978b716a805143eb701436d54ec705e", - "reference": "53df8c432978b716a805143eb701436d54ec705e", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9e588fe1f38a443cb17de6b86b803d9e028e2156", + "reference": "9e588fe1f38a443cb17de6b86b803d9e028e2156", "shasum": "" }, "require": { @@ -382,16 +382,16 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.2", - "phpstan/phpstan": "1.10.57", + "phpstan/phpstan": "1.10.58", "phpstan/phpstan-phpunit": "1.3.15", "phpstan/phpstan-strict-rules": "^1.5", "phpunit/phpunit": "10.5.9", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.8.1", + "squizlabs/php_codesniffer": "3.9.0", "symfony/cache": "^6.3.8|^7.0", "symfony/console": "^5.4|^6.3|^7.0", - "vimeo/psalm": "5.16.0" + "vimeo/psalm": "5.21.1" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -448,7 +448,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/4.0.0" + "source": "https://github.com/doctrine/dbal/tree/4.0.1" }, "funding": [ { @@ -464,7 +464,7 @@ "type": "tidelift" } ], - "time": "2024-02-03T19:11:19+00:00" + "time": "2024-03-03T15:59:11+00:00" }, { "name": "doctrine/deprecations", @@ -844,28 +844,28 @@ }, { "name": "doctrine/orm", - "version": "3.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "2a250b5814de192a23438c0a43e15da7e77890a7" + "reference": "716fc97b70cf8116f74eaa0588eef51420874bf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/2a250b5814de192a23438c0a43e15da7e77890a7", - "reference": "2a250b5814de192a23438c0a43e15da7e77890a7", + "url": "https://api.github.com/repos/doctrine/orm/zipball/716fc97b70cf8116f74eaa0588eef51420874bf9", + "reference": "716fc97b70cf8116f74eaa0588eef51420874bf9", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/collections": "^2.1", + "doctrine/collections": "^2.2", "doctrine/dbal": "^3.8.2 || ^4", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3 || ^2", "doctrine/lexer": "^3", - "doctrine/persistence": "^3.1.1", + "doctrine/persistence": "^3.3.1", "ext-ctype": "*", "php": "^8.1", "psr/cache": "^1 || ^2 || ^3", @@ -875,12 +875,12 @@ "require-dev": { "doctrine/coding-standard": "^12.0", "phpbench/phpbench": "^1.0", - "phpstan/phpstan": "1.10.35", + "phpstan/phpstan": "1.10.59", "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^5.4 || ^6.2 || ^7.0", - "vimeo/psalm": "5.16.0" + "vimeo/psalm": "5.22.2" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", @@ -926,22 +926,22 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/3.0.1" + "source": "https://github.com/doctrine/orm/tree/3.1.0" }, - "time": "2024-02-22T12:23:53+00:00" + "time": "2024-03-03T17:45:20+00:00" }, { "name": "doctrine/persistence", - "version": "3.2.0", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "63fee8c33bef740db6730eb2a750cd3da6495603" + "reference": "477da35bd0255e032826f440b94b3e37f2d56f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/63fee8c33bef740db6730eb2a750cd3da6495603", - "reference": "63fee8c33bef740db6730eb2a750cd3da6495603", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/477da35bd0255e032826f440b94b3e37f2d56f42", + "reference": "477da35bd0255e032826f440b94b3e37f2d56f42", "shasum": "" }, "require": { @@ -1010,7 +1010,7 @@ ], "support": { "issues": "https://github.com/doctrine/persistence/issues", - "source": "https://github.com/doctrine/persistence/tree/3.2.0" + "source": "https://github.com/doctrine/persistence/tree/3.3.2" }, "funding": [ { @@ -1026,7 +1026,7 @@ "type": "tidelift" } ], - "time": "2023-05-17T18:32:04+00:00" + "time": "2024-03-12T14:54:36+00:00" }, { "name": "fortawesome/font-awesome", @@ -1464,16 +1464,16 @@ }, { "name": "jms/translation-bundle", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSTranslationBundle.git", - "reference": "ad89a56dfe9de9485b10dc5d8893665101cd2fa3" + "reference": "97bb596ca4b8feeb2c0264fd4477271fcc0d0949" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/ad89a56dfe9de9485b10dc5d8893665101cd2fa3", - "reference": "ad89a56dfe9de9485b10dc5d8893665101cd2fa3", + "url": "https://api.github.com/repos/schmittjoh/JMSTranslationBundle/zipball/97bb596ca4b8feeb2c0264fd4477271fcc0d0949", + "reference": "97bb596ca4b8feeb2c0264fd4477271fcc0d0949", "shasum": "" }, "require": { @@ -1546,22 +1546,22 @@ ], "support": { "issues": "https://github.com/schmittjoh/JMSTranslationBundle/issues", - "source": "https://github.com/schmittjoh/JMSTranslationBundle/tree/2.2.0" + "source": "https://github.com/schmittjoh/JMSTranslationBundle/tree/2.2.1" }, - "time": "2024-02-06T10:14:05+00:00" + "time": "2024-03-11T19:56:53+00:00" }, { "name": "knplabs/knp-components", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/KnpLabs/knp-components.git", - "reference": "ac704489426b090ea0e7ff4d1dd06e26baa49ee7" + "reference": "51f7053101ceb9c62af42ec08e6cfdee5fd64502" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/ac704489426b090ea0e7ff4d1dd06e26baa49ee7", - "reference": "ac704489426b090ea0e7ff4d1dd06e26baa49ee7", + "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/51f7053101ceb9c62af42ec08e6cfdee5fd64502", + "reference": "51f7053101ceb9c62af42ec08e6cfdee5fd64502", "shasum": "" }, "require": { @@ -1632,9 +1632,9 @@ ], "support": { "issues": "https://github.com/KnpLabs/knp-components/issues", - "source": "https://github.com/KnpLabs/knp-components/tree/v4.3.0" + "source": "https://github.com/KnpLabs/knp-components/tree/v4.3.1" }, - "time": "2023-10-16T09:30:16+00:00" + "time": "2024-03-09T08:43:32+00:00" }, { "name": "knplabs/knp-paginator-bundle", @@ -1813,16 +1813,16 @@ }, { "name": "nelmio/security-bundle", - "version": "v3.1.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/nelmio/NelmioSecurityBundle.git", - "reference": "9ae9fabf708ec5899cda46b2d764864bceaa9c8e" + "reference": "b9b68b4f06b7dd8a02d95780fe67885414422d5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nelmio/NelmioSecurityBundle/zipball/9ae9fabf708ec5899cda46b2d764864bceaa9c8e", - "reference": "9ae9fabf708ec5899cda46b2d764864bceaa9c8e", + "url": "https://api.github.com/repos/nelmio/NelmioSecurityBundle/zipball/b9b68b4f06b7dd8a02d95780fe67885414422d5f", + "reference": "b9b68b4f06b7dd8a02d95780fe67885414422d5f", "shasum": "" }, "require": { @@ -1880,22 +1880,22 @@ ], "support": { "issues": "https://github.com/nelmio/NelmioSecurityBundle/issues", - "source": "https://github.com/nelmio/NelmioSecurityBundle/tree/v3.1.1" + "source": "https://github.com/nelmio/NelmioSecurityBundle/tree/v3.2.0" }, - "time": "2024-01-17T14:32:52+00:00" + "time": "2024-03-08T08:58:40+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "2218c2252c874a4624ab2f613d86ac32d227bc69" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69", - "reference": "2218c2252c874a4624ab2f613d86ac32d227bc69", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { @@ -1938,9 +1938,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2024-02-21T19:24:10+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "openconext/monitor-bundle", @@ -3206,16 +3206,16 @@ }, { "name": "symfony/clock", - "version": "v6.4.3", + "version": "v6.4.5", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "f48770105c544001da00b8d745873a628e0de198" + "reference": "ecba44be4def12cd71e0460b956ab7e51a2c980e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/f48770105c544001da00b8d745873a628e0de198", - "reference": "f48770105c544001da00b8d745873a628e0de198", + "url": "https://api.github.com/repos/symfony/clock/zipball/ecba44be4def12cd71e0460b956ab7e51a2c980e", + "reference": "ecba44be4def12cd71e0460b956ab7e51a2c980e", "shasum": "" }, "require": { @@ -3260,7 +3260,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v6.4.3" + "source": "https://github.com/symfony/clock/tree/v6.4.5" }, "funding": [ { @@ -3276,7 +3276,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-03-01T14:02:27+00:00" }, { "name": "symfony/config", @@ -4019,16 +4019,16 @@ }, { "name": "symfony/flex", - "version": "v2.4.4", + "version": "v2.4.5", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "bec213c39511eda66663baa2ee7440c65f89c695" + "reference": "b0a405f40614c9f584b489d54f91091817b0e26e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/bec213c39511eda66663baa2ee7440c65f89c695", - "reference": "bec213c39511eda66663baa2ee7440c65f89c695", + "url": "https://api.github.com/repos/symfony/flex/zipball/b0a405f40614c9f584b489d54f91091817b0e26e", + "reference": "b0a405f40614c9f584b489d54f91091817b0e26e", "shasum": "" }, "require": { @@ -4064,7 +4064,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v2.4.4" + "source": "https://github.com/symfony/flex/tree/v2.4.5" }, "funding": [ { @@ -4080,7 +4080,7 @@ "type": "tidelift" } ], - "time": "2024-02-05T18:04:53+00:00" + "time": "2024-03-02T08:16:47+00:00" }, { "name": "symfony/form", @@ -4406,16 +4406,16 @@ }, { "name": "symfony/http-kernel", - "version": "v6.4.4", + "version": "v6.4.5", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "7a186f64a7f02787c04e8476538624d6aa888e42" + "reference": "f6947cb939d8efee137797382cb4db1af653ef75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7a186f64a7f02787c04e8476538624d6aa888e42", - "reference": "7a186f64a7f02787c04e8476538624d6aa888e42", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f6947cb939d8efee137797382cb4db1af653ef75", + "reference": "f6947cb939d8efee137797382cb4db1af653ef75", "shasum": "" }, "require": { @@ -4499,7 +4499,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.4" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.5" }, "funding": [ { @@ -4515,7 +4515,7 @@ "type": "tidelift" } ], - "time": "2024-02-27T06:32:13+00:00" + "time": "2024-03-04T21:00:47+00:00" }, { "name": "symfony/monolog-bridge", @@ -5537,16 +5537,16 @@ }, { "name": "symfony/routing", - "version": "v6.4.3", + "version": "v6.4.5", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "3b2957ad54902f0f544df83e3d58b38d7e8e5842" + "reference": "7fe30068e207d9c31c0138501ab40358eb2d49a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/3b2957ad54902f0f544df83e3d58b38d7e8e5842", - "reference": "3b2957ad54902f0f544df83e3d58b38d7e8e5842", + "url": "https://api.github.com/repos/symfony/routing/zipball/7fe30068e207d9c31c0138501ab40358eb2d49a4", + "reference": "7fe30068e207d9c31c0138501ab40358eb2d49a4", "shasum": "" }, "require": { @@ -5600,7 +5600,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.3" + "source": "https://github.com/symfony/routing/tree/v6.4.5" }, "funding": [ { @@ -5616,7 +5616,7 @@ "type": "tidelift" } ], - "time": "2024-01-30T13:55:02+00:00" + "time": "2024-02-27T12:33:30+00:00" }, { "name": "symfony/runtime", @@ -5699,16 +5699,16 @@ }, { "name": "symfony/security-bundle", - "version": "v6.4.4", + "version": "v6.4.5", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "dec0c2bbc3718e7afd5ddffb3679774aec60ad9a" + "reference": "b7825ec970f51fcc4982397856405728544df9ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/dec0c2bbc3718e7afd5ddffb3679774aec60ad9a", - "reference": "dec0c2bbc3718e7afd5ddffb3679774aec60ad9a", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/b7825ec970f51fcc4982397856405728544df9ce", + "reference": "b7825ec970f51fcc4982397856405728544df9ce", "shasum": "" }, "require": { @@ -5791,7 +5791,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v6.4.4" + "source": "https://github.com/symfony/security-bundle/tree/v6.4.5" }, "funding": [ { @@ -5807,7 +5807,7 @@ "type": "tidelift" } ], - "time": "2024-02-15T11:23:52+00:00" + "time": "2024-03-02T12:45:30+00:00" }, { "name": "symfony/security-core", @@ -7378,16 +7378,16 @@ "packages-dev": [ { "name": "composer/pcre", - "version": "3.1.1", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" + "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace", + "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace", "shasum": "" }, "require": { @@ -7429,7 +7429,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.1" + "source": "https://github.com/composer/pcre/tree/3.1.2" }, "funding": [ { @@ -7445,7 +7445,7 @@ "type": "tidelift" } ], - "time": "2023-10-11T07:11:09+00:00" + "time": "2024-03-07T15:38:35+00:00" }, { "name": "composer/xdebug-handler", @@ -7642,6 +7642,64 @@ }, "time": "2020-07-09T08:09:16+00:00" }, + { + "name": "malukenho/docheader", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/malukenho/docheader.git", + "reference": "263320d434c727a014650239c90240bbe808bd17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/malukenho/docheader/zipball/263320d434c727a014650239c90240bbe808bd17", + "reference": "263320d434c727a014650239c90240bbe808bd17", + "shasum": "" + }, + "require": { + "php": "^8.0", + "symfony/console": "^4.4 || ^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "mikey179/vfsstream": "^1.6.10", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.23 || ^5.0" + }, + "bin": [ + "bin/docheader" + ], + "type": "library", + "autoload": { + "psr-4": { + "DocHeader\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jefersson Nathan", + "email": "malukenho.dev@gmail.com" + } + ], + "description": "A small library to check header docs", + "homepage": "https://github.com/malukenho/docheader", + "keywords": [ + "Code style", + "code standard", + "license", + "static analysis" + ], + "support": { + "issues": "https://github.com/malukenho/docheader/issues", + "source": "https://github.com/malukenho/docheader/tree/1.1.0" + }, + "time": "2024-02-05T12:05:53+00:00" + }, { "name": "matthiasnoback/symfony-config-test", "version": "4.3.0", @@ -7703,7 +7761,7 @@ }, { "name": "mockery/mockery", - "version": "1.6.7", + "version": "1.6.9", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", @@ -7998,20 +8056,21 @@ }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -8052,9 +8111,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -8239,16 +8304,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.59", + "version": "1.10.62", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e607609388d3a6d418a50a49f7940e8086798281" + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", - "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd5c8a1660ed3540b211407c77abf4af193a6af9", + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9", "shasum": "" }, "require": { @@ -8297,20 +8362,20 @@ "type": "tidelift" } ], - "time": "2024-02-20T13:59:13+00:00" + "time": "2024-03-13T12:27:20+00:00" }, { "name": "phpstan/phpstan-symfony", - "version": "1.3.7", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "ef7db637be9b85fa00278fc3477ac66abe8eb7d1" + "reference": "d8a0bc03a68d95288b6471c37d435647fbdaff1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/ef7db637be9b85fa00278fc3477ac66abe8eb7d1", - "reference": "ef7db637be9b85fa00278fc3477ac66abe8eb7d1", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/d8a0bc03a68d95288b6471c37d435647fbdaff1a", + "reference": "d8a0bc03a68d95288b6471c37d435647fbdaff1a", "shasum": "" }, "require": { @@ -8367,22 +8432,22 @@ "description": "Symfony Framework extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.7" + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.8" }, - "time": "2024-01-10T21:54:42+00:00" + "time": "2024-03-05T16:33:08+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.30", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { @@ -8439,7 +8504,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -8447,7 +8512,7 @@ "type": "github" } ], - "time": "2023-12-22T06:47:57+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -8795,16 +8860,16 @@ }, { "name": "rector/rector", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d" + "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/258b775511e62a7188f8ce114d44acaf244d9a7d", - "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7596fa6da06c6a20c012efe6bb3d9188a9113b11", + "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11", "shasum": "" }, "require": { @@ -8839,7 +8904,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.1" + "source": "https://github.com/rectorphp/rector/tree/1.0.2" }, "funding": [ { @@ -8847,20 +8912,20 @@ "type": "github" } ], - "time": "2024-02-16T07:53:23+00:00" + "time": "2024-03-03T12:32:31+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -8895,7 +8960,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -8903,7 +8968,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -9149,16 +9214,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -9203,7 +9268,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -9211,7 +9276,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -9278,16 +9343,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -9343,7 +9408,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -9351,20 +9416,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -9407,7 +9472,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -9415,7 +9480,7 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -9702,6 +9767,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { @@ -9815,32 +9881,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.14.1", + "version": "8.15.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + "reference": "7d1d957421618a3803b593ec31ace470177d7817" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", + "reference": "7d1d957421618a3803b593ec31ace470177d7817", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", "phpstan/phpdoc-parser": "^1.23.1", - "squizlabs/php_codesniffer": "^3.7.1" + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.37", + "phpstan/phpstan": "1.10.60", "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.14", - "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + "phpstan/phpstan-phpunit": "1.3.16", + "phpstan/phpstan-strict-rules": "1.5.2", + "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" }, "type": "phpcodesniffer-standard", "extra": { @@ -9864,7 +9930,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" }, "funding": [ { @@ -9876,7 +9942,7 @@ "type": "tidelift" } ], - "time": "2023-10-08T07:28:08+00:00" + "time": "2024-03-09T15:20:58+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -10031,16 +10097,16 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.55.1", + "version": "v1.56.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "11a9d3125c5b93ab4043f0f2e9927fdc55881c17" + "reference": "bbb7949ae048363df7c8439abeddef8befd155ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/11a9d3125c5b93ab4043f0f2e9927fdc55881c17", - "reference": "11a9d3125c5b93ab4043f0f2e9927fdc55881c17", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/bbb7949ae048363df7c8439abeddef8befd155ce", + "reference": "bbb7949ae048363df7c8439abeddef8befd155ce", "shasum": "" }, "require": { @@ -10103,7 +10169,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.55.1" + "source": "https://github.com/symfony/maker-bundle/tree/v1.56.0" }, "funding": [ { @@ -10119,7 +10185,7 @@ "type": "tidelift" } ], - "time": "2024-02-21T13:41:51+00:00" + "time": "2024-03-04T13:36:45+00:00" }, { "name": "symfony/phpunit-bridge", @@ -10409,16 +10475,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -10447,7 +10513,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -10455,7 +10521,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [ diff --git a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php index bc47588f..b71921e2 100755 --- a/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/RaBundle/DependencyInjection/Configuration.php @@ -86,7 +86,7 @@ private function appendSessionConfiguration(NodeBuilder $childNodes): void ->example('3600 -> 1 hour * 60 minutes * 60 seconds') ->validate() ->ifTrue( - fn($lifetime) => !is_int($lifetime) + fn($lifetime) => !is_int($lifetime), ) ->thenInvalid('max_absolute_lifetime must be an integer') ->end() @@ -101,7 +101,7 @@ private function appendSessionConfiguration(NodeBuilder $childNodes): void ->example('600 -> 10 minutes * 60 seconds') ->validate() ->ifTrue( - fn($lifetime) => !is_int($lifetime) + fn($lifetime) => !is_int($lifetime), ) ->thenInvalid('max_relative_lifetime must be an integer') ->end() @@ -117,7 +117,7 @@ private function appendUrlConfiguration(NodeBuilder $childNodes): void ->info('The URL of Self Service, where a user can register and revoke second factors') ->validate() ->ifTrue( - fn($url) => filter_var($url, FILTER_VALIDATE_URL) === false + fn($url) => filter_var($url, FILTER_VALIDATE_URL) === false, ) ->thenInvalid('self_service_url must be a valid url') ->end(); diff --git a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php index 8138ad89..51efe6b2 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/InstitutionConfigurationOptionsServiceInterface.php @@ -1,20 +1,20 @@ Date: Thu, 14 Mar 2024 06:51:23 +0100 Subject: [PATCH 158/202] Add license check --- bin/copyright-correction.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/copyright-correction.sh b/bin/copyright-correction.sh index a1a4de88..6afea6a8 100755 --- a/bin/copyright-correction.sh +++ b/bin/copyright-correction.sh @@ -3,6 +3,9 @@ # Get all PHP files in src/ directory files=$(find src/ -type f -name "*.php") +# Initialize counter +counter=0 + for file in $files do # Get the year of the first commit of the file @@ -17,4 +20,17 @@ do # Replace the year in the copyright statement sed -i "s/Copyright [0-9]\{4\} SURFnet bv/Copyright $year SURFnet bv/g" $file + + # Check if the file was changed by using git diff + if git diff --quiet -- $file + then + # No output means no changes + continue + else + # Increment counter + ((counter++)) + fi done + +# Print the number of files changed +echo "Number of files changed: $counter" From 8fb309cea1bf1ea878127737c4c82cf27741ac68 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Fri, 22 Mar 2024 09:18:42 +0100 Subject: [PATCH 159/202] Optimize imports --- config/packages/smoketest/web_profiler.yaml | 4 ++-- .../StepupRa/RaBundle/Exception/InvalidArgumentException.php | 2 +- .../StepupRa/RaBundle/Exception/UserNotRaException.php | 1 - .../Form/Type/AmendRegistrationAuthorityInformationType.php | 2 +- .../StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php | 2 +- src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php | 2 +- .../StepupRa/RaBundle/Form/Type/CreateRaLocationType.php | 2 +- .../StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php | 2 +- .../RaBundle/Form/Type/RetractRegistrationAuthorityType.php | 2 +- .../StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php | 2 +- .../StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php | 2 +- .../StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php | 2 +- .../StepupRa/RaBundle/Form/Type/VerifyIdentityType.php | 2 +- .../StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php | 2 +- .../StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php | 2 +- .../StepupRa/RaBundle/Security/Factory/SamlFactory.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/CommandService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/GssfService.php | 2 -- src/Surfnet/StepupRa/RaBundle/Service/RaService.php | 3 +-- src/Surfnet/StepupRa/RaBundle/Service/VettingService.php | 2 +- src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php | 2 +- .../Tests/TestDouble/Service/YubikeySecondFactorService.php | 1 - src/Surfnet/StepupRa/RaBundle/Value/DateTime.php | 2 +- src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php | 2 -- src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php | 2 +- 25 files changed, 22 insertions(+), 29 deletions(-) diff --git a/config/packages/smoketest/web_profiler.yaml b/config/packages/smoketest/web_profiler.yaml index 03752de2..2393cfae 100644 --- a/config/packages/smoketest/web_profiler.yaml +++ b/config/packages/smoketest/web_profiler.yaml @@ -1,6 +1,6 @@ web_profiler: - toolbar: false + toolbar: true intercept_redirects: false framework: - profiler: { collect: false } + profiler: { collect: true } diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php index 4c666a13..6bd1412e 100755 --- a/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/InvalidArgumentException.php @@ -18,7 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Exception; -use \InvalidArgumentException as BaseInvalidArgumentException; +use InvalidArgumentException as BaseInvalidArgumentException; class InvalidArgumentException extends BaseInvalidArgumentException { diff --git a/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php b/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php index 4a33a218..c4c83d54 100755 --- a/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php +++ b/src/Surfnet/StepupRa/RaBundle/Exception/UserNotRaException.php @@ -19,7 +19,6 @@ namespace Surfnet\StepupRa\RaBundle\Exception; use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; -use Symfony\Component\Security\Core\Exception\AuthenticationException; /** * Exception for the case where a user is not granted RA privileges. diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php index cd904af4..7e1289b8 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/AmendRegistrationAuthorityInformationType.php @@ -18,12 +18,12 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand; class AmendRegistrationAuthorityInformationType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php index 79278b7a..d9344d5c 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaLocationType.php @@ -18,12 +18,12 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\ChangeRaLocationCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\ChangeRaLocationCommand; class ChangeRaLocationType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php index 352345b9..4dd4bb49 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/ChangeRaRoleType.php @@ -18,13 +18,13 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\ChangeRaRoleCommand; use Surfnet\StepupRa\RaBundle\Form\Extension\RaRoleChoiceList; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\ChangeRaRoleCommand; class ChangeRaRoleType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php index de4aef04..cb1a42d2 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/CreateRaLocationType.php @@ -18,12 +18,12 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\CreateRaLocationCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\CreateRaLocationCommand; class CreateRaLocationType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php index d3272769..e7f30cc4 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RemoveRaLocationType.php @@ -18,11 +18,11 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\RemoveRaLocationCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\RemoveRaLocationCommand; class RemoveRaLocationType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php index 44bc46b6..60eaabe4 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RetractRegistrationAuthorityType.php @@ -18,11 +18,11 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand; class RetractRegistrationAuthorityType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php index 0f99a1fe..2a49eb75 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/RevokeSecondFactorType.php @@ -18,11 +18,11 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\RevokeSecondFactorCommand; class RevokeSecondFactorType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php index 3bb85d47..3e06b1f3 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SendSmsChallengeType.php @@ -18,11 +18,11 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupBundle\Command\SendSmsChallengeCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupBundle\Command\SendSmsChallengeCommand; class SendSmsChallengeType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php index 9f50dc7a..d0026e84 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/StartVettingProcedureType.php @@ -19,12 +19,12 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; use JMS\TranslationBundle\Annotation\Ignore; +use Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand; class StartVettingProcedureType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php index 27c2e071..43ab8984 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyIdentityType.php @@ -18,13 +18,13 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand; class VerifyIdentityType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php index a07b3a50..597dd162 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyPhoneNumberType.php @@ -18,12 +18,12 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand; class VerifyPhoneNumberType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php index b8250e6c..b1bc29f5 100755 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/VerifyYubikeyPublicIdType.php @@ -18,10 +18,10 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; class VerifyYubikeyPublicIdType extends AbstractType { diff --git a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php index 3f11bb88..a707b7b3 100755 --- a/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php +++ b/src/Surfnet/StepupRa/RaBundle/Security/Factory/SamlFactory.php @@ -22,8 +22,8 @@ use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; use Symfony\Component\Config\Definition\Builder\NodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; class SamlFactory implements AuthenticatorFactoryInterface { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php index 875f72e5..07b347e0 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/CommandService.php @@ -18,12 +18,12 @@ namespace Surfnet\StepupRa\RaBundle\Service; +use Surfnet\StepupMiddlewareClient\Service\ExecutionResult; use Surfnet\StepupMiddlewareClientBundle\Command\Command; use Surfnet\StepupMiddlewareClientBundle\Command\Metadata; use Surfnet\StepupMiddlewareClientBundle\Identity\Dto\Identity; use Surfnet\StepupMiddlewareClientBundle\Service\CommandService as MiddlewareCommandService; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Surfnet\StepupMiddlewareClient\Service\ExecutionResult; final readonly class CommandService { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php index 7f5a35bb..81574e52 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/GssfService.php @@ -19,9 +19,7 @@ namespace Surfnet\StepupRa\RaBundle\Service; use Surfnet\StepupRa\RaBundle\Service\Gssf\VerificationResult; -use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; final readonly class GssfService { diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php index d6135700..bea4ba46 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php @@ -19,8 +19,7 @@ namespace Surfnet\StepupRa\RaBundle\Service; use Psr\Log\LoggerInterface; -use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AmendRegistrationAuthorityInformationCommand - as AmendRegistrationAuthorityInformationApiCommand; +use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AmendRegistrationAuthorityInformationCommand as AmendRegistrationAuthorityInformationApiCommand; use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AppointRoleCommand; use Surfnet\StepupMiddlewareClientBundle\Identity\Command\RetractRegistrationAuthorityCommand as ApiRetractRegistrationAuthorityCommand; use Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php index 85df8944..c2ab03b5 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/VettingService.php @@ -31,8 +31,8 @@ use Surfnet\StepupBundle\Value\SecondFactorType; use Surfnet\StepupBundle\Value\VettingType; use Surfnet\StepupMiddlewareClient\Service\ExecutionResult; -use Surfnet\StepupMiddlewareClientBundle\Identity\Service\SecondFactorService; use Surfnet\StepupMiddlewareClientBundle\Identity\Command\VetSecondFactorCommand; +use Surfnet\StepupMiddlewareClientBundle\Identity\Service\SecondFactorService; use Surfnet\StepupRa\RaBundle\Command\StartVettingProcedureCommand; use Surfnet\StepupRa\RaBundle\Command\VerifyIdentityCommand; use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; diff --git a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php index 61f3dc9f..a611ffa8 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/YubikeyService.php @@ -20,9 +20,9 @@ use GuzzleHttp\Client; use Psr\Log\LoggerInterface; +use RuntimeException; use Surfnet\StepupBundle\Http\JsonHelper; use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyOtpCommand; -use RuntimeException; class YubikeyService { diff --git a/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Service/YubikeySecondFactorService.php b/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Service/YubikeySecondFactorService.php index b088e35e..14c4088a 100644 --- a/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Service/YubikeySecondFactorService.php +++ b/src/Surfnet/StepupRa/RaBundle/Tests/TestDouble/Service/YubikeySecondFactorService.php @@ -23,7 +23,6 @@ use Surfnet\StepupRa\RaBundle\Command\VerifyYubikeyPublicIdCommand; use Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactor\VerificationResult; use Surfnet\StepupRa\RaBundle\Service\YubikeySecondFactorServiceInterface; -use Surfnet\StepupRa\RaBundle\Service\YubikeyService; /** diff --git a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php index c14b61ef..42f796ab 100755 --- a/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/DateTime.php @@ -20,8 +20,8 @@ use DateInterval; use DateTime as CoreDateTime; -use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; use Stringable; +use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; /** * @SuppressWarnings(PHPMD.TooManyPublicMethods) due to comparison methods diff --git a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php index d63568bd..28864694 100755 --- a/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/RoleAtInstitution.php @@ -18,8 +18,6 @@ namespace Surfnet\StepupRa\RaBundle\Value; -use Surfnet\StepupRa\RaBundle\Assert; - class RoleAtInstitution { private ?string $role = null; diff --git a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php index c2d103e7..7a4d9337 100755 --- a/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php +++ b/src/Surfnet/StepupRa/RaBundle/Value/TimeFrame.php @@ -19,8 +19,8 @@ namespace Surfnet\StepupRa\RaBundle\Value; use DateInterval; -use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; use Stringable; +use Surfnet\StepupRa\RaBundle\Exception\InvalidArgumentException; final readonly class TimeFrame implements Stringable { From b8479cd2bbd5c59063e10d7b95c7109c4d318900 Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Fri, 22 Mar 2024 09:49:15 +0100 Subject: [PATCH 160/202] Fix review - Add frontend build in test integration - Fix RAService line length --- .github/workflows/test-integration.yml | 3 +++ src/Surfnet/StepupRa/RaBundle/Service/RaService.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index d8af7a30..f0bcb858 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -22,5 +22,8 @@ jobs: - name: Yarn install run: yarn + - name: build frontend + run: yarn encore prod + - name: Run QA tests run: composer check diff --git a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php index bea4ba46..d89a553b 100755 --- a/src/Surfnet/StepupRa/RaBundle/Service/RaService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/RaService.php @@ -19,9 +19,11 @@ namespace Surfnet\StepupRa\RaBundle\Service; use Psr\Log\LoggerInterface; -use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AmendRegistrationAuthorityInformationCommand as AmendRegistrationAuthorityInformationApiCommand; +use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AmendRegistrationAuthorityInformationCommand + as AmendRegistrationAuthorityInformationApiCommand; use Surfnet\StepupMiddlewareClientBundle\Identity\Command\AppointRoleCommand; -use Surfnet\StepupMiddlewareClientBundle\Identity\Command\RetractRegistrationAuthorityCommand as ApiRetractRegistrationAuthorityCommand; +use Surfnet\StepupMiddlewareClientBundle\Identity\Command\RetractRegistrationAuthorityCommand + as ApiRetractRegistrationAuthorityCommand; use Surfnet\StepupRa\RaBundle\Command\AmendRegistrationAuthorityInformationCommand; use Surfnet\StepupRa\RaBundle\Command\ChangeRaRoleCommand; use Surfnet\StepupRa\RaBundle\Command\RetractRegistrationAuthorityCommand; From a6a018f2ce80f8320d7b6d1594a4e69e4d01dd4a Mon Sep 17 00:00:00 2001 From: Paul Rijke Date: Fri, 22 Mar 2024 10:31:15 +0100 Subject: [PATCH 161/202] Move logo --- assets/{ => openconext}/images/header-logo.png | Bin templates/base.html.twig | 4 ++-- webpack.config.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename assets/{ => openconext}/images/header-logo.png (100%) diff --git a/assets/images/header-logo.png b/assets/openconext/images/header-logo.png similarity index 100% rename from assets/images/header-logo.png rename to assets/openconext/images/header-logo.png diff --git a/templates/base.html.twig b/templates/base.html.twig index a8743ad3..fb7a8e0f 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -48,11 +48,11 @@ {% block content_div_start %}
    {% endblock content_div_start %} {% block page_header %} {% block menu %} - {% if app.user %} + {% if app.user %}chmod public
    {% block menu %} - {% if app.user %}chmod public + {% if app.user %}